Re: [libvirt] [PATCH 18/34] Add device info to serial, parallel, channel, input fs devices
On Fri, Jan 15, 2010 at 05:26:33PM +0100, Daniel Veillard wrote: On Fri, Jan 08, 2010 at 05:23:14PM +, Daniel P. Berrange wrote: Although the serial, parallel, chanel, input fs devices do not have PCI address info, they can all have device aliases. Thus it neccessary to associate the virDomainDeviceInfo data with them all. * src/conf/domain_conf.c, src/conf/domain_conf.h: Add hooks for parsing / formatting device info for serial, parallel, channel input and fs devices. * docs/schemas/domain.rng: Associate device info with character devices, input fs device --- docs/schemas/domain.rng | 12 src/conf/domain_conf.c | 67 ++ src/conf/domain_conf.h |4 +++ 3 files changed, 71 insertions(+), 12 deletions(-) diff --git a/docs/schemas/domain.rng b/docs/schemas/domain.rng index a32ce45..f4bef7b 100644 --- a/docs/schemas/domain.rng +++ b/docs/schemas/domain.rng @@ -600,6 +600,9 @@ /interleave /group /choice + optional + ref name=address/ + /optional /element /define define name=filesystemtgt @@ -990,6 +993,9 @@ /optional /element /optional + optional + ref name=address/ + /optional /interleave /define define name=qemucdevSrcType @@ -1119,6 +1125,9 @@ interleave ref name=qemucdevSrcDef/ ref name=guestfwdTarget/ + optional + ref name=address/ + /optional /interleave /element /define @@ -1139,6 +1148,9 @@ /choice /attribute /optional + optional + ref name=address/ + /optional /element /define define name=hostdev Hum, unless I'm mistaken this also allow to add a PCI like address on input even if it would be ignored, maybe this should be tightened to just allow the info That is correct - it'll allow any of the device info at the parsing stage. Some hypervisors may support PCI based serial, parallel, devices and input devices. Ideally, we should make all the hypervisor drivers check for reject devices with addressing schemes they don't support but that's alot of work. We might need to thing about exposing a way for hypervisor drivers to register fine grained parser features. So a HV driver could indicate that it only supports devices X, Y Z with addressing schemes A B. Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :| -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 18/34] Add device info to serial, parallel, channel, input fs devices
On Fri, Jan 08, 2010 at 05:23:14PM +, Daniel P. Berrange wrote: Although the serial, parallel, chanel, input fs devices do not have PCI address info, they can all have device aliases. Thus it neccessary to associate the virDomainDeviceInfo data with them all. * src/conf/domain_conf.c, src/conf/domain_conf.h: Add hooks for parsing / formatting device info for serial, parallel, channel input and fs devices. * docs/schemas/domain.rng: Associate device info with character devices, input fs device --- docs/schemas/domain.rng | 12 src/conf/domain_conf.c | 67 ++ src/conf/domain_conf.h |4 +++ 3 files changed, 71 insertions(+), 12 deletions(-) diff --git a/docs/schemas/domain.rng b/docs/schemas/domain.rng index a32ce45..f4bef7b 100644 --- a/docs/schemas/domain.rng +++ b/docs/schemas/domain.rng @@ -600,6 +600,9 @@ /interleave /group /choice + optional + ref name=address/ + /optional /element /define define name=filesystemtgt @@ -990,6 +993,9 @@ /optional /element /optional + optional + ref name=address/ + /optional /interleave /define define name=qemucdevSrcType @@ -1119,6 +1125,9 @@ interleave ref name=qemucdevSrcDef/ ref name=guestfwdTarget/ + optional + ref name=address/ + /optional /interleave /element /define @@ -1139,6 +1148,9 @@ /choice /attribute /optional + optional + ref name=address/ + /optional /element /define define name=hostdev Hum, unless I'm mistaken this also allow to add a PCI like address on input even if it would be ignored, maybe this should be tightened to just allow the info otherwise looks fine ACK, Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ dan...@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/ -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 18/34] Add device info to serial, parallel, channel, input fs devices
Although the serial, parallel, chanel, input fs devices do not have PCI address info, they can all have device aliases. Thus it neccessary to associate the virDomainDeviceInfo data with them all. * src/conf/domain_conf.c, src/conf/domain_conf.h: Add hooks for parsing / formatting device info for serial, parallel, channel input and fs devices. * docs/schemas/domain.rng: Associate device info with character devices, input fs device --- docs/schemas/domain.rng | 12 src/conf/domain_conf.c | 67 ++ src/conf/domain_conf.h |4 +++ 3 files changed, 71 insertions(+), 12 deletions(-) diff --git a/docs/schemas/domain.rng b/docs/schemas/domain.rng index a32ce45..f4bef7b 100644 --- a/docs/schemas/domain.rng +++ b/docs/schemas/domain.rng @@ -600,6 +600,9 @@ /interleave /group /choice + optional + ref name=address/ + /optional /element /define define name=filesystemtgt @@ -990,6 +993,9 @@ /optional /element /optional + optional + ref name=address/ + /optional /interleave /define define name=qemucdevSrcType @@ -1119,6 +1125,9 @@ interleave ref name=qemucdevSrcDef/ ref name=guestfwdTarget/ + optional + ref name=address/ + /optional /interleave /element /define @@ -1139,6 +1148,9 @@ /choice /attribute /optional + optional + ref name=address/ + /optional /element /define define name=hostdev diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 7c5abde..9c03aab 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -355,6 +355,7 @@ void virDomainInputDefFree(virDomainInputDefPtr def) if (!def) return; +virDomainDeviceInfoClear(def-info); VIR_FREE(def); } @@ -391,6 +392,7 @@ void virDomainFSDefFree(virDomainFSDefPtr def) VIR_FREE(def-src); VIR_FREE(def-dst); +virDomainDeviceInfoClear(def-info); VIR_FREE(def); } @@ -474,6 +476,8 @@ void virDomainChrDefFree(virDomainChrDefPtr def) break; } +virDomainDeviceInfoClear(def-info); + VIR_FREE(def); } @@ -844,11 +848,23 @@ static void virDomainDefClearDeviceInfo(virDomainDefPtr def, int alias, int pcia for (i = 0; i def-nhostdevs ; i++) virDomainDeviceInfoClearField(def-hostdevs[i]-info, alias, pciaddr); for (i = 0; i def-nvideos ; i++) -virDomainDeviceInfoClearField(def-videos[i]-info, alias, pciaddr); +virDomainDeviceInfoClearField(def-videos[i]-info, alias, pciaddr); for (i = 0; i def-ncontrollers ; i++) -virDomainDeviceInfoClearField(def-controllers[i]-info, alias, pciaddr); +virDomainDeviceInfoClearField(def-controllers[i]-info, alias, pciaddr); +for (i = 0; i def-nserials ; i++) +virDomainDeviceInfoClearField(def-serials[i]-info, alias, pciaddr); +for (i = 0; i def-nparallels ; i++) +virDomainDeviceInfoClearField(def-parallels[i]-info, alias, pciaddr); +for (i = 0; i def-nchannels ; i++) +virDomainDeviceInfoClearField(def-channels[i]-info, alias, pciaddr); +for (i = 0; i def-ninputs ; i++) +virDomainDeviceInfoClearField(def-inputs[i]-info, alias, pciaddr); +for (i = 0; i def-nfss ; i++) +virDomainDeviceInfoClearField(def-fss[i]-info, alias, pciaddr); if (def-watchdog) virDomainDeviceInfoClearField(def-watchdog-info, alias, pciaddr); +if (def-console) +virDomainDeviceInfoClearField(def-console-info, alias, pciaddr); } @@ -1485,7 +1501,7 @@ cleanup: static virDomainFSDefPtr virDomainFSDefParseXML(virConnectPtr conn, xmlNodePtr node, - int flags ATTRIBUTE_UNUSED) { + int flags) { virDomainFSDefPtr def; xmlNodePtr cur; char *type = NULL; @@ -1549,6 +1565,9 @@ virDomainFSDefParseXML(virConnectPtr conn, def-dst = target; target = NULL; +if (virDomainDeviceInfoParseXML(conn, node, def-info, flags) 0) +goto error; + cleanup: VIR_FREE(type); VIR_FREE(target); @@ -1890,7 +1909,7 @@ error: static virDomainChrDefPtr virDomainChrDefParseXML(virConnectPtr conn, xmlNodePtr node, -int flags ATTRIBUTE_UNUSED) { +int flags) { xmlNodePtr cur; char *type = NULL; char *bindHost = NULL; @@ -2184,6 +2203,9 @@ virDomainChrDefParseXML(virConnectPtr conn, break; } +if (virDomainDeviceInfoParseXML(conn, node, def-info, flags) 0) +goto error; + cleanup: VIR_FREE(mode); VIR_FREE(protocol); @@ -2210,7 +2232,7 @@ static virDomainInputDefPtr virDomainInputDefParseXML(virConnectPtr conn, const char *ostype, xmlNodePtr node, -