[libvirt] two hostdev devices problem
hi, I try to add 2 VF by hostdev. Networks (vnet0, vnet1) with: forward mode='hostdev' managed='yes' pf dev='eth1'/ . Domain: interface type=network source network=vnet0/ interface type=network source network=vnet1/ virsh create error: error: internal error process exited while connecting to monitor: kvm: -device pci-assign,configfd=25,host=01:10.1,id=hostdev0,bus=pci.0,addr=0x4: Duplicate ID 'hostdev0' for device I am doing somthing wrong? My configs: domain: domain xmlns:qemu=http://libvirt.org/schemas/domain/qemu/1.0; type=kvm nameone-466/name vcpu1/vcpu memory1781760/memory os type arch=x86_64hvm/type boot dev=hd/ /os devices emulator/usr/bin/kvm/emulator disk type=file device=disk source file=/nebula/nebula/var//datastores/0/466/disk.0/ target dev=hda bus=virtio/ driver name=qemu type=raw cache=default/ /disk disk type=file device=disk source file=/nebula/nebula/var//datastores/0/466/disk.1/ target dev=vdb bus=virtio/ driver name=qemu type=raw cache=default/ /disk graphics type=vnc listen=0.0.0.0 port=-1/ interface type=network source network=vnet0/ mac address=52:54:0a:b1:48:91/ /interface interface type=network source network=vnet1/ mac address=52:54:0a:b1:48:92/ /interface /devices features acpi/ /features devicesserial type=ptysource path=/dev/pts/477/target port=0//serialconsole type=pty tty=/dev/pts/477source path=/dev/pts/477/target port=0//console/devices /domain Networks: cat /etc/libvirt/qemu/networks/vnet0.xml !-- WARNING: THIS IS AN AUTO-GENERATED FILE. CHANGES TO IT ARE LIKELY TO BE OVERWRITTEN AND LOST. Changes to this xml configuration should be made using: virsh net-edit vnet0 or other application using the libvirt API. -- network namevnet0/name uuid1b6a3506-d9e0-4e1e-bbff-6f700b8dc80b/uuid forward mode='hostdev' managed='yes' pf dev='eth0'/ /forward /network cat /etc/libvirt/qemu/networks/vnet1.xml !-- WARNING: THIS IS AN AUTO-GENERATED FILE. CHANGES TO IT ARE LIKELY TO BE OVERWRITTEN AND LOST. Changes to this xml configuration should be made using: virsh net-edit vnet1 or other application using the libvirt API. -- network namevnet1/name uuid11feb088-d609-4177-86d7-ac3b9467a3e8/uuid forward mode='hostdev' managed='yes' pf dev='eth1'/ /forward /network I wrote libvirt-users mailing list too. -- Pozdrawiam Dominik -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [libvirt-perl][PATCH] Fix typo in domain help page
On 21/05/13 10:46, Zhe Peng wrote: The help page of $dom-set_metadata have a typo,this patch fix it. s/have/has/, s/fix/fixes/, --- lib/Sys/Virt/Domain.pm |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/lib/Sys/Virt/Domain.pm b/lib/Sys/Virt/Domain.pm index a502029..053f127 100644 --- a/lib/Sys/Virt/Domain.pm +++ b/lib/Sys/Virt/Domain.pm @@ -112,7 +112,7 @@ C$flags parameter defaults to zero. Sets the metadata element of type C$type to hold the value C$val. If C$type is CSys::Virt::Domain::METADATA_ELEMENT then the C$key and C$uri elements specify an XML namespace -to use, otherwise they should both be Cnudef. The optional +to use, otherwise they should both be Cundef. The optional C$flags parameter defaults to zero. =item $dom-is_active() Pushed. -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [libvirt-perl][PATCH] Fix typo in domain help page
On 21/05/13 15:35, Osier Yang wrote: On 21/05/13 10:46, Zhe Peng wrote: The help page of $dom-set_metadata have a typo,this patch fix it. s/have/has/, s/fix/fixes/, --- lib/Sys/Virt/Domain.pm |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/lib/Sys/Virt/Domain.pm b/lib/Sys/Virt/Domain.pm index a502029..053f127 100644 --- a/lib/Sys/Virt/Domain.pm +++ b/lib/Sys/Virt/Domain.pm @@ -112,7 +112,7 @@ C$flags parameter defaults to zero. Sets the metadata element of type C$type to hold the value C$val. If C$type is CSys::Virt::Domain::METADATA_ELEMENT then the C$key and C$uri elements specify an XML namespace -to use, otherwise they should both be Cnudef. The optional +to use, otherwise they should both be Cundef. The optional C$flags parameter defaults to zero. =item $dom-is_active() Pushed. With AUTHORS updated. -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] two hostdev devices problem
On 05/21/2013 09:32 AM, Dominik Mostowiec wrote: hi, I try to add 2 VF by hostdev. Networks (vnet0, vnet1) with: forward mode='hostdev' managed='yes' pf dev='eth1'/ . Domain: interface type=network source network=vnet0/ interface type=network source network=vnet1/ virsh create error: error: internal error process exited while connecting to monitor: kvm: -device pci-assign,configfd=25,host=01:10.1,id=hostdev0,bus=pci.0,addr=0x4: Duplicate ID 'hostdev0' for device Hi, it seems we have been assigning the same id to all network hostdevs until this recent commit (not yet released): http://libvirt.org/git/?p=libvirt.git;a=commitdiff;h=6597cc25 Jan -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [qemu-devel] Default machine type setting for ppc64
Hi all, Sorry to bring this problem up again. We encounter this problem in openstack which always use default machine type. Currently, QEMU sets mac99 as default setting for ppc64 but it doesn't work on our platform at all. I tried to fix this in libvirt which it is not acceptable because libvirt only considers to get default setting from QEMU. Maybe I need to cc openstack mailing list, if it is one solution to add one option for machine types it supports. Any suggestion is appreciated. Thanks. :) --Li -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [Qemu-devel] Default machine type setting for ppc64
Oops, correct libvirt mailing list address. :) Thanks. On 2013年05月21日 16:19, Li Zhang wrote: Hi all, Sorry to bring this problem up again. We encounter this problem in openstack which always use default machine type. Currently, QEMU sets mac99 as default setting for ppc64 but it doesn't work on our platform at all. I tried to fix this in libvirt which it is not acceptable because libvirt only considers to get default setting from QEMU. Maybe I need to cc openstack mailing list, if it is one solution to add one option for machine types it supports. Any suggestion is appreciated. Thanks. :) --Li -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] vbox: fix VIR_STRDUP value check
On 05/20/2013 05:55 PM, Eric Blake wrote: On 05/20/2013 03:59 AM, Ján Tomko wrote: In my review of 31532ca I missed the fact that VIR_STRDUP now returns 1 on success, and 0 if the source was NULL. (This still doesn't add proper OOM error handling.) --- src/vbox/vbox_tmpl.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c index eb8ac63..163aeff 100644 --- a/src/vbox/vbox_tmpl.c +++ b/src/vbox/vbox_tmpl.c @@ -2688,9 +2688,9 @@ static char *vboxDomainGetXMLDesc(virDomainPtr dom, unsigned int flags) { if (hddType == HardDiskType_Immutable) def-disks[hddNum]-readonly = true; -if (VIR_STRDUP_QUIET(def-disks[hddNum]-src, hddlocation) == 0 -VIR_STRDUP_QUIET(def-disks[hddNum]-dst, hdd) == 0) -hddNum++; +ignore_value(VIR_STRDUP(def-disks[hddNum]-src, hddlocation)); +ignore_value(VIR_STRDUP(def-disks[hddNum]-dst, hdd)); +hddNum++; This changes the situations in which hddNum is set; now hddNum is incremented even if you hit an OOM error. Is that really what you want? It's what was done before 31532ca and handling an OOM error properly would require rewriting the whole function. And in this case, the increment doesn't matter at all, since hddNum is never used again. Jan -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [Qemu-devel] [qemu-devel] Default machine type setting for ppc64
On 21 May 2013 09:19, Li Zhang zhlci...@gmail.com wrote: We encounter this problem in openstack which always use default machine type. Currently, QEMU sets mac99 as default setting for ppc64 but it doesn't work on our platform at all. I tried to fix this in libvirt which it is not acceptable because libvirt only considers to get default setting from QEMU. This will need to be fixed for ARM -- the whole idea of there being a sensible default machine type and it being the one QEMU starts by default is pretty x86-centric. libvirt needs to have support for specifying which machine to use. (There is consideration of changing the default ppc64 machine, as it happens; but in general you can't rely on QEMU doing what you want if you don't tell it specifically which board you wanted.) thanks -- PMM -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [Qemu-devel] [qemu-devel] Default machine type setting for ppc64
On Tue, May 21, 2013 at 09:31:26AM +0100, Peter Maydell wrote: On 21 May 2013 09:19, Li Zhang zhlci...@gmail.com wrote: We encounter this problem in openstack which always use default machine type. Currently, QEMU sets mac99 as default setting for ppc64 but it doesn't work on our platform at all. I tried to fix this in libvirt which it is not acceptable because libvirt only considers to get default setting from QEMU. This will need to be fixed for ARM -- the whole idea of there being a sensible default machine type and it being the one QEMU starts by default is pretty x86-centric. libvirt needs to have support for specifying which machine to use. Libvirt has always had support for specifying what machine type to use. This discussion is simply about what machine type to default to, if the user hasn't explicitly asked for one. QEMU has the notion of a default machine for each target, and that is what libvirt uses if the user hasn't specified a machine. It is not libvirt's job to override QEMU's notion of the default machine here, so if the 'mac99' machine type isn't suitable as the default either QEMU needs to change that for the ppc target, or the user needs to explicitly specify their desired machine type. Regards, Daniel -- |: http://berrange.com -o-http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :| -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [Qemu-devel] [qemu-devel] Default machine type setting for ppc64
On 2013年05月21日 16:31, Peter Maydell wrote: On 21 May 2013 09:19, Li Zhang zhlci...@gmail.com wrote: We encounter this problem in openstack which always use default machine type. Currently, QEMU sets mac99 as default setting for ppc64 but it doesn't work on our platform at all. I tried to fix this in libvirt which it is not acceptable because libvirt only considers to get default setting from QEMU. This will need to be fixed for ARM -- the whole idea of there being a sensible default machine type and it being the one QEMU starts by default is pretty x86-centric. libvirt needs to have support for specifying which machine to use. Ah, libvirt does have support for specifying one machine type. I mean that libvirt set default according to QEMU's default setting, and management tools are dependent on this default setting without users' specified setting. I tried to change the default setting according to ppc64 platform in libvirt, but it is not accepted. (There is consideration of changing the default ppc64 machine, as it happens; but in general you can't rely on QEMU doing what you want if you don't tell it specifically which board you wanted.) I see. Thanks for your suggestion. :) thanks -- PMM -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [Qemu-devel] [qemu-devel] Default machine type setting for ppc64
On 21 May 2013 09:39, Daniel P. Berrange berra...@redhat.com wrote: Libvirt has always had support for specifying what machine type to use. This discussion is simply about what machine type to default to, if the user hasn't explicitly asked for one. QEMU has the notion of a default machine for each target, and that is what libvirt uses if the user hasn't specified a machine. It is not libvirt's job to override QEMU's notion of the default machine here, Agreed; thanks for the clarification. so if the 'mac99' machine type isn't suitable as the default either QEMU needs to change that for the ppc target, or the user needs to explicitly specify their desired machine type. OK, that makes sense. So is the problem here just configuration or is it the next layer above libvirt not being configurable? (the thing about changing the default is that it obviously breaks command line compatibility for anybody who was relying on the old default. So for ARM we're a bit locked in to a default which is pretty useless for most people.) thanks -- PMM -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH] docs: formatdomain: fix links in the table of contents
--- Pushed under the trivial rule. docs/formatdomain.html.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index 9284534..d9814dd 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -2350,7 +2350,7 @@ h4a name=elementsHostDevHost device assignment/a/h4 -h5a href=elementsHostDevSubsysUSB / PCI / SCSI devices/a/h5 +h5a name=elementsHostDevSubsysUSB / PCI / SCSI devices/a/h5 p USB, PCI and SCSI devices attached to the host can be passed through @@ -2526,7 +2526,7 @@ /dl -h5a href=elementsHostDevCapsBlock / character devices/a/h5 +h5a name=elementsHostDevCapsBlock / character devices/a/h5 p Block / character devices from the host can be passed through -- 1.8.1.5 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH] interface: list all interfaces with flags == 0
virConnectListAllInterfaces should support to list all of interfaces when the value of flags is 0. The behaviour is consistent with other virConnectListAll* APIs --- src/conf/interface_conf.h | 4 src/interface/interface_backend_netcf.c | 27 +-- src/interface/interface_backend_udev.c | 23 ++- 3 files changed, 27 insertions(+), 27 deletions(-) diff --git a/src/conf/interface_conf.h b/src/conf/interface_conf.h index e636c35..ae93811 100644 --- a/src/conf/interface_conf.h +++ b/src/conf/interface_conf.h @@ -211,4 +211,8 @@ char *virInterfaceDefFormat(const virInterfaceDefPtr def); void virInterfaceObjLock(virInterfaceObjPtr obj); void virInterfaceObjUnlock(virInterfaceObjPtr obj); +#define VIR_CONNECT_LIST_INTERFACES_FILTERS_ACTIVE \ +(VIR_CONNECT_LIST_INTERFACES_ACTIVE | \ + VIR_CONNECT_LIST_INTERFACES_INACTIVE) + #endif /* __INTERFACE_CONF_H__ */ diff --git a/src/interface/interface_backend_netcf.c b/src/interface/interface_backend_netcf.c index cbba4fd..c6e069a 100644 --- a/src/interface/interface_backend_netcf.c +++ b/src/interface/interface_backend_netcf.c @@ -260,6 +260,7 @@ static int netcfConnectListDefinedInterfaces(virConnectPtr conn, char **const na } +#define MATCH(FLAG) (flags (FLAG)) static int netcfConnectListAllInterfaces(virConnectPtr conn, virInterfacePtr **ifaces, @@ -276,8 +277,7 @@ netcfConnectListAllInterfaces(virConnectPtr conn, int ret = -1; char **names = NULL; -virCheckFlags(VIR_CONNECT_LIST_INTERFACES_ACTIVE | - VIR_CONNECT_LIST_INTERFACES_INACTIVE, -1); +virCheckFlags(VIR_CONNECT_LIST_INTERFACES_FILTERS_ACTIVE, -1); interfaceDriverLock(driver); @@ -293,7 +293,6 @@ netcfConnectListAllInterfaces(virConnectPtr conn, _(failed to get number of host interfaces: %s%s%s), errmsg, details ? - : , details ? details : ); -ret = -1; goto cleanup; } @@ -304,7 +303,6 @@ netcfConnectListAllInterfaces(virConnectPtr conn, if (VIR_ALLOC_N(names, count) 0) { virReportOOMError(); -ret = -1; goto cleanup; } @@ -361,16 +359,17 @@ netcfConnectListAllInterfaces(virConnectPtr conn, /* XXX: Filter the result, need to be splitted once new filter flags * except active|inactive are supported. */ -if (((status NETCF_IFACE_ACTIVE) - (flags VIR_CONNECT_LIST_INTERFACES_ACTIVE)) || -((status NETCF_IFACE_INACTIVE) - (flags VIR_CONNECT_LIST_INTERFACES_INACTIVE))) { -if (ifaces) { -iface_obj = virGetInterface(conn, ncf_if_name(iface), -ncf_if_mac_string(iface)); -tmp_iface_objs[niface_objs] = iface_obj; -} -niface_objs++; +if (MATCH(VIR_CONNECT_LIST_INTERFACES_FILTERS_ACTIVE) +!((MATCH(VIR_CONNECT_LIST_INTERFACES_ACTIVE) + (status NETCF_IFACE_ACTIVE)) || + (MATCH(VIR_CONNECT_LIST_INTERFACES_INACTIVE) + (status NETCF_IFACE_INACTIVE +continue; + +if (ifaces) { +iface_obj = virGetInterface(conn, ncf_if_name(iface), +ncf_if_mac_string(iface)); +tmp_iface_objs[niface_objs++] = iface_obj; } ncf_if_free(iface); diff --git a/src/interface/interface_backend_udev.c b/src/interface/interface_backend_udev.c index 1fd7d46..242fc15 100644 --- a/src/interface/interface_backend_udev.c +++ b/src/interface/interface_backend_udev.c @@ -282,6 +282,7 @@ udevConnectListDefinedInterfaces(virConnectPtr conn, VIR_UDEV_IFACE_INACTIVE); } +#define MATCH(FLAG) (flags (FLAG)) static int udevConnectListAllInterfaces(virConnectPtr conn, virInterfacePtr **ifaces, @@ -299,8 +300,7 @@ udevConnectListAllInterfaces(virConnectPtr conn, int status = 0; int ret; -virCheckFlags(VIR_CONNECT_LIST_INTERFACES_ACTIVE | - VIR_CONNECT_LIST_INTERFACES_INACTIVE, -1); +virCheckFlags(VIR_CONNECT_LIST_INTERFACES_FILTERS_ACTIVE, -1); /* Grab a udev reference */ udev = udev_ref(driverState-udev); @@ -354,7 +354,6 @@ udevConnectListAllInterfaces(virConnectPtr conn, const char *path; const char *name; const char *macaddr; -int add_to_list = 0; path = udev_list_entry_get_name(dev_entry); dev = udev_device_new_from_syspath(udev, path); @@ -363,18 +362,15 @@ udevConnectListAllInterfaces(virConnectPtr conn, status = STREQ(udev_device_get_sysattr_value(dev, operstate), up); /* Filter the results */ -if (status (flags VIR_CONNECT_LIST_INTERFACES_ACTIVE)) -add_to_list = 1; -
Re: [libvirt] [Qemu-devel] [qemu-devel] Default machine type setting for ppc64
On 2013年05月21日 16:45, Peter Maydell wrote: On 21 May 2013 09:39, Daniel P. Berrange berra...@redhat.com wrote: Libvirt has always had support for specifying what machine type to use. This discussion is simply about what machine type to default to, if the user hasn't explicitly asked for one. QEMU has the notion of a default machine for each target, and that is what libvirt uses if the user hasn't specified a machine. It is not libvirt's job to override QEMU's notion of the default machine here, Agreed; thanks for the clarification. so if the 'mac99' machine type isn't suitable as the default either QEMU needs to change that for the ppc target, or the user needs to explicitly specify their desired machine type. OK, that makes sense. So is the problem here just configuration or is it the next layer above libvirt not being configurable? Currently, the next layer above libvirt is not configurable. It is dependent on this default setting. Users also expect to start one VM successfully by default. Thanks. -- Li (the thing about changing the default is that it obviously breaks command line compatibility for anybody who was relying on the old default. So for ARM we're a bit locked in to a default which is pretty useless for most people.) thanks -- PMM -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH v4 01/13] Adapt to VIR_STRDUP and VIR_STRNDUP in src/conf/*
On 21.05.2013 00:38, Eric Blake wrote: On 05/20/2013 11:55 AM, Michal Privoznik wrote: --- src/conf/capabilities.c | 30 --- src/conf/cpu_conf.c | 20 src/conf/domain_conf.c | 119 src/conf/domain_event.c | 41 +++ src/conf/node_device_conf.c | 28 +-- src/conf/nwfilter_conf.c| 17 ++- src/conf/nwfilter_params.c | 34 - src/conf/snapshot_conf.c| 11 ++-- src/conf/storage_conf.c | 13 ++--- src/conf/virchrdev.c| 12 ++--- 10 files changed, 107 insertions(+), 218 deletions(-) } @@ -392,17 +392,14 @@ virCapabilitiesAddGuest(virCapsPtr caps, if (VIR_ALLOC(guest) 0) goto no_memory; -if ((guest-ostype = strdup(ostype)) == NULL) +if (VIR_STRDUP(guest-ostype, ostype) 0) goto no_memory; Local double-oom. You might want to clean this one up now. You mean s/no_memory/error/ ? Because even if the label is called no_memory not every label does call virReportOOMError(), like in this case. guest-arch.id = arch; guest-arch.wordsize = virArchGetWordSize(arch); -if (emulator -(guest-arch.defaultInfo.emulator = strdup(emulator)) == NULL) -goto no_memory; -if (loader -(guest-arch.defaultInfo.loader = strdup(loader)) == NULL) +if (VIR_STRDUP(guest-arch.defaultInfo.emulator, emulator) 0 || +VIR_STRDUP(guest-arch.defaultInfo.loader, loader) 0) goto no_memory; another local double-oom. Cleaning now would be nice, but I guess I can live with the promise of later cleanup of 'no_memory' labels. -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [Qemu-devel] [qemu-devel] Default machine type setting for ppc64
On 21 May 2013 10:02, Li Zhang zhlci...@gmail.com wrote: On 2013年05月21日 16:45, Peter Maydell wrote: On 21 May 2013 09:39, Daniel P. Berrange berra...@redhat.com wrote: Libvirt has always had support for specifying what machine type to use. OK, that makes sense. So is the problem here just configuration or is it the next layer above libvirt not being configurable? Currently, the next layer above libvirt is not configurable. It is dependent on this default setting. Users also expect to start one VM successfully by default. Right. I think we've now identified the bit of software whose x86-centric assumptions need fixing :-) thanks -- PMM -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [Qemu-devel] [qemu-devel] Default machine type setting for ppc64
On Tue, May 21, 2013 at 05:02:51PM +0800, Li Zhang wrote: On 2013年05月21日 16:45, Peter Maydell wrote: On 21 May 2013 09:39, Daniel P. Berrange berra...@redhat.com wrote: Libvirt has always had support for specifying what machine type to use. This discussion is simply about what machine type to default to, if the user hasn't explicitly asked for one. QEMU has the notion of a default machine for each target, and that is what libvirt uses if the user hasn't specified a machine. It is not libvirt's job to override QEMU's notion of the default machine here, Agreed; thanks for the clarification. so if the 'mac99' machine type isn't suitable as the default either QEMU needs to change that for the ppc target, or the user needs to explicitly specify their desired machine type. OK, that makes sense. So is the problem here just configuration or is it the next layer above libvirt not being configurable? Currently, the next layer above libvirt is not configurable. It is dependent on this default setting. Users also expect to start one VM successfully by default. What is the application above libvirt you are using ? It clearly needs to be fixed if it is to use non-x86 archs successfully. Daniel -- |: http://berrange.com -o-http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :| -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] cgroup: be robust against cgroup movement races
On Mon, May 20, 2013 at 09:07:17PM -0600, Eric Blake wrote: https://bugzilla.redhat.com/show_bug.cgi?id=965169 documents a problem starting domains when cgroups are enabled; I was able to reliably reproduce the race about 5% of the time when I added hooks to domain startup by 3 seconds (as that seemed to be about the length of time that qemu created and then closed a temporary thread, probably related to aio handling of initially opening a disk image). There are some inherent TOCTTOU races when moving tasks between kernel cgroups, precisely because threads can be created or completed in the window between when we read a thread id from the source and when we write to the destination. As the goal of virCgroupMoveTask is merely to move ALL tasks into the new cgroup, it is sufficient to iterate until no more threads are being created in the old group, and ignoring any threads that die before we can move them. It would be nicer to start the threads in the right cgroup to begin with, but by default, all child threads are created in the same cgroup as their parent, and we don't want vcpu child threads in the emulator cgroup, so I don't see any good way of avoiding the move. It would also be nice if the kernel were to implement something like rename() as a way to atomically move a group of threads from one cgroup to another, instead of forcing a window where we have to read and parse the source, then format and write back into the destination. * src/util/vircgroup.c (virCgroupAddTaskStrController): Ignore ESRCH, because a thread ended between read and write attempts. (virCgroupMoveTask): Loop until all threads have moved. Signed-off-by: Eric Blake ebl...@redhat.com --- src/util/vircgroup.c | 28 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c index 07ea2c3..6d44694 100644 --- a/src/util/vircgroup.c +++ b/src/util/vircgroup.c @@ -1037,7 +1037,11 @@ static int virCgroupAddTaskStrController(virCgroupPtr group, goto cleanup; rc = virCgroupAddTaskController(group, p, controller); -if (rc != 0) +/* A thread that exits between when we first read the source + * tasks and now is not fatal. */ +if (rc == -ESRCH) +rc = 0; +else if (rc != 0) goto cleanup; next = strchr(cur, '\n'); @@ -1074,15 +1078,23 @@ int virCgroupMoveTask(virCgroupPtr src_group, virCgroupPtr dest_group) !dest_group-controllers[i].mountPoint) continue; -rc = virCgroupGetValueStr(src_group, i, tasks, content); -if (rc != 0) -return rc; +/* New threads are created in the same group as their parent; + * but if a thread is created after we first read we aren't + * aware that it needs to move. Therefore, we must iterate + * until content is empty. */ +while (1) { +rc = virCgroupGetValueStr(src_group, i, tasks, content); +if (rc != 0) +return rc; +if (!*content) +break; -rc = virCgroupAddTaskStrController(dest_group, content, i); -if (rc != 0) -goto cleanup; +rc = virCgroupAddTaskStrController(dest_group, content, i); +if (rc != 0) +goto cleanup; -VIR_FREE(content); +VIR_FREE(content); +} } cleanup: ACK, this looks like the best we can do here. Daniel -- |: http://berrange.com -o-http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :| -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [Qemu-devel] [qemu-devel] Default machine type setting for ppc64
On Tue, May 21, 2013 at 09:39:53AM +0100, Daniel P. Berrange wrote: On Tue, May 21, 2013 at 09:31:26AM +0100, Peter Maydell wrote: On 21 May 2013 09:19, Li Zhang zhlci...@gmail.com wrote: We encounter this problem in openstack which always use default machine type. Currently, QEMU sets mac99 as default setting for ppc64 but it doesn't work on our platform at all. I tried to fix this in libvirt which it is not acceptable because libvirt only considers to get default setting from QEMU. This will need to be fixed for ARM -- the whole idea of there being a sensible default machine type and it being the one QEMU starts by default is pretty x86-centric. libvirt needs to have support for specifying which machine to use. Libvirt has always had support for specifying what machine type to use. This discussion is simply about what machine type to default to, if the user hasn't explicitly asked for one. So, the situation is that the XML in question has typehvm/type, in the os section. Does that say anything about what type of machine is being requested? Why is the machine type in the os section rather than the domain section? QEMU has the notion of a default machine for each target, and that is what libvirt uses if the user hasn't specified a machine. It is not libvirt's job to override QEMU's notion of the default machine here, so if the 'mac99' machine type isn't suitable as the default either QEMU needs to change that for the ppc target, or the user needs to explicitly specify their desired machine type. We are getting the default changed to 'pseries', at least for cases where pseries support is compiled in, which isn't necessarily always. That will of course not satisfy the Freescale guys. I think libvirt needs some more sensible way to ask qemu what its capabilities are. Currently it has no way to ask qemu what machines can you emulate with kvm acceleration? If the user has asked for a KVM domain then the default machine should be one that can be provided by KVM. At present it isn't, on PowerPC. Paul. -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 08/31] src/phyp: Remove the whitespace before '; '
--- src/phyp/phyp_driver.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/phyp/phyp_driver.c b/src/phyp/phyp_driver.c index 4594cbf..70d3adb 100644 --- a/src/phyp/phyp_driver.c +++ b/src/phyp/phyp_driver.c @@ -1008,7 +1008,7 @@ connected: libssh2_session_set_blocking(session, 0); while ((rc = libssh2_session_startup(session, sock)) == - LIBSSH2_ERROR_EAGAIN) ; + LIBSSH2_ERROR_EAGAIN); if (rc) { virReportError(VIR_ERR_INTERNAL_ERROR, %s, _(Failure establishing SSH session.)); @@ -1026,7 +1026,7 @@ connected: pubkey, pvtkey, NULL)) == - LIBSSH2_ERROR_EAGAIN) ; + LIBSSH2_ERROR_EAGAIN); keyboard_interactive: if (rc == LIBSSH2_ERROR_SOCKET_NONE @@ -1049,7 +1049,7 @@ keyboard_interactive: while ((rc = libssh2_userauth_password(session, username, password)) == - LIBSSH2_ERROR_EAGAIN) ; + LIBSSH2_ERROR_EAGAIN); if (rc) { virReportError(VIR_ERR_AUTH_FAILED, -- 1.8.1.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 02/31] src/libxl: Remove the whitespace before '; '
--- src/libxl/libxl_conf.c | 4 ++-- src/libxl/libxl_driver.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c index 1a7e430..90d563b 100644 --- a/src/libxl/libxl_conf.c +++ b/src/libxl/libxl_conf.c @@ -244,7 +244,7 @@ libxlMakeCapabilitiesInternal(virArch hostarch, } /* Search for existing matching (model,hvm) tuple */ -for (i = 0 ; i nr_guest_archs ; i++) { +for (i = 0; i nr_guest_archs; i++) { if ((guest_archs[i].arch == arch) guest_archs[i].hvm == hvm) { break; @@ -377,7 +377,7 @@ libxlMakeDomBuildInfo(virDomainDefPtr def, libxl_domain_config *d_config) libxl_defbool_set(b_info-u.hvm.hpet, 1); } } -for (i = 0 ; i def-os.nBootDevs ; i++) { +for (i = 0; i def-os.nBootDevs; i++) { switch (def-os.bootDevs[i]) { case VIR_DOMAIN_BOOT_FLOPPY: bootorder[i] = 'a'; diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c index d268eea..7245f97 100644 --- a/src/libxl/libxl_driver.c +++ b/src/libxl/libxl_driver.c @@ -3213,7 +3213,7 @@ libxlDomainChangeEjectableMedia(libxlDomainObjPrivatePtr priv, int i; int ret = -1; -for (i = 0 ; i vm-def-ndisks ; i++) { +for (i = 0; i vm-def-ndisks; i++) { if (vm-def-disks[i]-bus == disk-bus STREQ(vm-def-disks[i]-dst, disk-dst)) { origdisk = vm-def-disks[i]; -- 1.8.1.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 01/31] src/network: Remove the whitespace before '; '
--- src/network/bridge_driver.c | 22 +++--- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c index 6c6ce6d..c3a2e1b 100644 --- a/src/network/bridge_driver.c +++ b/src/network/bridge_driver.c @@ -264,7 +264,7 @@ networkFindActiveConfigs(struct network_driver *driver) { unsigned int i; -for (i = 0 ; i driver-networks.count ; i++) { +for (i = 0; i driver-networks.count; i++) { virNetworkObjPtr obj = driver-networks.objs[i]; virNetworkObjLock(obj); @@ -317,7 +317,7 @@ static void networkAutostartConfigs(struct network_driver *driver) { unsigned int i; -for (i = 0 ; i driver-networks.count ; i++) { +for (i = 0; i driver-networks.count; i++) { virNetworkObjLock(driver-networks.objs[i]); if (driver-networks.objs[i]-autostart !virNetworkObjIsActive(driver-networks.objs[i])) { @@ -888,7 +888,7 @@ networkDnsmasqConfContents(virNetworkObjPtr network, ipdef = ipv4def ? ipv4def : ipv6def; while (ipdef) { -for (r = 0 ; r ipdef-nranges ; r++) { +for (r = 0; r ipdef-nranges; r++) { char *saddr = virSocketAddrFormat(ipdef-ranges[r].start); if (!saddr) goto cleanup; @@ -1521,7 +1521,7 @@ networkRefreshDaemons(struct network_driver *driver) VIR_INFO(Refreshing network daemons); -for (i = 0 ; i driver-networks.count ; i++) { +for (i = 0; i driver-networks.count; i++) { virNetworkObjPtr network = driver-networks.objs[i]; virNetworkObjLock(network); @@ -2187,7 +2187,7 @@ networkReloadIptablesRules(struct network_driver *driver) VIR_INFO(Reloading iptables rules); -for (i = 0 ; i driver-networks.count ; i++) { +for (i = 0; i driver-networks.count; i++) { virNetworkObjPtr network = driver-networks.objs[i]; virNetworkObjLock(network); @@ -2887,7 +2887,7 @@ static int networkConnectNumOfNetworks(virConnectPtr conn) { struct network_driver *driver = conn-networkPrivateData; networkDriverLock(driver); -for (i = 0 ; i driver-networks.count ; i++) { +for (i = 0; i driver-networks.count; i++) { virNetworkObjLock(driver-networks.objs[i]); if (virNetworkObjIsActive(driver-networks.objs[i])) nactive++; @@ -2903,7 +2903,7 @@ static int networkConnectListNetworks(virConnectPtr conn, char **const names, in int got = 0, i; networkDriverLock(driver); -for (i = 0 ; i driver-networks.count got nnames ; i++) { +for (i = 0; i driver-networks.count got nnames; i++) { virNetworkObjLock(driver-networks.objs[i]); if (virNetworkObjIsActive(driver-networks.objs[i])) { if (VIR_STRDUP(names[got], driver-networks.objs[i]-def-name) 0) { @@ -2920,7 +2920,7 @@ static int networkConnectListNetworks(virConnectPtr conn, char **const names, in cleanup: networkDriverUnlock(driver); -for (i = 0 ; i got ; i++) +for (i = 0; i got; i++) VIR_FREE(names[i]); return -1; } @@ -2930,7 +2930,7 @@ static int networkConnectNumOfDefinedNetworks(virConnectPtr conn) { struct network_driver *driver = conn-networkPrivateData; networkDriverLock(driver); -for (i = 0 ; i driver-networks.count ; i++) { +for (i = 0; i driver-networks.count; i++) { virNetworkObjLock(driver-networks.objs[i]); if (!virNetworkObjIsActive(driver-networks.objs[i])) ninactive++; @@ -2946,7 +2946,7 @@ static int networkConnectListDefinedNetworks(virConnectPtr conn, char **const na int got = 0, i; networkDriverLock(driver); -for (i = 0 ; i driver-networks.count got nnames ; i++) { +for (i = 0; i driver-networks.count got nnames; i++) { virNetworkObjLock(driver-networks.objs[i]); if (!virNetworkObjIsActive(driver-networks.objs[i])) { if (VIR_STRDUP(names[got], driver-networks.objs[i]-def-name) 0) { @@ -2962,7 +2962,7 @@ static int networkConnectListDefinedNetworks(virConnectPtr conn, char **const na cleanup: networkDriverUnlock(driver); -for (i = 0 ; i got ; i++) +for (i = 0; i got; i++) VIR_FREE(names[i]); return -1; } -- 1.8.1.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 00/31] Forbid whitespace before ;
Inspired by [1] from Daniel, when I tried to add the syntax-check rule, it detected the various places which use the whitespace before ;. So before adding the syntax-check rule, I cleaned up them first by a simple Bash script: \#!/bin/bash for dir in $dirs; do files=$(find $dir -type f -name *.[ch]) for file in $files; do sed -r -i -e /^ \s+;/!s/\s+;/;/g $file done git add $files git commit -m $1: Remove the whitespace before ';' done So it's rather mechanically, except I need to change a few places of the generated patch. [1] https://www.redhat.com/archives/libvir-list/2013-May/msg01397.html Osier Yang (31): src/network: Remove the whitespace before ';' src/libxl: Remove the whitespace before ';' src/conf: Remove the whitespace before ';' src/test: Remove the whitespace before ';' src/vbox: Remove the whitespace before ';' src/xenxs: Remove the whitespace before ';' src/nwfilter: Remove the whitespace before ';' src/phyp: Remove the whitespace before ';' src/node_device: Remove the whitespace before ';' src/openvz: Remove the whitespace before ';' src/uml: Remove the whitespace before ';' src/parallels: Remove the whitespace before ';' src/interface: Remove the whitespace before ';' src/qemu: Remove the whitespace before ';' src/vmware: Remove the whitespace before ';' src/xen: Remove the whitespace before ';' src/security: Remove the whitespace before ';' src/storage: Remove the whitespace before ';' tools: Remove the whitespace before ; daemon: Remove the whitespace before ; tests/: Remove the whitespace before ; src/utils: Remove the whitespace before ; src/rpc: Remove the whitespace before ; src/remote: Remove the whitespace before ; src/lxc: Remove the whitespace before ; examples: Remove the whitespace before ';' python: Remove the whitespace before ; src/locking: Remove the whitespace before ; src/*.[ch]: Remove the whitespace before ; nwfitler: Change the comment style syntax-check: Add the rule to forbid whitespace before ; build-aux/bracket-spacing.pl | 18 +++ daemon/libvirtd-config.c | 2 +- daemon/remote.c | 12 +- examples/domain-events/events-c/event-test.c | 2 +- examples/openauth/openauth.c | 4 +- python/libvirt-lxc-override.c| 4 +- python/libvirt-override.c| 16 +- src/conf/capabilities.c | 50 +++--- src/conf/cpu_conf.c | 14 +- src/conf/domain_audit.c | 10 +- src/conf/domain_conf.c | 230 +-- src/conf/domain_event.c | 32 ++-- src/conf/interface_conf.c| 8 +- src/conf/network_conf.c | 28 ++-- src/conf/node_device_conf.c | 12 +- src/conf/nwfilter_conf.c | 8 +- src/conf/storage_conf.c | 8 +- src/interface/interface_backend_udev.c | 2 +- src/libvirt-lxc.c| 2 +- src/libvirt.c| 10 +- src/libxl/libxl_conf.c | 4 +- src/libxl/libxl_driver.c | 2 +- src/locking/domain_lock.c| 4 +- src/locking/lock_daemon.c| 4 +- src/locking/lock_driver_lockd.c | 12 +- src/locking/lock_driver_sanlock.c| 6 +- src/locking/lock_manager.c | 2 +- src/lxc/lxc_cgroup.c | 4 +- src/lxc/lxc_container.c | 24 +-- src/lxc/lxc_controller.c | 28 ++-- src/lxc/lxc_driver.c | 4 +- src/lxc/lxc_hostdev.c| 4 +- src/lxc/lxc_process.c| 18 +-- src/network/bridge_driver.c | 22 +-- src/node_device/node_device_udev.c | 2 +- src/nodeinfo.c | 18 +-- src/nwfilter/nwfilter_dhcpsnoop.c| 10 +- src/nwfilter/nwfilter_driver.c | 6 +- src/openvz/openvz_driver.c | 6 +- src/parallels/parallels_network.c| 12 +- src/phyp/phyp_driver.c | 6 +- src/qemu/qemu_agent.c| 4 +- src/qemu/qemu_capabilities.c | 32 ++-- src/qemu/qemu_cgroup.c | 4 +- src/qemu/qemu_command.c | 170 ++-- src/qemu/qemu_conf.c | 4 +- src/qemu/qemu_domain.c | 12 +- src/qemu/qemu_driver.c | 30 ++-- src/qemu/qemu_hostdev.c | 8 +- src/qemu/qemu_hotplug.c | 14 +- src/qemu/qemu_migration.c| 6 +- src/qemu/qemu_monitor.c | 2 +-
[libvirt] [PATCH 10/31] src/openvz: Remove the whitespace before '; '
--- src/openvz/openvz_driver.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/openvz/openvz_driver.c b/src/openvz/openvz_driver.c index 33ba624..1d404e7 100644 --- a/src/openvz/openvz_driver.c +++ b/src/openvz/openvz_driver.c @@ -918,7 +918,7 @@ openvzDomainSetNetworkConfig(virConnectPtr conn, int first = 1; struct openvz_driver *driver = conn-privateData; -for (i = 0 ; i def-nnets ; i++) { +for (i = 0; i def-nnets; i++) { if (driver-version VZCTL_BRIDGE_MIN_VERSION def-nets[i]-type == VIR_DOMAIN_NET_TYPE_BRIDGE) { if (first) @@ -1621,7 +1621,7 @@ out: VIR_FORCE_CLOSE(outfd); virCommandFree(cmd); if (rc 0) { -for (; got = 0 ; got--) +for (; got = 0; got--) VIR_FREE(names[got]); } return rc; @@ -1990,7 +1990,7 @@ openvzDomainInterfaceStats(virDomainPtr dom, } /* Check the path is one of the domain's network interfaces. */ -for (i = 0 ; i vm-def-nnets ; i++) { +for (i = 0; i vm-def-nnets; i++) { if (vm-def-nets[i]-ifname STREQ(vm-def-nets[i]-ifname, path)) { ret = 0; -- 1.8.1.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 12/31] src/parallels: Remove the whitespace before '; '
--- src/parallels/parallels_network.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/parallels/parallels_network.c b/src/parallels/parallels_network.c index 8990609..c126e31 100644 --- a/src/parallels/parallels_network.c +++ b/src/parallels/parallels_network.c @@ -366,7 +366,7 @@ static int parallelsConnectNumOfNetworks(virConnectPtr conn) parallelsConnPtr privconn = conn-privateData; parallelsDriverLock(privconn); -for (i = 0 ; i privconn-networks.count ; i++) { +for (i = 0; i privconn-networks.count; i++) { virNetworkObjLock(privconn-networks.objs[i]); if (virNetworkObjIsActive(privconn-networks.objs[i])) nactive++; @@ -385,7 +385,7 @@ static int parallelsConnectListNetworks(virConnectPtr conn, int got = 0, i; parallelsDriverLock(privconn); -for (i = 0 ; i privconn-networks.count got nnames ; i++) { +for (i = 0; i privconn-networks.count got nnames; i++) { virNetworkObjLock(privconn-networks.objs[i]); if (virNetworkObjIsActive(privconn-networks.objs[i])) { if (VIR_STRDUP(names[got], privconn-networks.objs[i]-def-name) 0) { @@ -402,7 +402,7 @@ static int parallelsConnectListNetworks(virConnectPtr conn, cleanup: parallelsDriverUnlock(privconn); -for (i = 0 ; i got ; i++) +for (i = 0; i got; i++) VIR_FREE(names[i]); return -1; } @@ -413,7 +413,7 @@ static int parallelsConnectNumOfDefinedNetworks(virConnectPtr conn) parallelsConnPtr privconn = conn-privateData; parallelsDriverLock(privconn); -for (i = 0 ; i privconn-networks.count ; i++) { +for (i = 0; i privconn-networks.count; i++) { virNetworkObjLock(privconn-networks.objs[i]); if (!virNetworkObjIsActive(privconn-networks.objs[i])) ninactive++; @@ -432,7 +432,7 @@ static int parallelsConnectListDefinedNetworks(virConnectPtr conn, int got = 0, i; parallelsDriverLock(privconn); -for (i = 0 ; i privconn-networks.count got nnames ; i++) { +for (i = 0; i privconn-networks.count got nnames; i++) { virNetworkObjLock(privconn-networks.objs[i]); if (!virNetworkObjIsActive(privconn-networks.objs[i])) { if (VIR_STRDUP(names[got], privconn-networks.objs[i]-def-name) 0) { @@ -448,7 +448,7 @@ static int parallelsConnectListDefinedNetworks(virConnectPtr conn, cleanup: parallelsDriverUnlock(privconn); -for (i = 0 ; i got ; i++) +for (i = 0; i got; i++) VIR_FREE(names[i]); return -1; } -- 1.8.1.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 15/31] src/vmware: Remove the whitespace before '; '
--- src/vmware/vmware_conf.c | 2 +- src/vmware/vmware_driver.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/vmware/vmware_conf.c b/src/vmware/vmware_conf.c index 6c24187..9d3d37e 100644 --- a/src/vmware/vmware_conf.c +++ b/src/vmware/vmware_conf.c @@ -153,7 +153,7 @@ vmwareLoadDomains(struct vmware_driver *driver) if (virCommandRun(cmd, NULL) 0) goto cleanup; -for (str = outbuf ; (vmxPath = strtok_r(str, \n, saveptr)) != NULL; +for (str = outbuf; (vmxPath = strtok_r(str, \n, saveptr)) != NULL; str = NULL) { if (vmxPath[0] != '/') diff --git a/src/vmware/vmware_driver.c b/src/vmware/vmware_driver.c index 91a271f..8a3fc99 100644 --- a/src/vmware/vmware_driver.c +++ b/src/vmware/vmware_driver.c @@ -214,7 +214,7 @@ vmwareUpdateVMStatus(struct vmware_driver *driver, virDomainObjPtr vm) vmxAbsolutePath) 0) goto cleanup; -for (str = outbuf ; (parsedVmxPath = strtok_r(str, \n, saveptr)) != NULL; +for (str = outbuf; (parsedVmxPath = strtok_r(str, \n, saveptr)) != NULL; str = NULL) { if (parsedVmxPath[0] != '/') -- 1.8.1.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 07/31] src/nwfilter: Remove the whitespace before '; '
--- src/nwfilter/nwfilter_dhcpsnoop.c | 6 +++--- src/nwfilter/nwfilter_driver.c| 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/nwfilter/nwfilter_dhcpsnoop.c b/src/nwfilter/nwfilter_dhcpsnoop.c index 328f90e..b9921e5 100644 --- a/src/nwfilter/nwfilter_dhcpsnoop.c +++ b/src/nwfilter/nwfilter_dhcpsnoop.c @@ -29,13 +29,13 @@ /* * Note about testing: * On the host run in a shell: - * while :; do kill -SIGHUP `pidof libvirtd` ; echo HUP $RANDOM; sleep 20; done + * while :; do kill -SIGHUP `pidof libvirtd`; echo HUP $RANDOM; sleep 20; done * * Inside a couple of VMs that for example use the 'clean-traffic' filter: - * while :; do kill -SIGTERM `pidof dhclient`; dhclient eth0 ; ifconfig eth0; done + * while :; do kill -SIGTERM `pidof dhclient`; dhclient eth0; ifconfig eth0; done * * On the host check the lease file and that it's periodically shortened: - * cat /var/run/libvirt/network/nwfilter.leases ; date +%s + * cat /var/run/libvirt/network/nwfilter.leases; date +%s * * On the host also check that the ebtables rules 'look' ok: * ebtables -t nat -L diff --git a/src/nwfilter/nwfilter_driver.c b/src/nwfilter/nwfilter_driver.c index 64ea251..19febfc 100644 --- a/src/nwfilter/nwfilter_driver.c +++ b/src/nwfilter/nwfilter_driver.c @@ -452,7 +452,7 @@ nwfilterConnectListNWFilters(virConnectPtr conn, int got = 0, i; nwfilterDriverLock(driver); -for (i = 0 ; i driver-nwfilters.count got nnames ; i++) { +for (i = 0; i driver-nwfilters.count got nnames; i++) { virNWFilterObjLock(driver-nwfilters.objs[i]); if (VIR_STRDUP(names[got], driver-nwfilters.objs[i]-def-name) 0) { virNWFilterObjUnlock(driver-nwfilters.objs[i]); @@ -466,7 +466,7 @@ nwfilterConnectListNWFilters(virConnectPtr conn, cleanup: nwfilterDriverUnlock(driver); -for (i = 0 ; i got ; i++) +for (i = 0; i got; i++) VIR_FREE(names[i]); memset(names, 0, nnames * sizeof(*names)); return -1; @@ -499,7 +499,7 @@ nwfilterConnectListAllNWFilters(virConnectPtr conn, goto cleanup; } -for (i = 0 ; i driver-nwfilters.count; i++) { +for (i = 0; i driver-nwfilters.count; i++) { obj = driver-nwfilters.objs[i]; virNWFilterObjLock(obj); if (!(filter = virGetNWFilter(conn, obj-def-name, -- 1.8.1.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 13/31] src/interface: Remove the whitespace before '; '
--- src/interface/interface_backend_udev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/interface/interface_backend_udev.c b/src/interface/interface_backend_udev.c index 1fd7d46..6e27e83 100644 --- a/src/interface/interface_backend_udev.c +++ b/src/interface/interface_backend_udev.c @@ -42,7 +42,7 @@ typedef enum { VIR_UDEV_IFACE_ACTIVE, VIR_UDEV_IFACE_INACTIVE, VIR_UDEV_IFACE_ALL -} virUdevStatus ; +} virUdevStatus; static virInterfaceDef *udevGetIfaceDef(struct udev *udev, const char *name); -- 1.8.1.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 05/31] src/vbox: Remove the whitespace before '; '
--- src/vbox/vbox_tmpl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c index 5a5b429..36d1e7f 100644 --- a/src/vbox/vbox_tmpl.c +++ b/src/vbox/vbox_tmpl.c @@ -3478,7 +3478,7 @@ static int vboxConnectListDefinedDomains(virConnectPtr conn, char ** const names if (VIR_STRDUP(names[j], machineName) 0) { VBOX_UTF16_FREE(machineNameUtf16); VBOX_UTF8_FREE(machineName); -for (; j = 0 ; j--) +for (; j = 0; j--) VIR_FREE(names[j]); ret = -1; goto cleanup; -- 1.8.1.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 28/31] src/locking: Remove the whitespace before ;
--- src/locking/domain_lock.c | 4 ++-- src/locking/lock_daemon.c | 4 ++-- src/locking/lock_driver_lockd.c | 12 ++-- src/locking/lock_driver_sanlock.c | 6 +++--- src/locking/lock_manager.c| 2 +- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/locking/domain_lock.c b/src/locking/domain_lock.c index 6191e9b..d79aeac 100644 --- a/src/locking/domain_lock.c +++ b/src/locking/domain_lock.c @@ -138,12 +138,12 @@ static virLockManagerPtr virDomainLockManagerNew(virLockManagerPluginPtr plugin, if (withResources) { VIR_DEBUG(Adding leases); -for (i = 0 ; i dom-def-nleases ; i++) +for (i = 0; i dom-def-nleases; i++) if (virDomainLockManagerAddLease(lock, dom-def-leases[i]) 0) goto error; VIR_DEBUG(Adding disks); -for (i = 0 ; i dom-def-ndisks ; i++) +for (i = 0; i dom-def-ndisks; i++) if (virDomainLockManagerAddDisk(lock, dom-def-disks[i]) 0) goto error; } diff --git a/src/locking/lock_daemon.c b/src/locking/lock_daemon.c index e1653b1..23a119f 100644 --- a/src/locking/lock_daemon.c +++ b/src/locking/lock_daemon.c @@ -215,7 +215,7 @@ virLockDaemonNewPostExecRestart(virJSONValuePtr object, bool privileged) goto error; } -for (i = 0 ; i n ; i++) { +for (i = 0; i n; i++) { virLockSpacePtr lockspace; child = virJSONValueArrayGet(lockspaces, i); @@ -749,7 +749,7 @@ virLockDaemonClientFree(void *opaque) * closed the connection, we must kill it off * to make sure it doesn't do nasty stuff */ if (data.gotError || data.hadSomeLeases) { -for (i = 0 ; i 15 ; i++) { +for (i = 0; i 15; i++) { int signum; if (i == 0) signum = SIGTERM; diff --git a/src/locking/lock_driver_lockd.c b/src/locking/lock_driver_lockd.c index afe9e94..cc3b6b1 100644 --- a/src/locking/lock_driver_lockd.c +++ b/src/locking/lock_driver_lockd.c @@ -428,7 +428,7 @@ static void virLockManagerLockDaemonFree(virLockManagerPtr lock) lock-privateData = NULL; -for (i = 0 ; i priv-nresources ; i++) { +for (i = 0; i priv-nresources; i++) { VIR_FREE(priv-resources[i].lockspace); VIR_FREE(priv-resources[i].name); } @@ -459,7 +459,7 @@ static int virLockManagerLockDaemonNew(virLockManagerPtr lock, switch (type) { case VIR_LOCK_MANAGER_OBJECT_TYPE_DOMAIN: -for (i = 0 ; i nparams ; i++) { +for (i = 0; i nparams; i++) { if (STREQ(params[i].key, uuid)) { memcpy(priv-uuid, params[i].value.uuid, VIR_UUID_BUFLEN); } else if (STREQ(params[i].key, name)) { @@ -530,7 +530,7 @@ static char *virLockManagerLockDaemonDiskLeaseName(const char *path) return NULL; } -for (i = 0 ; i SHA256_DIGEST_SIZE ; i++) { +for (i = 0; i SHA256_DIGEST_SIZE; i++) { ret[i*2] = hex[(buf[i] 4) 0xf]; ret[(i*2)+1] = hex[buf[i] 0xf]; } @@ -629,7 +629,7 @@ static int virLockManagerLockDaemonAddResource(virLockManagerPtr lock, size_t i; char *path = NULL; char *lockspace = NULL; -for (i = 0 ; i nparams ; i++) { +for (i = 0; i nparams; i++) { if (STREQ(params[i].key, offset)) { if (params[i].value.ul != 0) { virReportError(VIR_ERR_INTERNAL_ERROR, %s, @@ -725,7 +725,7 @@ static int virLockManagerLockDaemonAcquire(virLockManagerPtr lock, if (!(flags VIR_LOCK_MANAGER_ACQUIRE_REGISTER_ONLY)) { size_t i; -for (i = 0 ; i priv-nresources ; i++) { +for (i = 0; i priv-nresources; i++) { virLockSpaceProtocolAcquireResourceArgs args; memset(args, 0, sizeof(args)); @@ -781,7 +781,7 @@ static int virLockManagerLockDaemonRelease(virLockManagerPtr lock, if (!(client = virLockManagerLockDaemonConnect(lock, program, counter))) goto cleanup; -for (i = 0 ; i priv-nresources ; i++) { +for (i = 0; i priv-nresources; i++) { virLockSpaceProtocolReleaseResourceArgs args; memset(args, 0, sizeof(args)); diff --git a/src/locking/lock_driver_sanlock.c b/src/locking/lock_driver_sanlock.c index eb15e29..de14725 100644 --- a/src/locking/lock_driver_sanlock.c +++ b/src/locking/lock_driver_sanlock.c @@ -540,7 +540,7 @@ static int virLockManagerSanlockDiskLeaseName(const char *path, return -1; } -for (i = 0 ; i MD5_DIGEST_SIZE ; i++) { +for (i = 0; i MD5_DIGEST_SIZE; i++) { str[i*2] = hex[(buf[i] 4) 0xf]; str[(i*2)+1] = hex[buf[i] 0xf]; } @@ -1020,7 +1020,7 @@ static int virLockManagerSanlockAcquire(virLockManagerPtr lock, VIR_DEBUG(Acquire completed fd=%d, sock); if (res_free) { -for (i = 0 ; i res_count ; i++) { +for (i = 0; i res_count; i++)
[libvirt] [PATCH 20/31] daemon: Remove the whitespace before ;
--- daemon/libvirtd-config.c | 2 +- daemon/remote.c | 12 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/daemon/libvirtd-config.c b/daemon/libvirtd-config.c index 1c57475..66dfb4a 100644 --- a/daemon/libvirtd-config.c +++ b/daemon/libvirtd-config.c @@ -88,7 +88,7 @@ remoteConfigGetStringList(virConfPtr conf, const char *key, char ***list_arg, } if (VIR_STRDUP(list[i], pp-str) 0) { int j; -for (j = 0 ; j i ; j++) +for (j = 0; j i; j++) VIR_FREE(list[j]); VIR_FREE(list); return -1; diff --git a/daemon/remote.c b/daemon/remote.c index af89e60..0e253bf 100644 --- a/daemon/remote.c +++ b/daemon/remote.c @@ -315,7 +315,7 @@ static int remoteRelayDomainEventGraphics(virConnectPtr conn ATTRIBUTE_UNUSED, authScheme); VIR_DEBUG(Subject %d, subject-nidentity); -for (i = 0 ; i subject-nidentity ; i++) { +for (i = 0; i subject-nidentity; i++) { VIR_DEBUG( %s=%s, subject-identities[i].type, subject-identities[i].name); } @@ -337,7 +337,7 @@ static int remoteRelayDomainEventGraphics(virConnectPtr conn ATTRIBUTE_UNUSED, goto error; } -for (i = 0 ; i data.subject.subject_len ; i++) { +for (i = 0; i data.subject.subject_len; i++) { if (VIR_STRDUP(data.subject.subject_val[i].type, subject-identities[i].type) 0 || VIR_STRDUP(data.subject.subject_val[i].name, subject-identities[i].name) 0) goto error; @@ -357,7 +357,7 @@ error: VIR_FREE(data.remote.node); VIR_FREE(data.remote.service); if (data.subject.subject_val != NULL) { -for (i = 0 ; i data.subject.subject_len ; i++) { +for (i = 0; i data.subject.subject_len; i++) { VIR_FREE(data.subject.subject_val[i].type); VIR_FREE(data.subject.subject_val[i].name); } @@ -640,7 +640,7 @@ void remoteClientFreeFunc(void *data) if (priv-conn) { int i; -for (i = 0 ; i VIR_DOMAIN_EVENT_ID_LAST ; i++) { +for (i = 0; i VIR_DOMAIN_EVENT_ID_LAST; i++) { if (priv-domainEventCallbackID[i] != -1) { VIR_DEBUG(Deregistering to relay remote events %d, i); virConnectDomainEventDeregisterAny(priv-conn, @@ -681,7 +681,7 @@ void *remoteClientInitHook(virNetServerClientPtr client, return NULL; } -for (i = 0 ; i VIR_DOMAIN_EVENT_ID_LAST ; i++) +for (i = 0; i VIR_DOMAIN_EVENT_ID_LAST; i++) priv-domainEventCallbackID[i] = -1; virNetServerClientSetCloseHook(client, remoteClientCloseFunc); @@ -4616,7 +4616,7 @@ lxcDispatchDomainOpenNamespace(virNetServerPtr server ATTRIBUTE_UNUSED, * but in case they're playing games with us, prevent * a resource leak */ -for (i = 0 ; i msg-nfds ; i++) +for (i = 0; i msg-nfds; i++) VIR_FORCE_CLOSE(msg-fds[i]); VIR_FREE(msg-fds); msg-nfds = 0; -- 1.8.1.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 26/31] examples: Remove the whitespace before '; '
--- examples/domain-events/events-c/event-test.c | 2 +- examples/openauth/openauth.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/domain-events/events-c/event-test.c b/examples/domain-events/events-c/event-test.c index 301caad..eeff50f 100644 --- a/examples/domain-events/events-c/event-test.c +++ b/examples/domain-events/events-c/event-test.c @@ -332,7 +332,7 @@ static int myDomainEventGraphicsCallback(virConnectPtr conn ATTRIBUTE_UNUSED, remote-family, remote-node, remote-service); printf(auth: %s , authScheme); -for (i = 0 ; i subject-nidentity ; i++) { +for (i = 0; i subject-nidentity; i++) { printf( identity: %s=%s, subject-identities[i].type, subject-identities[i].name); diff --git a/examples/openauth/openauth.c b/examples/openauth/openauth.c index 4f01cdb..628451c 100644 --- a/examples/openauth/openauth.c +++ b/examples/openauth/openauth.c @@ -135,7 +135,7 @@ showDomains(virConnectPtr conn) printf(Inactive domains:\n); } -for (i = 0 ; i numNames ; i++) { +for (i = 0; i numNames; i++) { printf( %s\n, *(nameList + i)); /* The API documentation doesn't say so, but the names * returned by virConnectListDefinedDomains are strdup'd and @@ -175,7 +175,7 @@ authCallback(virConnectCredentialPtr cred, unsigned int ncred, void *cbdata) * For example the ESX driver passes the hostname of the ESX or vCenter * server as challenge. This allows a auth callback to return the * proper credentials. */ -for (i = 0; i ncred ; ++i) { +for (i = 0; i ncred; ++i) { switch (cred[i].type) { case VIR_CRED_AUTHNAME: cred[i].result = strdup(authData-username); -- 1.8.1.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 17/31] src/security: Remove the whitespace before '; '
--- src/security/security_dac.c | 8 src/security/security_driver.c | 2 +- src/security/security_selinux.c | 8 src/security/virt-aa-helper.c | 4 ++-- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/security/security_dac.c b/src/security/security_dac.c index 6e6fcad..d922ad2 100644 --- a/src/security/security_dac.c +++ b/src/security/security_dac.c @@ -847,14 +847,14 @@ virSecurityDACRestoreSecurityAllLabel(virSecurityManagerPtr mgr, VIR_DEBUG(Restoring security label on %s migrated=%d, def-name, migrated); -for (i = 0 ; i def-nhostdevs ; i++) { +for (i = 0; i def-nhostdevs; i++) { if (virSecurityDACRestoreSecurityHostdevLabel(mgr, def, def-hostdevs[i], NULL) 0) rc = -1; } -for (i = 0 ; i def-ndisks ; i++) { +for (i = 0; i def-ndisks; i++) { if (virSecurityDACRestoreSecurityImageLabelInt(mgr, def, def-disks[i], @@ -914,7 +914,7 @@ virSecurityDACSetSecurityAllLabel(virSecurityManagerPtr mgr, if (!priv-dynamicOwnership) return 0; -for (i = 0 ; i def-ndisks ; i++) { +for (i = 0; i def-ndisks; i++) { /* XXX fixme - we need to recursively label the entire tree :-( */ if (def-disks[i]-type == VIR_DOMAIN_DISK_TYPE_DIR) continue; @@ -923,7 +923,7 @@ virSecurityDACSetSecurityAllLabel(virSecurityManagerPtr mgr, def-disks[i]) 0) return -1; } -for (i = 0 ; i def-nhostdevs ; i++) { +for (i = 0; i def-nhostdevs; i++) { if (virSecurityDACSetSecurityHostdevLabel(mgr, def, def-hostdevs[i], diff --git a/src/security/security_driver.c b/src/security/security_driver.c index 319b86f..7920b93 100644 --- a/src/security/security_driver.c +++ b/src/security/security_driver.c @@ -57,7 +57,7 @@ virSecurityDriverPtr virSecurityDriverLookup(const char *name, VIR_DEBUG(name=%s, NULLSTR(name)); -for (i = 0; i ARRAY_CARDINALITY(security_drivers) !drv ; i++) { +for (i = 0; i ARRAY_CARDINALITY(security_drivers) !drv; i++) { virSecurityDriverPtr tmp = security_drivers[i]; if (name diff --git a/src/security/security_selinux.c b/src/security/security_selinux.c index 5d108b9..1781c86 100644 --- a/src/security/security_selinux.c +++ b/src/security/security_selinux.c @@ -1887,14 +1887,14 @@ virSecuritySELinuxRestoreSecurityAllLabel(virSecurityManagerPtr mgr, rc = -1; } -for (i = 0 ; i def-nhostdevs ; i++) { +for (i = 0; i def-nhostdevs; i++) { if (virSecuritySELinuxRestoreSecurityHostdevLabel(mgr, def, def-hostdevs[i], NULL) 0) rc = -1; } -for (i = 0 ; i def-ndisks ; i++) { +for (i = 0; i def-ndisks; i++) { if (virSecuritySELinuxRestoreSecurityImageLabelInt(mgr, def, def-disks[i], @@ -2281,7 +2281,7 @@ virSecuritySELinuxSetSecurityAllLabel(virSecurityManagerPtr mgr, if (secdef-norelabel || data-skipAllLabel) return 0; -for (i = 0 ; i def-ndisks ; i++) { +for (i = 0; i def-ndisks; i++) { /* XXX fixme - we need to recursively label the entire tree :-( */ if (def-disks[i]-type == VIR_DOMAIN_DISK_TYPE_DIR) { VIR_WARN(Unable to relabel directory tree %s for disk %s, @@ -2294,7 +2294,7 @@ virSecuritySELinuxSetSecurityAllLabel(virSecurityManagerPtr mgr, } /* XXX fixme process def-fss if relabel == true */ -for (i = 0 ; i def-nhostdevs ; i++) { +for (i = 0; i def-nhostdevs; i++) { if (virSecuritySELinuxSetSecurityHostdevLabel(mgr, def, def-hostdevs[i], diff --git a/src/security/virt-aa-helper.c b/src/security/virt-aa-helper.c index 5d48850..6f63c37 100644 --- a/src/security/virt-aa-helper.c +++ b/src/security/virt-aa-helper.c @@ -952,7 +952,7 @@ get_files(vahControl * ctl) ctl-def-consoles[i]-source.data.file.path, rw) != 0) goto cleanup; -for (i = 0 ; i ctl-def-nparallels; i++) +for (i = 0; i ctl-def-nparallels; i++) if (ctl-def-parallels[i] (ctl-def-parallels[i]-source.type == VIR_DOMAIN_CHR_TYPE_PTY ||
[libvirt] [PATCH 18/31] src/storage: Remove the whitespace before '; '
--- src/storage/storage_backend.c | 14 +++--- src/storage/storage_backend_disk.c| 2 +- src/storage/storage_backend_iscsi.c | 10 +- src/storage/storage_backend_logical.c | 6 +++--- src/storage/storage_driver.c | 26 +- 5 files changed, 29 insertions(+), 29 deletions(-) diff --git a/src/storage/storage_backend.c b/src/storage/storage_backend.c index 01a404e..66b3ff7 100644 --- a/src/storage/storage_backend.c +++ b/src/storage/storage_backend.c @@ -1485,14 +1485,14 @@ virStorageBackendRunProgRegex(virStoragePoolObjPtr pool, return -1; } -for (i = 0 ; i nregex ; i++) { +for (i = 0; i nregex; i++) { err = regcomp(reg[i], regex[i], REG_EXTENDED); if (err != 0) { char error[100]; regerror(err, reg[i], error, sizeof(error)); virReportError(VIR_ERR_INTERNAL_ERROR, _(Failed to compile regex %s), error); -for (j = 0 ; j = i ; j++) +for (j = 0; j = i; j++) regfree(reg[j]); VIR_FREE(reg); return -1; @@ -1538,7 +1538,7 @@ virStorageBackendRunProgRegex(virStoragePoolObjPtr pool, if (!p) p = line; -for (i = 0 ; i = maxReg i nregex ; i++) { +for (i = 0; i = maxReg i nregex; i++) { if (regexec(reg[i], p, nvars[i]+1, vars, 0) == 0) { maxReg++; @@ -1546,7 +1546,7 @@ virStorageBackendRunProgRegex(virStoragePoolObjPtr pool, ngroup = 0; /* NULL terminate each captured group in the line */ -for (j = 0 ; j nvars[i] ; j++) { +for (j = 0; j nvars[i]; j++) { /* NB vars[0] is the full pattern, so we offset j by 1 */ p[vars[j+1].rm_eo] = '\0'; if (VIR_STRDUP(groups[ngroup++], p + vars[j+1].rm_so) 0) @@ -1559,7 +1559,7 @@ virStorageBackendRunProgRegex(virStoragePoolObjPtr pool, goto cleanup; /* Release matches restart to matching the first regex */ -for (j = 0 ; j totgroups ; j++) +for (j = 0; j totgroups; j++) VIR_FREE(groups[j]); maxReg = 0; ngroup = 0; @@ -1571,13 +1571,13 @@ virStorageBackendRunProgRegex(virStoragePoolObjPtr pool, ret = virCommandWait(cmd, NULL); cleanup: if (groups) { -for (j = 0 ; j totgroups ; j++) +for (j = 0; j totgroups; j++) VIR_FREE(groups[j]); VIR_FREE(groups); } VIR_FREE(vars); -for (i = 0 ; i nregex ; i++) +for (i = 0; i nregex; i++) regfree(reg[i]); VIR_FREE(reg); diff --git a/src/storage/storage_backend_disk.c b/src/storage/storage_backend_disk.c index 09c2d2c..d0b91f9 100644 --- a/src/storage/storage_backend_disk.c +++ b/src/storage/storage_backend_disk.c @@ -553,7 +553,7 @@ virStorageBackendDiskPartBoundries(virStoragePoolObjPtr pool, aligned to the cylinder boundary */ extraBytes = cylinderSize - (allocation % cylinderSize); -for (i = 0 ; i dev-nfreeExtent ; i++) { +for (i = 0; i dev-nfreeExtent; i++) { unsigned long long size = dev-freeExtents[i].end - dev-freeExtents[i].start; diff --git a/src/storage/storage_backend_iscsi.c b/src/storage/storage_backend_iscsi.c index a74f343..ad38ab2 100644 --- a/src/storage/storage_backend_iscsi.c +++ b/src/storage/storage_backend_iscsi.c @@ -562,7 +562,7 @@ virStorageBackendISCSIScanTargets(const char *portal, list, NULL) 0) goto cleanup; -for (i = 0 ; i list.ntargets ; i++) { +for (i = 0; i list.ntargets; i++) { /* We have to ignore failure, because we can't undo * the results of 'sendtargets', unless we go scrubbing * around in the dirt in /var/lib/iscsi. @@ -578,7 +578,7 @@ virStorageBackendISCSIScanTargets(const char *portal, *ntargetsret = list.ntargets; *targetsret = list.targets; } else { -for (i = 0 ; i list.ntargets ; i++) { +for (i = 0; i list.ntargets; i++) { VIR_FREE(list.targets[i]); } VIR_FREE(list.targets); @@ -640,7 +640,7 @@ virStorageBackendISCSIFindPoolSources(virConnectPtr conn ATTRIBUTE_UNUSED, goto cleanup; } -for (i = 0 ; i ntargets ; i++) { +for (i = 0; i ntargets; i++) { if (VIR_ALLOC_N(list.sources[i].devices, 1) 0 || VIR_ALLOC_N(list.sources[i].hosts, 1) 0) { virReportOOMError(); @@ -661,13 +661,13 @@ virStorageBackendISCSIFindPoolSources(virConnectPtr conn ATTRIBUTE_UNUSED, cleanup: if (list.sources) { -for (i = 0 ; i ntargets ; i++) { +for (i = 0; i ntargets; i++) { VIR_FREE(list.sources[i].hosts);
[libvirt] [PATCH 23/31] src/rpc: Remove the whitespace before ;
--- src/rpc/virnetclient.c| 12 ++-- src/rpc/virnetclientprogram.c | 12 ++-- src/rpc/virnetmessage.c | 6 +++--- src/rpc/virnetserver.c| 26 +- src/rpc/virnetserverclient.c | 4 ++-- src/rpc/virnetserverprogram.c | 2 +- src/rpc/virnetserverservice.c | 14 +++--- src/rpc/virnetsocket.c| 2 +- 8 files changed, 39 insertions(+), 39 deletions(-) diff --git a/src/rpc/virnetclient.c b/src/rpc/virnetclient.c index 1d228f0..d87c7e3 100644 --- a/src/rpc/virnetclient.c +++ b/src/rpc/virnetclient.c @@ -602,7 +602,7 @@ void virNetClientDispose(void *obj) if (client-closeFf) client-closeFf(client-closeOpaque); -for (i = 0 ; i client-nprograms ; i++) +for (i = 0; i client-nprograms; i++) virObjectUnref(client-programs[i]); VIR_FREE(client-programs); @@ -916,7 +916,7 @@ void virNetClientRemoveStream(virNetClientPtr client, { virObjectLock(client); size_t i; -for (i = 0 ; i client-nstreams ; i++) { +for (i = 0; i client-nstreams; i++) { if (client-streams[i] == st) break; } @@ -1008,7 +1008,7 @@ static int virNetClientCallDispatchMessage(virNetClientPtr client) size_t i; virNetClientProgramPtr prog = NULL; -for (i = 0 ; i client-nprograms ; i++) { +for (i = 0; i client-nprograms; i++) { if (virNetClientProgramMatches(client-programs[i], client-msg)) { prog = client-programs[i]; @@ -1033,7 +1033,7 @@ static int virNetClientCallDispatchStream(virNetClientPtr client) virNetClientCallPtr thecall; /* First identify what stream this packet is directed at */ -for (i = 0 ; i client-nstreams ; i++) { +for (i = 0; i client-nstreams; i++) { if (virNetClientStreamMatches(client-streams[i], client-msg)) { st = client-streams[i]; @@ -1175,7 +1175,7 @@ virNetClientIOWriteMessage(virNetClientPtr client, if (thecall-msg-bufferOffset == thecall-msg-bufferLength) { size_t i; -for (i = thecall-msg-donefds ; i thecall-msg-nfds ; i++) { +for (i = thecall-msg-donefds; i thecall-msg-nfds; i++) { int rv; if ((rv = virNetSocketSendFD(client-sock, thecall-msg-fds[i])) 0) return -1; @@ -1297,7 +1297,7 @@ virNetClientIOHandleInput(virNetClientPtr client) virNetMessageDecodeNumFDs(client-msg) 0) return -1; -for (i = client-msg.donefds ; i client-msg.nfds ; i++) { +for (i = client-msg.donefds; i client-msg.nfds; i++) { int rv; if ((rv = virNetSocketRecvFD(client-sock, (client-msg.fds[i]))) 0) return -1; diff --git a/src/rpc/virnetclientprogram.c b/src/rpc/virnetclientprogram.c index 2e6e4f6..1016f55 100644 --- a/src/rpc/virnetclientprogram.c +++ b/src/rpc/virnetclientprogram.c @@ -197,7 +197,7 @@ static virNetClientProgramEventPtr virNetClientProgramGetEvent(virNetClientProgr { int i; -for (i = 0 ; i prog-nevents ; i++) { +for (i = 0; i prog-nevents; i++) { if (prog-events[i].proc == procedure) return prog-events[i]; } @@ -301,9 +301,9 @@ int virNetClientProgramCall(virNetClientProgramPtr prog, virReportOOMError(); goto error; } -for (i = 0 ; i msg-nfds ; i++) +for (i = 0; i msg-nfds; i++) msg-fds[i] = -1; -for (i = 0 ; i msg-nfds ; i++) { +for (i = 0; i msg-nfds; i++) { if ((msg-fds[i] = dup(outfds[i])) 0) { virReportSystemError(errno, _(Cannot duplicate FD %d), @@ -362,9 +362,9 @@ int virNetClientProgramCall(virNetClientProgramPtr prog, virReportOOMError(); goto error; } -for (i = 0 ; i *ninfds ; i++) +for (i = 0; i *ninfds; i++) (*infds)[i] = -1; -for (i = 0 ; i *ninfds ; i++) { +for (i = 0; i *ninfds; i++) { if (((*infds)[i] = dup(msg-fds[i])) 0) { virReportSystemError(errno, _(Cannot duplicate FD %d), @@ -401,7 +401,7 @@ int virNetClientProgramCall(virNetClientProgramPtr prog, error: virNetMessageFree(msg); if (infds ninfds) { -for (i = 0 ; i *ninfds ; i++) +for (i = 0; i *ninfds; i++) VIR_FORCE_CLOSE((*infds)[i]); } return -1; diff --git a/src/rpc/virnetmessage.c b/src/rpc/virnetmessage.c index b2c6e5b..85c831d 100644 --- a/src/rpc/virnetmessage.c +++ b/src/rpc/virnetmessage.c @@ -55,7 +55,7 @@ void virNetMessageClear(virNetMessagePtr msg) VIR_DEBUG(msg=%p nfds=%zu, msg, msg-nfds); -for (i = 0 ; i msg-nfds ; i++) +for (i = 0; i msg-nfds;
[libvirt] [PATCH 25/31] src/lxc: Remove the whitespace before ;
--- src/lxc/lxc_cgroup.c | 4 ++-- src/lxc/lxc_container.c | 24 src/lxc/lxc_controller.c | 28 ++-- src/lxc/lxc_driver.c | 4 ++-- src/lxc/lxc_hostdev.c| 4 ++-- src/lxc/lxc_process.c| 18 +- 6 files changed, 41 insertions(+), 41 deletions(-) diff --git a/src/lxc/lxc_cgroup.c b/src/lxc/lxc_cgroup.c index de6b53b..5c8acb3 100644 --- a/src/lxc/lxc_cgroup.c +++ b/src/lxc/lxc_cgroup.c @@ -427,7 +427,7 @@ static int virLXCCgroupSetupDeviceACL(virDomainDefPtr def, } } -for (i = 0 ; i def-ndisks ; i++) { +for (i = 0; i def-ndisks; i++) { if (def-disks[i]-type != VIR_DOMAIN_DISK_TYPE_BLOCK) continue; @@ -445,7 +445,7 @@ static int virLXCCgroupSetupDeviceACL(virDomainDefPtr def, } } -for (i = 0 ; i def-nfss ; i++) { +for (i = 0; i def-nfss; i++) { if (def-fss[i]-type != VIR_DOMAIN_FS_TYPE_BLOCK) continue; diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c index b4be4cd..c74e3ca 100644 --- a/src/lxc/lxc_container.c +++ b/src/lxc/lxc_container.c @@ -353,7 +353,7 @@ static int lxcContainerRenameAndEnableInterfaces(bool privNet, size_t i; char *newname = NULL; -for (i = 0 ; i nveths ; i++) { +for (i = 0; i nveths; i++) { if (virAsprintf(newname, eth%zu, i) 0) { virReportOOMError(); rc = -1; @@ -475,7 +475,7 @@ static int lxcContainerUnmountSubtree(const char *prefix, if (lxcContainerGetSubtree(prefix, mounts, nmounts) 0) goto cleanup; -for (i = 0 ; i nmounts ; i++) { +for (i = 0; i nmounts; i++) { VIR_DEBUG(Umount %s, mounts[i]); if (umount(mounts[i]) 0) { char ebuf[1024]; @@ -509,7 +509,7 @@ static int lxcContainerUnmountSubtree(const char *prefix, ret = 0; cleanup: -for (i = 0 ; i nmounts ; i++) +for (i = 0; i nmounts; i++) VIR_FREE(mounts[i]); VIR_FREE(mounts); @@ -689,7 +689,7 @@ static int lxcContainerMountBasicFS(char *sec_mount_options) VIR_DEBUG(Mounting basic filesystems sec_mount_options=%s, sec_mount_options); -for (i = 0 ; i ARRAY_CARDINALITY(mnts) ; i++) { +for (i = 0; i ARRAY_CARDINALITY(mnts); i++) { const char *srcpath = NULL; VIR_DEBUG(Processing %s - %s, @@ -849,7 +849,7 @@ static int lxcContainerPopulateDevices(char **ttyPaths, size_t nttyPaths) }; /* Populate /dev/ with a few important bits */ -for (i = 0 ; i ARRAY_CARDINALITY(devs) ; i++) { +for (i = 0; i ARRAY_CARDINALITY(devs); i++) { dev_t dev = makedev(devs[i].maj, devs[i].min); if (mknod(devs[i].path, S_IFCHR, dev) 0 || chmod(devs[i].path, devs[i].mode)) { @@ -860,7 +860,7 @@ static int lxcContainerPopulateDevices(char **ttyPaths, size_t nttyPaths) } } -for (i = 0 ; i ARRAY_CARDINALITY(links) ; i++) { +for (i = 0; i ARRAY_CARDINALITY(links); i++) { if (symlink(links[i].src, links[i].dst) 0) { virReportSystemError(errno, _(Failed to symlink device %s to %s), @@ -890,7 +890,7 @@ static int lxcContainerPopulateDevices(char **ttyPaths, size_t nttyPaths) } } -for (i = 0 ; i nttyPaths ; i++) { +for (i = 0; i nttyPaths; i++) { char *tty; if (virAsprintf(tty, /dev/tty%zu, i+1) 0) { virReportOOMError(); @@ -1356,7 +1356,7 @@ static int lxcContainerMountAllFS(virDomainDefPtr vmDef, VIR_DEBUG(Mounting all non-root filesystems); /* Pull in rest of container's mounts */ -for (i = 0 ; i vmDef-nfss ; i++) { +for (i = 0; i vmDef-nfss; i++) { if (STREQ(vmDef-fss[i]-dst, /)) continue; @@ -1460,7 +1460,7 @@ static int lxcContainerSetupAllDisks(virDomainDefPtr vmDef, size_t i; VIR_DEBUG(Setting up disks); -for (i = 0 ; i vmDef-ndisks ; i++) { +for (i = 0; i vmDef-ndisks; i++) { if (lxcContainerSetupDisk(vmDef, vmDef-disks[i], securityDriver) 0) return -1; @@ -1702,7 +1702,7 @@ static int lxcContainerSetupAllHostdevs(virDomainDefPtr vmDef, size_t i; VIR_DEBUG(Setting up hostdevs); -for (i = 0 ; i vmDef-nhostdevs ; i++) { +for (i = 0; i vmDef-nhostdevs; i++) { virDomainHostdevDefPtr def = vmDef-hostdevs[i]; switch (def-mode) { case VIR_DOMAIN_HOSTDEV_MODE_SUBSYS: @@ -1840,7 +1840,7 @@ static int lxcContainerResolveSymlinks(virDomainDefPtr vmDef) char *newroot; size_t i; -for (i = 0 ; i vmDef-nfss ; i++) { +for (i = 0; i vmDef-nfss; i++) { virDomainFSDefPtr fs = vmDef-fss[i]; if (!fs-src) continue; @@ -2070,7 +2070,7 @@ lxcNeedNetworkNamespace(virDomainDefPtr def) return true; if (def-features (1 VIR_DOMAIN_FEATURE_PRIVNET)) return
[libvirt] [PATCH 04/31] src/test: Remove the whitespace before '; '
--- src/test/test_driver.c | 80 +- 1 file changed, 40 insertions(+), 40 deletions(-) diff --git a/src/test/test_driver.c b/src/test/test_driver.c index d0d7832..f1cdd92 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -192,7 +192,7 @@ testBuildCapabilities(virConnectPtr conn) { goto no_memory; } -for (i = 0; i ARRAY_CARDINALITY(guest_types) ; i++) { +for (i = 0; i ARRAY_CARDINALITY(guest_types); i++) { if ((guest = virCapabilitiesAddGuest(caps, guest_types[i], VIR_ARCH_I686, @@ -343,7 +343,7 @@ testDomainGenerateIfname(virDomainDefPtr domdef) { } /* Generate network interface names */ -for (i = 0 ; i domdef-nnets ; i++) { +for (i = 0; i domdef-nnets; i++) { if (domdef-nets[i]-ifname STREQ(domdef-nets[i]-ifname, ifname)) { found = 1; @@ -559,7 +559,7 @@ static int testOpenDefault(virConnectPtr conn) { privconn-cells[u].numCpus = 8; privconn-cells[u].mem = (u + 1) * 2048 * 1024; } -for (u = 0 ; u 16 ; u++) { +for (u = 0; u 16; u++) { virBitmapPtr siblings = virBitmapNew(16); if (!siblings) { virReportOOMError(); @@ -721,7 +721,7 @@ static int testOpenVolumesForPool(xmlDocPtr xml, goto error; } -for (i = 0 ; i ret ; i++) { +for (i = 0; i ret; i++) { char *relFile = virXMLPropString(vols[i], file); if (relFile != NULL) { char *absFile = testBuildFilename(file, relFile); @@ -911,7 +911,7 @@ static int testOpenFromFile(virConnectPtr conn, goto error; } -for (i = 0 ; i ret ; i++) { +for (i = 0; i ret; i++) { virDomainDefPtr def; char *relFile = virXMLPropString(domains[i], file); if (relFile != NULL) { @@ -960,7 +960,7 @@ static int testOpenFromFile(virConnectPtr conn, if (ret 0) { goto error; } -for (i = 0 ; i ret ; i++) { +for (i = 0; i ret; i++) { virNetworkDefPtr def; char *relFile = virXMLPropString(networks[i], file); if (relFile != NULL) { @@ -995,7 +995,7 @@ static int testOpenFromFile(virConnectPtr conn, if (ret 0) { goto error; } -for (i = 0 ; i ret ; i++) { +for (i = 0; i ret; i++) { virInterfaceDefPtr def; char *relFile = virXMLPropString(ifaces[i], file); if (relFile != NULL) { @@ -1031,7 +1031,7 @@ static int testOpenFromFile(virConnectPtr conn, if (ret 0) { goto error; } -for (i = 0 ; i ret ; i++) { +for (i = 0; i ret; i++) { virStoragePoolDefPtr def; virStoragePoolObjPtr pool; char *relFile = virXMLPropString(pools[i], file); @@ -1081,7 +1081,7 @@ static int testOpenFromFile(virConnectPtr conn, if (ret 0) { goto error; } -for (i = 0 ; i ret ; i++) { +for (i = 0; i ret; i++) { virNodeDeviceDefPtr def; virNodeDeviceObjPtr dev; char *relFile = virXMLPropString(devs[i], file); @@ -1408,7 +1408,7 @@ static virDomainPtr testDomainLookupByUUID(virConnectPtr conn, { testConnPtr privconn = conn-privateData; virDomainPtr ret = NULL; -virDomainObjPtr dom ; +virDomainObjPtr dom; testDriverLock(privconn); dom = virDomainObjListFindByUUID(privconn-domains, uuid); @@ -2347,7 +2347,7 @@ static int testDomainGetVcpus(virDomainPtr domain, if (info != NULL) { memset(info, 0, sizeof(*info) * maxinfo); -for (i = 0 ; i maxinfo ; i++) { +for (i = 0; i maxinfo; i++) { virVcpuInfo privinfo = privdomdata-vcpu_infos[i]; info[i].number = privinfo.number; @@ -2364,10 +2364,10 @@ static int testDomainGetVcpus(virDomainPtr domain, int privmaplen = VIR_CPU_MAPLEN(hostcpus); memset(cpumaps, 0, maplen * maxinfo); -for (v = 0 ; v maxinfo ; v++) { +for (v = 0; v maxinfo; v++) { unsigned char *cpumap = VIR_GET_CPUMAP(cpumaps, maplen, v); -for (i = 0 ; i maxcpu ; i++) { +for (i = 0; i maxcpu; i++) { if (VIR_CPU_USABLE(privdomdata-cpumaps, privmaplen, v, i)) { VIR_USE_CPU(cpumap, i); } @@ -2426,7 +2426,7 @@ static int testDomainPinVcpu(virDomainPtr domain, privcpumap = VIR_GET_CPUMAP(privdomdata-cpumaps, privmaplen, vcpu); memset(privcpumap, 0, privmaplen); -for (i = 0 ; i maxcpu ; i++) { +for (i = 0; i maxcpu; i++) { if (VIR_CPU_USABLE(cpumap, maplen, 0, i)) { VIR_USE_CPU(privcpumap, i); } @@ -2558,7 +2558,7 @@ static int testNodeGetCellsFreeMemory(virConnectPtr conn, } for (i = startCell, j = 0; - (i privconn-numCells j maxCells) ; + (i
[libvirt] [PATCH 06/31] src/xenxs: Remove the whitespace before '; '
--- src/xenxs/xen_sxpr.c | 20 ++-- src/xenxs/xen_xm.c | 16 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/xenxs/xen_sxpr.c b/src/xenxs/xen_sxpr.c index 9a76d04..16737a0 100644 --- a/src/xenxs/xen_sxpr.c +++ b/src/xenxs/xen_sxpr.c @@ -676,7 +676,7 @@ xenParseSxprSound(virDomainDefPtr def, goto no_memory; -for (i = 0 ; i (VIR_DOMAIN_SOUND_MODEL_ES1370 + 1) ; i++) { +for (i = 0; i (VIR_DOMAIN_SOUND_MODEL_ES1370 + 1); i++) { virDomainSoundDefPtr sound; if (VIR_ALLOC(sound) 0) goto no_memory; @@ -1387,7 +1387,7 @@ xenParseSxpr(const struct sexpr *root, if (hvm) { const char *const fds[] = { fda, fdb }; int i; -for (i = 0 ; i ARRAY_CARDINALITY(fds) ; i++) { +for (i = 0; i ARRAY_CARDINALITY(fds); i++) { tmp = sexpr_fmt_node(root, domain/image/hvm/%s, fds[i]); if ((tmp != NULL) (tmp[0] != 0)) { virDomainDiskDefPtr disk; @@ -2101,7 +2101,7 @@ xenFormatSxprAllPCI(virDomainDefPtr def, int hasPCI = 0; int i; -for (i = 0 ; i def-nhostdevs ; i++) +for (i = 0; i def-nhostdevs; i++) if (def-hostdevs[i]-mode == VIR_DOMAIN_HOSTDEV_MODE_SUBSYS def-hostdevs[i]-source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI) hasPCI = 1; @@ -2124,7 +2124,7 @@ xenFormatSxprAllPCI(virDomainDefPtr def, */ virBufferAddLit(buf, (device (pci ); -for (i = 0 ; i def-nhostdevs ; i++) { +for (i = 0; i def-nhostdevs; i++) { if (def-hostdevs[i]-mode == VIR_DOMAIN_HOSTDEV_MODE_SUBSYS def-hostdevs[i]-source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI) { if (def-hostdevs[i]-managed) { @@ -2158,7 +2158,7 @@ xenFormatSxprSound(virDomainDefPtr def, const char *str; int i; -for (i = 0 ; i def-nsounds ; i++) { +for (i = 0; i def-nsounds; i++) { if (!(str = virDomainSoundModelTypeToString(def-sounds[i]-model))) { virReportError(VIR_ERR_INTERNAL_ERROR, _(unexpected sound model %d), @@ -2333,7 +2333,7 @@ xenFormatSxpr(virConnectPtr conn, virBufferAsprintf(buf, (vcpu_avail %lu), (1UL def-vcpus) - 1); -for (i = 0 ; i def-os.nBootDevs ; i++) { +for (i = 0; i def-os.nBootDevs; i++) { switch (def-os.bootDevs[i]) { case VIR_DOMAIN_BOOT_FLOPPY: bootorder[i] = 'a'; @@ -2359,7 +2359,7 @@ xenFormatSxpr(virConnectPtr conn, virBufferAsprintf(buf, (boot %s), bootorder); /* some disk devices are defined here */ -for (i = 0 ; i def-ndisks ; i++) { +for (i = 0; i def-ndisks; i++) { switch (def-disks[i]-device) { case VIR_DOMAIN_DISK_DEVICE_CDROM: /* Only xend = 3.0.2 wants cdrom config here */ @@ -2397,7 +2397,7 @@ xenFormatSxpr(virConnectPtr conn, virBufferAddLit(buf, (usb 1)); -for (i = 0 ; i def-ninputs ; i++) +for (i = 0; i def-ninputs; i++) if (xenFormatSxprInput(def-inputs[i], buf) 0) goto error; @@ -2571,12 +2571,12 @@ xenFormatSxpr(virConnectPtr conn, virBufferAsprintf(buf, (localtime %d), vmlocaltime); -for (i = 0 ; i def-ndisks ; i++) +for (i = 0; i def-ndisks; i++) if (xenFormatSxprDisk(def-disks[i], buf, hvm, xendConfigVersion, 0) 0) goto error; -for (i = 0 ; i def-nnets ; i++) +for (i = 0; i def-nnets; i++) if (xenFormatSxprNet(conn, def-nets[i], buf, hvm, xendConfigVersion, 0) 0) goto error; diff --git a/src/xenxs/xen_xm.c b/src/xenxs/xen_xm.c index 57ce2e7..11c02c1 100644 --- a/src/xenxs/xen_xm.c +++ b/src/xenxs/xen_xm.c @@ -319,7 +319,7 @@ xenParseXM(virConfPtr conf, int xendConfigVersion, if (xenXMConfigGetString(conf, boot, boot, c) 0) goto cleanup; -for (i = 0 ; i VIR_DOMAIN_BOOT_LAST boot[i] ; i++) { +for (i = 0; i VIR_DOMAIN_BOOT_LAST boot[i]; i++) { switch (*boot) { case 'a': def-os.bootDevs[i] = VIR_DOMAIN_BOOT_FLOPPY; @@ -1448,7 +1448,7 @@ xenFormatXMPCI(virConfPtr conf, int hasPCI = 0; int i; -for (i = 0 ; i def-nhostdevs ; i++) +for (i = 0; i def-nhostdevs; i++) if (def-hostdevs[i]-mode == VIR_DOMAIN_HOSTDEV_MODE_SUBSYS def-hostdevs[i]-source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI) hasPCI = 1; @@ -1464,7 +1464,7 @@ xenFormatXMPCI(virConfPtr conf, pciVal-type = VIR_CONF_LIST; pciVal-list = NULL; -for (i = 0 ; i def-nhostdevs ; i++) { +for (i = 0; i def-nhostdevs; i++) { if
[libvirt] [PATCH 09/31] src/node_device: Remove the whitespace before '; '
--- src/node_device/node_device_udev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c index 4aeaed5..620cd58 100644 --- a/src/node_device/node_device_udev.c +++ b/src/node_device/node_device_udev.c @@ -338,7 +338,7 @@ static int udevGenerateDeviceName(struct udev_device *device, def-name = virBufferContentAndReset(buf); -for (i = 0; i strlen(def-name) ; i++) { +for (i = 0; i strlen(def-name); i++) { if (!(c_isalnum(*(def-name + i { *(def-name + i) = '_'; } -- 1.8.1.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 31/31] syntax-check: Add the rule to forbid whitespace before ;
Only a few cases are allowed: 1) The expression is empty for for loop, E.g. for (i = 0; ; i++) 2) An empty statement while (write(statuswrite, status, 1) == -1 errno == EINTR) ; /* empty */ 3) ; is inside double-quote, I.e, as part of const string. E.g. vshPrint(ctl, a ; b ; cd;\n); The for loop in src/rpc/virnettlscontext.c is the special case, 1) applies for it, so change it together in this patch. --- build-aux/bracket-spacing.pl | 18 ++ src/rpc/virnettlscontext.c | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/build-aux/bracket-spacing.pl b/build-aux/bracket-spacing.pl index d3a916f..0d5d2ed 100755 --- a/build-aux/bracket-spacing.pl +++ b/build-aux/bracket-spacing.pl @@ -109,6 +109,24 @@ foreach my $file (@ARGV) { $ret = 1; last; } + +# Forbid whitespace before ;. Things like below are allowed: +# +# for (i = 0; ; i++) +# +# while (write(statuswrite, status, 1) == -1 +#errno == EINTR) +# ; +# +# printf(%s, a ; b\n); +while ($data =~ /[^;\s]\s+;/) { +# Inside the double-quote +if ($data !~ /[^]*\s;/) { +print $file:$.: $line; +$ret = 1; +} +last; +} } close FILE; } diff --git a/src/rpc/virnettlscontext.c b/src/rpc/virnettlscontext.c index 1a7ccb8..305eee9 100644 --- a/src/rpc/virnettlscontext.c +++ b/src/rpc/virnettlscontext.c @@ -292,7 +292,7 @@ static int virNetTLSContextCheckCertKeyPurpose(gnutls_x509_crt_t cert, bool allowClient = false, allowServer = false; critical = 0; -for (i = 0 ; ; i++) { +for (i = 0; ; i++) { size = 0; status = gnutls_x509_crt_get_key_purpose_oid(cert, i, buffer, size, NULL); -- 1.8.1.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 11/31] src/uml: Remove the whitespace before ';'
--- src/uml/uml_conf.c | 12 ++-- src/uml/uml_driver.c | 14 +++--- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/uml/uml_conf.c b/src/uml/uml_conf.c index 52b705c..6e0725c 100644 --- a/src/uml/uml_conf.c +++ b/src/uml/uml_conf.c @@ -407,7 +407,7 @@ virCommandPtr umlBuildCommandLine(virConnectPtr conn, if (vm-def-os.root) virCommandAddArgPair(cmd, root, vm-def-os.root); -for (i = 0 ; i vm-def-ndisks ; i++) { +for (i = 0; i vm-def-ndisks; i++) { virDomainDiskDefPtr disk = vm-def-disks[i]; if (!STRPREFIX(disk-dst, ubd)) { @@ -419,7 +419,7 @@ virCommandPtr umlBuildCommandLine(virConnectPtr conn, virCommandAddArgPair(cmd, disk-dst, disk-src); } -for (i = 0 ; i vm-def-nnets ; i++) { +for (i = 0; i vm-def-nnets; i++) { char *ret = umlBuildCommandLineNet(conn, vm-def, vm-def-nets[i], i); if (!ret) goto error; @@ -427,10 +427,10 @@ virCommandPtr umlBuildCommandLine(virConnectPtr conn, VIR_FREE(ret); } -for (i = 0 ; i UML_MAX_CHAR_DEVICE ; i++) { +for (i = 0; i UML_MAX_CHAR_DEVICE; i++) { virDomainChrDefPtr chr = NULL; char *ret = NULL; -for (j = 0 ; j vm-def-nconsoles ; j++) +for (j = 0; j vm-def-nconsoles; j++) if (vm-def-consoles[j]-target.port == i) chr = vm-def-consoles[j]; if (chr) @@ -442,10 +442,10 @@ virCommandPtr umlBuildCommandLine(virConnectPtr conn, VIR_FREE(ret); } -for (i = 0 ; i UML_MAX_CHAR_DEVICE ; i++) { +for (i = 0; i UML_MAX_CHAR_DEVICE; i++) { virDomainChrDefPtr chr = NULL; char *ret = NULL; -for (j = 0 ; j vm-def-nserials ; j++) +for (j = 0; j vm-def-nserials; j++) if (vm-def-serials[j]-target.port == i) chr = vm-def-serials[j]; if (chr) diff --git a/src/uml/uml_driver.c b/src/uml/uml_driver.c index 321be0f..b238b0f 100644 --- a/src/uml/uml_driver.c +++ b/src/uml/uml_driver.c @@ -276,13 +276,13 @@ umlIdentifyChrPTY(struct uml_driver *driver, { int i; -for (i = 0 ; i dom-def-nconsoles; i++) +for (i = 0; i dom-def-nconsoles; i++) if (dom-def-consoles[i]-source.type == VIR_DOMAIN_CHR_TYPE_PTY) if (umlIdentifyOneChrPTY(driver, dom, dom-def-consoles[i], con) 0) return -1; -for (i = 0 ; i dom-def-nserials; i++) +for (i = 0; i dom-def-nserials; i++) if (dom-def-serials[i]-source.type == VIR_DOMAIN_CHR_TYPE_PTY umlIdentifyOneChrPTY(driver, dom, dom-def-serials[i], ssl) 0) @@ -1004,7 +1004,7 @@ error: static void umlCleanupTapDevices(virDomainObjPtr vm) { int i; -for (i = 0 ; i vm-def-nnets ; i++) { +for (i = 0; i vm-def-nnets; i++) { virDomainNetDefPtr def = vm-def-nets[i]; if (def-type != VIR_DOMAIN_NET_TYPE_BRIDGE @@ -1092,7 +1092,7 @@ static int umlStartVMDaemon(virConnectPtr conn, if (!(cmd = umlBuildCommandLine(conn, driver, vm))) goto cleanup; -for (i = 0 ; i vm-def-nconsoles ; i++) { +for (i = 0; i vm-def-nconsoles; i++) { VIR_FREE(vm-def-consoles[i]-info.alias); if (virAsprintf(vm-def-consoles[i]-info.alias, console%zu, i) 0) { virReportOOMError(); @@ -2037,7 +2037,7 @@ static int umlDomainAttachUmlDisk(struct uml_driver *driver, char *cmd = NULL; char *reply = NULL; -for (i = 0 ; i vm-def-ndisks ; i++) { +for (i = 0; i vm-def-ndisks; i++) { if (STREQ(vm-def-disks[i]-dst, disk-dst)) { virReportError(VIR_ERR_OPERATION_FAILED, _(target %s already exists), disk-dst); @@ -2163,7 +2163,7 @@ static int umlDomainDetachUmlDisk(struct uml_driver *driver, char *cmd; char *reply; -for (i = 0 ; i vm-def-ndisks ; i++) { +for (i = 0; i vm-def-ndisks; i++) { if (STREQ(vm-def-disks[i]-dst, dev-data.disk-dst)) { break; } @@ -2456,7 +2456,7 @@ umlDomainOpenConsole(virDomainPtr dom, } if (dev_name) { -for (i = 0 ; i vm-def-nconsoles ; i++) { +for (i = 0; i vm-def-nconsoles; i++) { if (vm-def-consoles[i]-info.alias STREQ(vm-def-consoles[i]-info.alias, dev_name)) { chr = vm-def-consoles[i]; -- 1.8.1.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 16/31] src/xen: Remove the whitespace before ';'
--- src/xen/xen_driver.c | 6 +++--- src/xen/xen_driver.h | 2 +- src/xen/xen_hypervisor.c | 4 ++-- src/xen/xen_inotify.c| 4 ++-- src/xen/xm_internal.c| 4 ++-- src/xen/xs_internal.c| 12 ++-- 6 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/xen/xen_driver.c b/src/xen/xen_driver.c index cc54f7a..d9d8cd0 100644 --- a/src/xen/xen_driver.c +++ b/src/xen/xen_driver.c @@ -162,8 +162,8 @@ xenDomainUsedCpus(virDomainPtr dom) if ((ncpus = xenUnifiedDomainGetVcpus(dom, cpuinfo, nb_vcpu, cpumap, cpumaplen)) = 0) { -for (n = 0 ; n ncpus ; n++) { -for (m = 0 ; m priv-nbNodeCpus; m++) { +for (n = 0; n ncpus; n++) { +for (m = 0; m priv-nbNodeCpus; m++) { bool used; ignore_value(virBitmapGetBit(cpulist, m, used)); if ((!used) @@ -2201,7 +2201,7 @@ xenUnifiedRemoveDomainInfo(xenUnifiedDomainInfoListPtr list, unsigned char *uuid) { int i; -for (i = 0 ; i list-count ; i++) { +for (i = 0; i list-count; i++) { if (list-doms[i]-id == id STREQ(list-doms[i]-name, name) !memcmp(list-doms[i]-uuid, uuid, VIR_UUID_BUFLEN)) { diff --git a/src/xen/xen_driver.h b/src/xen/xen_driver.h index e33610d..3c7a8cd 100644 --- a/src/xen/xen_driver.h +++ b/src/xen/xen_driver.h @@ -172,7 +172,7 @@ struct _xenUnifiedPrivate { int inotifyFD; int inotifyWatch; -int useXenConfigCache ; +int useXenConfigCache; xenUnifiedDomainInfoListPtr configInfoList; # endif diff --git a/src/xen/xen_hypervisor.c b/src/xen/xen_hypervisor.c index 68a3ef4..1df0945 100644 --- a/src/xen/xen_hypervisor.c +++ b/src/xen/xen_hypervisor.c @@ -2384,7 +2384,7 @@ xenHypervisorMakeCapabilitiesInternal(virConnectPtr conn, } /* Search for existing matching (model,hvm) tuple */ -for (i = 0 ; i nr_guest_archs ; i++) { +for (i = 0; i nr_guest_archs; i++) { if (guest_archs[i].arch == arch guest_archs[i].hvm == hvm) { break; @@ -2631,7 +2631,7 @@ xenHypervisorLookupDomainByUUID(virConnectPtr conn, const unsigned char *uuid) } id = -1; -for (i = 0 ; i nids ; i++) { +for (i = 0; i nids; i++) { if (memcmp(XEN_GETDOMAININFOLIST_UUID(dominfos, i), uuid, VIR_UUID_BUFLEN) == 0) { id = XEN_GETDOMAININFOLIST_DOMAIN(dominfos, i); break; diff --git a/src/xen/xen_inotify.c b/src/xen/xen_inotify.c index e13c572..caed574 100644 --- a/src/xen/xen_inotify.c +++ b/src/xen/xen_inotify.c @@ -101,7 +101,7 @@ xenInotifyXendDomainsDirLookup(virConnectPtr conn, /* If we are here, the domain has gone away. search for, and create a domain from the stored list info */ -for (i = 0 ; i priv-configInfoList-count ; i++) { +for (i = 0; i priv-configInfoList-count; i++) { if (!memcmp(rawuuid, priv-configInfoList-doms[i]-uuid, VIR_UUID_BUFLEN)) { *name = strdup(priv-configInfoList-doms[i]-name); if (!*name) { @@ -175,7 +175,7 @@ xenInotifyXendDomainsDirRemoveEntry(virConnectPtr conn, const char *fname) } /* match and remove on uuid */ -for (i = 0 ; i priv-configInfoList-count ; i++) { +for (i = 0; i priv-configInfoList-count; i++) { if (!memcmp(uuid, priv-configInfoList-doms[i]-uuid, VIR_UUID_BUFLEN)) { VIR_FREE(priv-configInfoList-doms[i]-name); VIR_FREE(priv-configInfoList-doms[i]); diff --git a/src/xen/xm_internal.c b/src/xen/xm_internal.c index 66a6c4c..964be81 100644 --- a/src/xen/xm_internal.c +++ b/src/xen/xm_internal.c @@ -1357,7 +1357,7 @@ xenXMDomainDetachDeviceFlags(virDomainPtr domain, switch (dev-type) { case VIR_DOMAIN_DEVICE_DISK: { -for (i = 0 ; i def-ndisks ; i++) { +for (i = 0; i def-ndisks; i++) { if (def-disks[i]-dst dev-data.disk-dst STREQ(def-disks[i]-dst, dev-data.disk-dst)) { @@ -1376,7 +1376,7 @@ xenXMDomainDetachDeviceFlags(virDomainPtr domain, case VIR_DOMAIN_DEVICE_NET: { -for (i = 0 ; i def-nnets ; i++) { +for (i = 0; i def-nnets; i++) { if (!virMacAddrCmp(def-nets[i]-mac, dev-data.net-mac)) { virDomainNetDefFree(def-nets[i]); if (i (def-nnets - 1)) diff --git a/src/xen/xs_internal.c b/src/xen/xs_internal.c index 496c30b..712ee82 100644 --- a/src/xen/xs_internal.c +++ b/src/xen/xs_internal.c @@ -718,7 +718,7 @@ xenStoreRemoveWatch(virConnectPtr conn, const char *path, const char *token) if (!list) return -1; -for (i = 0 ; i list-count ; i++) { +for (i = 0; i list-count; i++) { if (STREQ(list-watches[i]-path, path)
[libvirt] [PATCH 19/31] tools: Remove the whitespace before ;
--- tools/virsh-domain.c | 6 +++--- tools/virsh-nodedev.c | 6 +++--- tools/virsh-nwfilter.c | 2 +- tools/virsh-secret.c | 2 +- tools/virsh.c | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index bb94ac1..bc42408 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -5295,7 +5295,7 @@ cmdVcpuinfo(vshControl *ctl, const vshCmd *cmd) if ((ncpus = virDomainGetVcpus(dom, cpuinfo, info.nrVirtCpu, cpumaps, cpumaplen)) = 0) { -for (n = 0 ; n ncpus ; n++) { +for (n = 0; n ncpus; n++) { vshPrint(ctl, %-15s %d\n, _(VCPU:), n); vshPrint(ctl, %-15s %d\n, _(CPU:), cpuinfo[n].cpu); vshPrint(ctl, %-15s %s\n, _(State:), @@ -6819,7 +6819,7 @@ static int getSignalNumber(vshControl *ctl, const char *signame) char *lower = vshStrdup(ctl, signame); char *tmp = lower; -for (i = 0 ; signame[i] ; i++) +for (i = 0; signame[i]; i++) lower[i] = c_tolower(signame[i]); if (virStrToLong_i(lower, NULL, 10, signum) = 0) @@ -7808,7 +7808,7 @@ cmdLxcEnterNamespace(vshControl *ctl, const vshCmd *cmd) } _exit(0); } else { -for (i = 0 ; i nfdlist ; i++) +for (i = 0; i nfdlist; i++) VIR_FORCE_CLOSE(fdlist[i]); VIR_FREE(fdlist); if (virProcessWait(pid, NULL) 0) diff --git a/tools/virsh-nodedev.c b/tools/virsh-nodedev.c index 592fa44..3657c5f 100644 --- a/tools/virsh-nodedev.c +++ b/tools/virsh-nodedev.c @@ -277,7 +277,7 @@ fallback: list-ndevices = 0; /* get the node devices */ -for (i = 0; i ndevices ; i++) { +for (i = 0; i ndevices; i++) { if (!(device = virNodeDeviceLookupByName(ctl-conn, names[i]))) continue; list-devices[list-ndevices++] = device; @@ -481,14 +481,14 @@ cmdNodeListDevices(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED) } } -for (i = 0 ; i list-ndevices; i++) { +for (i = 0; i list-ndevices; i++) { if (parents[i] == NULL vshTreePrint(ctl, vshNodeListLookup, arrays, list-ndevices, i) 0) ret = false; } -for (i = 0 ; i list-ndevices; i++) +for (i = 0; i list-ndevices; i++) VIR_FREE(parents[i]); VIR_FREE(parents); for (i = 0; i list-ndevices; i++) diff --git a/tools/virsh-nwfilter.c b/tools/virsh-nwfilter.c index 5a360c2..c7a259a 100644 --- a/tools/virsh-nwfilter.c +++ b/tools/virsh-nwfilter.c @@ -309,7 +309,7 @@ fallback: list-nfilters = 0; /* get the network filters */ -for (i = 0; i nfilters ; i++) { +for (i = 0; i nfilters; i++) { if (!(filter = virNWFilterLookupByName(ctl-conn, names[i]))) continue; list-filters[list-nfilters++] = filter; diff --git a/tools/virsh-secret.c b/tools/virsh-secret.c index 044629d..fb10119 100644 --- a/tools/virsh-secret.c +++ b/tools/virsh-secret.c @@ -439,7 +439,7 @@ fallback: list-nsecrets = 0; /* get the secrets */ -for (i = 0; i nsecrets ; i++) { +for (i = 0; i nsecrets; i++) { if (!(secret = virSecretLookupByUUIDString(ctl-conn, uuids[i]))) continue; list-secrets[list-nsecrets++] = secret; diff --git a/tools/virsh.c b/tools/virsh.c index bb79245..ecb7bd4 100644 --- a/tools/virsh.c +++ b/tools/virsh.c @@ -610,7 +610,7 @@ vshTreePrintInternal(vshControl *ctl, } /* Determine the index of the last child device */ -for (i = 0 ; i num_devices ; i++) { +for (i = 0; i num_devices; i++) { const char *parent = (lookup)(i, true, opaque); if (parent STREQ(parent, dev)) @@ -625,7 +625,7 @@ vshTreePrintInternal(vshControl *ctl, virBufferAddLit(indent, ); if (virBufferError(indent)) goto cleanup; -for (i = 0 ; i num_devices ; i++) { +for (i = 0; i num_devices; i++) { const char *parent = (lookup)(i, true, opaque); if (parent STREQ(parent, dev) -- 1.8.1.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 29/31] src/*.[ch]: Remove the whitespace before ;
--- src/libvirt-lxc.c | 2 +- src/libvirt.c | 10 +- src/nodeinfo.c| 18 +- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/libvirt-lxc.c b/src/libvirt-lxc.c index 6b4e995..f30b6c3 100644 --- a/src/libvirt-lxc.c +++ b/src/libvirt-lxc.c @@ -151,7 +151,7 @@ virDomainLxcEnterNamespace(virDomainPtr domain, if (virProcessSetNamespaces(nfdlist, fdlist) 0) { if (oldfdlist noldfdlist) { -for (i = 0 ; i *noldfdlist ; i++) { +for (i = 0; i *noldfdlist; i++) { VIR_FORCE_CLOSE((*oldfdlist)[i]); } VIR_FREE(*oldfdlist); diff --git a/src/libvirt.c b/src/libvirt.c index 4c018ec..b129611 100644 --- a/src/libvirt.c +++ b/src/libvirt.c @@ -150,7 +150,7 @@ static int virConnectAuthCallbackDefault(virConnectCredentialPtr cred, void *cbdata ATTRIBUTE_UNUSED) { int i; -for (i = 0 ; i ncred ; i++) { +for (i = 0; i ncred; i++) { char buf[1024]; char *bufptr = buf; size_t len; @@ -820,7 +820,7 @@ int virStateInitialize(bool privileged, if (virInitialize() 0) return -1; -for (i = 0 ; i virStateDriverTabCount ; i++) { +for (i = 0; i virStateDriverTabCount; i++) { if (virStateDriverTab[i]-stateInitialize) { VIR_DEBUG(Running global init for %s state driver, virStateDriverTab[i]-name); @@ -846,7 +846,7 @@ int virStateInitialize(bool privileged, int virStateCleanup(void) { int i, ret = 0; -for (i = 0 ; i virStateDriverTabCount ; i++) { +for (i = 0; i virStateDriverTabCount; i++) { if (virStateDriverTab[i]-stateCleanup virStateDriverTab[i]-stateCleanup() 0) ret = -1; @@ -864,7 +864,7 @@ int virStateCleanup(void) { int virStateReload(void) { int i, ret = 0; -for (i = 0 ; i virStateDriverTabCount ; i++) { +for (i = 0; i virStateDriverTabCount; i++) { if (virStateDriverTab[i]-stateReload virStateDriverTab[i]-stateReload() 0) ret = -1; @@ -882,7 +882,7 @@ int virStateReload(void) { int virStateStop(void) { int i, ret = 0; -for (i = 0 ; i virStateDriverTabCount ; i++) { +for (i = 0; i virStateDriverTabCount; i++) { if (virStateDriverTab[i]-stateStop virStateDriverTab[i]-stateStop()) ret = 1; diff --git a/src/nodeinfo.c b/src/nodeinfo.c index 7118a0f..d8375ab 100644 --- a/src/nodeinfo.c +++ b/src/nodeinfo.c @@ -1478,9 +1478,9 @@ nodeCapsInitNUMAFake(virCapsPtr caps ATTRIBUTE_UNUSED) } id = 0; -for (s = 0 ; s nodeinfo.sockets ; s++) { -for (c = 0 ; c nodeinfo.cores ; c++) { -for (t = 0 ; t nodeinfo.threads ; t++) { +for (s = 0; s nodeinfo.sockets; s++) { +for (c = 0; c nodeinfo.cores; c++) { +for (t = 0; t nodeinfo.threads; t++) { cpus[id].id = id; cpus[id].socket_id = s; cpus[id].core_id = c; @@ -1502,7 +1502,7 @@ nodeCapsInitNUMAFake(virCapsPtr caps ATTRIBUTE_UNUSED) return 0; error: -for (; id = 0 ; id--) +for (; id = 0; id--) virBitmapFree(cpus[id].siblings); VIR_FREE(cpus); return -1; @@ -1637,7 +1637,7 @@ nodeCapsInitNUMA(virCapsPtr caps) goto cleanup; memset(allonesmask, 0xff, mask_n_bytes); -for (n = 0 ; n = numa_max_node() ; n++) { +for (n = 0; n = numa_max_node(); n++) { int i; /* The first time this returns -1, ENOENT if node doesn't exist... */ if (numa_node_to_cpus(n, mask, mask_n_bytes) 0) { @@ -1655,14 +1655,14 @@ nodeCapsInitNUMA(virCapsPtr caps) /* Detect the amount of memory in the numa cell */ memory = nodeGetCellMemory(n); -for (ncpus = 0, i = 0 ; i max_n_cpus ; i++) +for (ncpus = 0, i = 0; i max_n_cpus; i++) if (MASK_CPU_ISSET(mask, i)) ncpus++; if (VIR_ALLOC_N(cpus, ncpus) 0) goto cleanup; -for (ncpus = 0, i = 0 ; i max_n_cpus ; i++) { +for (ncpus = 0, i = 0; i max_n_cpus; i++) { if (MASK_CPU_ISSET(mask, i)) { if (virNodeCapsFillCPUInfo(i, cpus + ncpus++) 0) { topology_failed = true; @@ -1714,7 +1714,7 @@ nodeGetCellsFreeMemory(unsigned long long *freeMems, if (lastCell maxCell) lastCell = maxCell; -for (numCells = 0, n = startCell ; n = lastCell ; n++) { +for (numCells = 0, n = startCell; n = lastCell; n++) { long long mem; if (numa_node_size64(n, mem) 0) { virReportError(VIR_ERR_INTERNAL_ERROR, @@ -1740,7 +1740,7 @@ nodeGetFreeMemory(void) return nodeGetFreeMemoryFake(); -for (n = 0 ; n = numa_max_node() ; n++) { +for (n = 0; n = numa_max_node(); n++) { long long mem; if (numa_node_size64(n, mem) 0) {
[libvirt] [PATCH 30/31] nwfitler: Change the comment style
The more common habit is to add the comment after the statements. --- src/nwfilter/nwfilter_dhcpsnoop.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/nwfilter/nwfilter_dhcpsnoop.c b/src/nwfilter/nwfilter_dhcpsnoop.c index b9921e5..451c783 100644 --- a/src/nwfilter/nwfilter_dhcpsnoop.c +++ b/src/nwfilter/nwfilter_dhcpsnoop.c @@ -369,7 +369,7 @@ virNWFilterSnoopListAdd(virNWFilterSnoopIPLeasePtr plnew, for (pl = *end; pl plnew-timeout pl-timeout; pl = pl-prev) -/* empty */ ; +; /* empty */ if (!pl) { plnew-next = *start; @@ -526,7 +526,7 @@ virNWFilterSnoopIPLeaseGetByIP(virNWFilterSnoopIPLeasePtr start, for (pl = start; pl !virSocketAddrEqual(pl-ipAddress, ipaddr); pl = pl-next) -/* empty */ ; +; /* empty */ return pl; } -- 1.8.1.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 27/31] python: Remove the whitespace before ;
--- python/libvirt-lxc-override.c | 4 ++-- python/libvirt-override.c | 16 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/python/libvirt-lxc-override.c b/python/libvirt-lxc-override.c index ead175f..c69affc 100644 --- a/python/libvirt-lxc-override.c +++ b/python/libvirt-lxc-override.c @@ -81,7 +81,7 @@ libvirt_lxc_virDomainLxcOpenNamespace(PyObject *self ATTRIBUTE_UNUSED, return VIR_PY_NONE; py_retval = PyList_New(c_retval); -for (i = 0 ; i c_retval ; i++) { +for (i = 0; i c_retval; i++) { PyObject *item = NULL; if ((item = PyInt_FromLong(fdlist[i])) == NULL) @@ -95,7 +95,7 @@ libvirt_lxc_virDomainLxcOpenNamespace(PyObject *self ATTRIBUTE_UNUSED, return py_retval; error: -for (i = 0 ; i c_retval ; i++) { +for (i = 0; i c_retval; i++) { VIR_FORCE_CLOSE(fdlist[i]); } VIR_FREE(fdlist); diff --git a/python/libvirt-override.c b/python/libvirt-override.c index fd9ebb8..6ed2624 100644 --- a/python/libvirt-override.c +++ b/python/libvirt-override.c @@ -81,7 +81,7 @@ getPyVirTypedParameter(const virTypedParameterPtr params, int nparams) if ((info = PyDict_New()) == NULL) return NULL; -for (i = 0 ; i nparams ; i++) { +for (i = 0; i nparams; i++) { switch (params[i].type) { case VIR_TYPED_PARAM_INT: val = PyInt_FromLong(params[i].value.i); @@ -1409,7 +1409,7 @@ libvirt_virDomainGetVcpus(PyObject *self ATTRIBUTE_UNUSED, if ((pycpumap = PyList_New(dominfo.nrVirtCpu)) == NULL) goto cleanup; -for (i = 0 ; i dominfo.nrVirtCpu ; i++) { +for (i = 0; i dominfo.nrVirtCpu; i++) { PyObject *info = PyTuple_New(4); PyObject *item = NULL; @@ -1441,12 +1441,12 @@ libvirt_virDomainGetVcpus(PyObject *self ATTRIBUTE_UNUSED, Py_XDECREF(item); goto cleanup; } -for (i = 0 ; i dominfo.nrVirtCpu ; i++) { +for (i = 0; i dominfo.nrVirtCpu; i++) { PyObject *info = PyTuple_New(cpunum); int j; if (info == NULL) goto cleanup; -for (j = 0 ; j cpunum ; j++) { +for (j = 0; j cpunum; j++) { PyObject *item = NULL; if ((item = PyBool_FromLong(VIR_CPU_USABLE(cpumap, cpumaplen, i, j))) == NULL || PyTuple_SetItem(info, j, item) 0) { @@ -1950,7 +1950,7 @@ static int virConnectCredCallbackWrapper(virConnectCredentialPtr cred, list = PyTuple_New(2); pycred = PyTuple_New(ncred); -for (i = 0 ; i ncred ; i++) { +for (i = 0; i ncred; i++) { PyObject *pycreditem; pycreditem = PyList_New(5); Py_INCREF(Py_None); @@ -1985,7 +1985,7 @@ static int virConnectCredCallbackWrapper(virConnectCredentialPtr cred, ret = PyLong_AsLong(pyret); if (ret == 0) { -for (i = 0 ; i ncred ; i++) { +for (i = 0; i ncred; i++) { PyObject *pycreditem; PyObject *pyresult; char *result = NULL; @@ -2036,7 +2036,7 @@ libvirt_virConnectOpenAuth(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { int i; if (VIR_ALLOC_N(auth.credtype, auth.ncredtype) 0) return VIR_PY_NONE; -for (i = 0 ; i auth.ncredtype ; i++) { +for (i = 0; i auth.ncredtype; i++) { PyObject *val; val = PyList_GetItem(pycredtype, i); auth.credtype[i] = (int)PyLong_AsLong(val); @@ -5655,7 +5655,7 @@ libvirt_virConnectDomainEventGraphicsCallback(virConnectPtr conn ATTRIBUTE_UNUSE libvirt_constcharPtrWrap(remote-service)); pyobj_subject = PyList_New(subject-nidentity); -for (i = 0 ; i subject-nidentity ; i++) { +for (i = 0; i subject-nidentity; i++) { PyObject *pair = PyTuple_New(2); PyTuple_SetItem(pair, 0, libvirt_constcharPtrWrap(subject-identities[i].type)); PyTuple_SetItem(pair, 1, libvirt_constcharPtrWrap(subject-identities[i].name)); -- 1.8.1.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 21/31] tests/: Remove the whitespace before ;
--- tests/commandhelper.c| 6 +++--- tests/eventtest.c| 18 +- tests/fdstreamtest.c | 14 +++--- tests/libvirtdconftest.c | 2 +- tests/nodeinfotest.c | 2 +- tests/qemuhelptest.c | 2 +- tests/qemumonitortestutils.c | 2 +- tests/qemuxml2argvtest.c | 4 ++-- tests/securityselinuxlabeltest.c | 12 ++-- tests/ssh.c | 4 ++-- tests/testutils.c| 16 tests/vircgrouptest.c| 2 +- tests/virnetsockettest.c | 10 +- tests/viruritest.c | 2 +- 14 files changed, 48 insertions(+), 48 deletions(-) diff --git a/tests/commandhelper.c b/tests/commandhelper.c index d0b9718..e4cc5d2 100644 --- a/tests/commandhelper.c +++ b/tests/commandhelper.c @@ -65,7 +65,7 @@ int main(int argc, char **argv) { if (!log) goto error; -for (i = 1 ; i argc ; i++) { +for (i = 1; i argc; i++) { fprintf(log, ARG:%s\n, argv[i]); } @@ -88,14 +88,14 @@ int main(int argc, char **argv) { } qsort(newenv, n, sizeof(newenv[0]), envsort); -for (i = 0 ; i n ; i++) { +for (i = 0; i n; i++) { /* Ignore the variables used to instruct the loader into * behaving differently, as they could throw the tests off. */ if (!STRPREFIX(newenv[i], LD_)) fprintf(log, ENV:%s\n, newenv[i]); } -for (i = 0 ; i sysconf(_SC_OPEN_MAX) ; i++) { +for (i = 0; i sysconf(_SC_OPEN_MAX); i++) { int f; int closed; if (i == fileno(log)) diff --git a/tests/eventtest.c b/tests/eventtest.c index 700ea08..97d805a 100644 --- a/tests/eventtest.c +++ b/tests/eventtest.c @@ -144,7 +144,7 @@ verifyFired(const char *name, int handle, int timer) int handleFired = 0; int timerFired = 0; int i; -for (i = 0 ; i NUM_FDS ; i++) { +for (i = 0; i NUM_FDS; i++) { if (handles[i].fired) { if (i != handle) { virtTestResult(name, 1, @@ -177,7 +177,7 @@ verifyFired(const char *name, int handle, int timer) } -for (i = 0 ; i NUM_TIME ; i++) { +for (i = 0; i NUM_TIME; i++) { if (timers[i].fired) { if (i != timer) { virtTestResult(name, 1, @@ -248,11 +248,11 @@ static void resetAll(void) { int i; -for (i = 0 ; i NUM_FDS ; i++) { +for (i = 0; i NUM_FDS; i++) { handles[i].fired = 0; handles[i].error = EV_ERROR_NONE; } -for (i = 0 ; i NUM_TIME ; i++) { +for (i = 0; i NUM_TIME; i++) { timers[i].fired = 0; timers[i].error = EV_ERROR_NONE; } @@ -265,7 +265,7 @@ mymain(void) pthread_t eventThread; char one = '1'; -for (i = 0 ; i NUM_FDS ; i++) { +for (i = 0; i NUM_FDS; i++) { if (pipe(handles[i].pipeFD) 0) { fprintf(stderr, Cannot create pipe: %d, errno); return EXIT_FAILURE; @@ -282,7 +282,7 @@ mymain(void) virEventPollInit(); -for (i = 0 ; i NUM_FDS ; i++) { +for (i = 0; i NUM_FDS; i++) { handles[i].delete = -1; handles[i].watch = virEventPollAddHandle(handles[i].pipeFD[0], @@ -291,7 +291,7 @@ mymain(void) handles[i], NULL); } -for (i = 0 ; i NUM_TIME ; i++) { +for (i = 0; i NUM_TIME; i++) { timers[i].delete = -1; timers[i].timeout = -1; timers[i].timer = @@ -432,9 +432,9 @@ mymain(void) if (finishJob(Deleted during dispatch, -1, 2) != EXIT_SUCCESS) return EXIT_FAILURE; -for (i = 0 ; i NUM_FDS - 1 ; i++) +for (i = 0; i NUM_FDS - 1; i++) virEventPollRemoveHandle(handles[i].watch); -for (i = 0 ; i NUM_TIME - 1 ; i++) +for (i = 0; i NUM_TIME - 1; i++) virEventPollRemoveTimeout(timers[i].timer); resetAll(); diff --git a/tests/fdstreamtest.c b/tests/fdstreamtest.c index 9f780c9..a5aed14 100644 --- a/tests/fdstreamtest.c +++ b/tests/fdstreamtest.c @@ -60,7 +60,7 @@ static int testFDStreamReadCommon(const char *scratchdir, bool blocking) VIR_ALLOC_N(buf, PATTERN_LEN) 0) goto cleanup; -for (i = 0 ; i PATTERN_LEN ; i++) +for (i = 0; i PATTERN_LEN; i++) pattern[i] = i; if (virAsprintf(file, %s/input.data, scratchdir) 0) @@ -69,7 +69,7 @@ static int testFDStreamReadCommon(const char *scratchdir, bool blocking) if ((fd = open(file, O_CREAT|O_WRONLY|O_EXCL, 0600)) 0) goto cleanup; -for (i = 0 ; i 10 ; i++) { +for (i = 0; i 10; i++) { if (safewrite(fd, pattern, PATTERN_LEN) != PATTERN_LEN) goto cleanup; } @@ -88,7 +88,7 @@ static int testFDStreamReadCommon(const char *scratchdir, bool blocking) O_RDONLY) 0) goto cleanup; -for (i = 0 ; i 10 ; i++) { +for (i = 0; i 10; i++) {
[libvirt] [PATCH 22/31] src/utils: Remove the whitespace before ;
--- src/util/virarch.c | 2 +- src/util/virauth.c | 2 +- src/util/vircgroup.c| 38 +++--- src/util/vircommand.c | 12 ++-- src/util/vireventpoll.c | 22 +++--- src/util/virhash.c | 6 +++--- src/util/viridentity.c | 4 ++-- src/util/virjson.c | 16 src/util/virlockspace.c | 10 +- src/util/virportallocator.c | 2 +- src/util/virprocess.c | 14 +++--- src/util/virstoragefile.c | 4 ++-- src/util/virstring.c| 2 +- src/util/virthreadwin32.c | 4 ++-- src/util/viruri.c | 2 +- src/util/virutil.c | 2 +- 16 files changed, 71 insertions(+), 71 deletions(-) diff --git a/src/util/virarch.c b/src/util/virarch.c index 8585a78..81558e5 100644 --- a/src/util/virarch.c +++ b/src/util/virarch.c @@ -128,7 +128,7 @@ const char *virArchToString(virArch arch) virArch virArchFromString(const char *archstr) { size_t i; -for (i = 1 ; i VIR_ARCH_LAST ; i++) { +for (i = 1; i VIR_ARCH_LAST; i++) { if (STREQ(virArchData[i].name, archstr)) return i; } diff --git a/src/util/virauth.c b/src/util/virauth.c index fdcefe1..fd53097 100644 --- a/src/util/virauth.c +++ b/src/util/virauth.c @@ -57,7 +57,7 @@ int virAuthGetConfigFilePath(virConnectPtr conn, } if (conn conn-uri) { -for (i = 0 ; i conn-uri-paramsCount ; i++) { +for (i = 0; i conn-uri-paramsCount; i++) { if (STREQ_NULLABLE(conn-uri-params[i].name, authfile) conn-uri-params[i].value) { VIR_DEBUG(Using path from URI '%s', diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c index 07ea2c3..329d84b 100644 --- a/src/util/vircgroup.c +++ b/src/util/vircgroup.c @@ -79,7 +79,7 @@ void virCgroupFree(virCgroupPtr *group) if (*group == NULL) return; -for (i = 0 ; i VIR_CGROUP_CONTROLLER_LAST ; i++) { +for (i = 0; i VIR_CGROUP_CONTROLLER_LAST; i++) { VIR_FREE((*group)-controllers[i].mountPoint); VIR_FREE((*group)-controllers[i].linkPoint); VIR_FREE((*group)-controllers[i].placement); @@ -112,7 +112,7 @@ static int virCgroupCopyMounts(virCgroupPtr group, virCgroupPtr parent) { int i; -for (i = 0 ; i VIR_CGROUP_CONTROLLER_LAST ; i++) { +for (i = 0; i VIR_CGROUP_CONTROLLER_LAST; i++) { if (!parent-controllers[i].mountPoint) continue; @@ -154,7 +154,7 @@ static int virCgroupDetectMounts(virCgroupPtr group) if (STRNEQ(entry.mnt_type, cgroup)) continue; -for (i = 0 ; i VIR_CGROUP_CONTROLLER_LAST ; i++) { +for (i = 0; i VIR_CGROUP_CONTROLLER_LAST; i++) { const char *typestr = virCgroupControllerTypeToString(i); int typelen = strlen(typestr); char *tmp = entry.mnt_opts; @@ -234,7 +234,7 @@ static int virCgroupCopyPlacement(virCgroupPtr group, virCgroupPtr parent) { int i; -for (i = 0 ; i VIR_CGROUP_CONTROLLER_LAST ; i++) { +for (i = 0; i VIR_CGROUP_CONTROLLER_LAST; i++) { if (!group-controllers[i].mountPoint) continue; @@ -311,7 +311,7 @@ static int virCgroupDetectPlacement(virCgroupPtr group, controllers++; selfpath++; -for (i = 0 ; i VIR_CGROUP_CONTROLLER_LAST ; i++) { +for (i = 0; i VIR_CGROUP_CONTROLLER_LAST; i++) { const char *typestr = virCgroupControllerTypeToString(i); int typelen = strlen(typestr); char *tmp = controllers; @@ -376,7 +376,7 @@ static int virCgroupDetect(virCgroupPtr group, if (controllers = 0) { VIR_DEBUG(Validating controllers %d, controllers); -for (i = 0 ; i VIR_CGROUP_CONTROLLER_LAST ; i++) { +for (i = 0; i VIR_CGROUP_CONTROLLER_LAST; i++) { VIR_DEBUG(Controller '%s' wanted=%s, mount='%s', virCgroupControllerTypeToString(i), (1 i) controllers ? yes : no, @@ -391,7 +391,7 @@ static int virCgroupDetect(virCgroupPtr group, } else { /* Check whether a request to disable a controller * clashes with co-mounting of controllers */ -for (j = 0 ; j VIR_CGROUP_CONTROLLER_LAST ; j++) { +for (j = 0; j VIR_CGROUP_CONTROLLER_LAST; j++) { if (j == i) continue; if (!((1 j) controllers)) @@ -411,7 +411,7 @@ static int virCgroupDetect(virCgroupPtr group, } else { VIR_DEBUG(Auto-detecting controllers); controllers = 0; -for (i = 0 ; i VIR_CGROUP_CONTROLLER_LAST ; i++) { +for (i = 0; i VIR_CGROUP_CONTROLLER_LAST; i++) { VIR_DEBUG(Controller '%s' present=%s, virCgroupControllerTypeToString(i),
Re: [libvirt] [Qemu-devel] [qemu-devel] Default machine type setting for ppc64
On Tue, May 21, 2013 at 07:55:27PM +1000, Paul Mackerras wrote: On Tue, May 21, 2013 at 09:39:53AM +0100, Daniel P. Berrange wrote: On Tue, May 21, 2013 at 09:31:26AM +0100, Peter Maydell wrote: On 21 May 2013 09:19, Li Zhang zhlci...@gmail.com wrote: We encounter this problem in openstack which always use default machine type. Currently, QEMU sets mac99 as default setting for ppc64 but it doesn't work on our platform at all. I tried to fix this in libvirt which it is not acceptable because libvirt only considers to get default setting from QEMU. This will need to be fixed for ARM -- the whole idea of there being a sensible default machine type and it being the one QEMU starts by default is pretty x86-centric. libvirt needs to have support for specifying which machine to use. Libvirt has always had support for specifying what machine type to use. This discussion is simply about what machine type to default to, if the user hasn't explicitly asked for one. So, the situation is that the XML in question has typehvm/type, in the os section. Does that say anything about what type of machine is being requested? Obviously not, since you've not specified any machine type and thus you'll get the default. If you don't like that, change your app to request a specific machine type. Why is the machine type in the os section rather than the domain section? That's just the way it was chosen to be represented when first implemented. In hindsight that may be sub-optimal, but libvirt will not change existing XML schema design since that breaks back compatibilty which is worse. QEMU has the notion of a default machine for each target, and that is what libvirt uses if the user hasn't specified a machine. It is not libvirt's job to override QEMU's notion of the default machine here, so if the 'mac99' machine type isn't suitable as the default either QEMU needs to change that for the ppc target, or the user needs to explicitly specify their desired machine type. We are getting the default changed to 'pseries', at least for cases where pseries support is compiled in, which isn't necessarily always. That will of course not satisfy the Freescale guys. I think libvirt needs some more sensible way to ask qemu what its capabilities are. Currently it has no way to ask qemu what machines can you emulate with kvm acceleration? If the user has asked for a KVM domain then the default machine should be one that can be provided by KVM. At present it isn't, on PowerPC. If QEMU can provide more intelligent info in this respect, then libvirt can use it. We're doing the best we can with picking defaults given the info QEMU currently provides us. Daniel -- |: http://berrange.com -o-http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :| -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 24/31] src/remote: Remove the whitespace before ;
--- src/remote/remote_driver.c | 24 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c index 13212d0..229a188 100644 --- a/src/remote/remote_driver.c +++ b/src/remote/remote_driver.c @@ -524,7 +524,7 @@ doRemoteOpen(virConnectPtr conn, int i; if (conn-uri) { -for (i = 0; i conn-uri-paramsCount ; i++) { +for (i = 0; i conn-uri-paramsCount; i++) { virURIParamPtr var = conn-uri-params[i]; EXTRACT_URI_ARG_STR(name, name); EXTRACT_URI_ARG_STR(command, command); @@ -1335,7 +1335,7 @@ remoteNodeGetCellsFreeMemory(virConnectPtr conn, (xdrproc_t) xdr_remote_node_get_cells_free_memory_ret, (char *)ret) == -1) goto done; -for (i = 0 ; i ret.cells.cells_len ; i++) +for (i = 0; i ret.cells.cells_len; i++) freeMems[i] = ret.cells.cells_val[i]; xdr_free((xdrproc_t) xdr_remote_node_get_cells_free_memory_ret, (char *) ret); @@ -3540,7 +3540,7 @@ remoteAuthenticate(virConnectPtr conn, struct private_data *priv, _(unknown authentication type %s), authtype); return -1; } -for (i = 0 ; i ret.types.types_len ; i++) { +for (i = 0; i ret.types.types_len; i++) { if (ret.types.types_val[i] == want) type = want; } @@ -3683,7 +3683,7 @@ static sasl_callback_t *remoteAuthMakeCallbacks(int *credtype, int ncredtype) return NULL; } -for (i = 0, n = 0 ; i ncredtype ; i++) { +for (i = 0, n = 0; i ncredtype; i++) { int id = remoteAuthCredVir2SASL(credtype[i]); if (id != 0) cbs[n++].id = id; @@ -3712,7 +3712,7 @@ static int remoteAuthMakeCredentials(sasl_interact_t *interact, if (!cred) return -1; -for (ninteract = 0, *ncred = 0 ; interact[ninteract].id != 0 ; ninteract++) { +for (ninteract = 0, *ncred = 0; interact[ninteract].id != 0; ninteract++) { if (interact[ninteract].result) continue; (*ncred)++; @@ -3721,7 +3721,7 @@ static int remoteAuthMakeCredentials(sasl_interact_t *interact, if (VIR_ALLOC_N(*cred, *ncred) 0) return -1; -for (ninteract = 0, *ncred = 0 ; interact[ninteract].id != 0 ; ninteract++) { +for (ninteract = 0, *ncred = 0; interact[ninteract].id != 0; ninteract++) { if (interact[ninteract].result) continue; @@ -3756,7 +3756,7 @@ static void remoteAuthFillInteract(virConnectCredentialPtr cred, sasl_interact_t *interact) { int ninteract, ncred; -for (ninteract = 0, ncred = 0 ; interact[ninteract].id != 0 ; ninteract++) { +for (ninteract = 0, ncred = 0; interact[ninteract].id != 0; ninteract++) { if (interact[ninteract].result) continue; interact[ninteract].result = cred[ncred].result; @@ -3796,7 +3796,7 @@ static int remoteAuthFillFromConfig(virConnectPtr conn, goto cleanup; } -for (ninteract = 0 ; state-interact[ninteract].id != 0 ; ninteract++) { +for (ninteract = 0; state-interact[ninteract].id != 0; ninteract++) { const char *value = NULL; switch (state-interact[ninteract].id) { @@ -3846,7 +3846,7 @@ static void remoteAuthInteractStateClear(struct remoteAuthInteractState *state, if (!state) return; -for (i = 0 ; i state-ncred ; i++) +for (i = 0; i state-ncred; i++) VIR_FREE(state-cred[i].result); VIR_FREE(state-cred); state-ncred = 0; @@ -4189,7 +4189,7 @@ remoteAuthPolkit(virConnectPtr conn, struct private_data *priv, /* Auth failed. Ask client to obtain it and check again. */ if (auth auth-cb) { /* Check if the necessary credential type for PolicyKit is supported */ -for (i = 0 ; i auth-ncredtype ; i++) { +for (i = 0; i auth-ncredtype; i++) { if (auth-credtype[i] == VIR_CRED_EXTERNAL) allowcb = 1; } @@ -4488,7 +4488,7 @@ remoteDomainBuildEventGraphics(virNetClientProgramPtr prog ATTRIBUTE_UNUSED, if (VIR_ALLOC_N(subject-identities, msg-subject.subject_len) 0) goto no_memory; subject-nidentity = msg-subject.subject_len; -for (i = 0 ; i subject-nidentity ; i++) { +for (i = 0; i subject-nidentity; i++) { if (!(subject-identities[i].type = strdup(msg-subject.subject_val[i].type)) || !(subject-identities[i].name = strdup(msg-subject.subject_val[i].name))) goto no_memory; @@ -4518,7 +4518,7 @@ no_memory: VIR_FREE(remoteAddr); } if (subject) { -for (i = 0 ; i subject-nidentity ; i++) { +for (i = 0; i subject-nidentity; i++) { VIR_FREE(subject-identities[i].type); VIR_FREE(subject-identities[i].name); } -- 1.8.1.4 -- libvir-list mailing list
Re: [libvirt] [Qemu-devel] [qemu-devel] Default machine type setting for ppc64
On 21 May 2013 11:01, Daniel P. Berrange berra...@redhat.com wrote: On Tue, May 21, 2013 at 07:55:27PM +1000, Paul Mackerras wrote: I think libvirt needs some more sensible way to ask qemu what its capabilities are. Currently it has no way to ask qemu what machines can you emulate with kvm acceleration? If the user has asked for a KVM domain then the default machine should be one that can be provided by KVM. At present it isn't, on PowerPC. If QEMU can provide more intelligent info in this respect, then libvirt can use it. I think this would make sense. Currently for ARM to get KVM acceleration you have to use a specific guest CPU (A15), and so you have to use a machine which supports that CPU (currently just vexpress-a15). But we don't expose any way for libvirt to tell that it needs an A15 or which machine models support which CPUs. In fact we don't even give a sensible error message if you try to use a wrong CPU, we'll just blithely push ahead and behave very weirdly. thanks -- PMM -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH] qemu: fix a typo in qemuAddSharedDevice
--- src/qemu/qemu_conf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index 41fe0b9..7266d3b 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -1184,7 +1184,7 @@ qemuAddSharedDevice(virQEMUDriverPtr driver, if (dev-type == VIR_DOMAIN_DEVICE_DISK) { disk = dev-data.disk; -if (disk-shared || +if (!disk-shared || !disk-src || (disk-type != VIR_DOMAIN_DISK_TYPE_BLOCK !(disk-type == VIR_DOMAIN_DISK_TYPE_VOLUME -- 1.8.1.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] qemu: fix a typo in qemuAddSharedDevice
On 21/05/13 18:40, Guannan Ren wrote: --- src/qemu/qemu_conf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index 41fe0b9..7266d3b 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -1184,7 +1184,7 @@ qemuAddSharedDevice(virQEMUDriverPtr driver, if (dev-type == VIR_DOMAIN_DEVICE_DISK) { disk = dev-data.disk; -if (disk-shared || +if (!disk-shared || !disk-src || (disk-type != VIR_DOMAIN_DISK_TYPE_BLOCK !(disk-type == VIR_DOMAIN_DISK_TYPE_VOLUME ACK. -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] qemu: fix a typo in qemuAddSharedDevice
On Tue, May 21, 2013 at 06:40:34PM +0800, Guannan Ren wrote: --- src/qemu/qemu_conf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index 41fe0b9..7266d3b 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -1184,7 +1184,7 @@ qemuAddSharedDevice(virQEMUDriverPtr driver, if (dev-type == VIR_DOMAIN_DEVICE_DISK) { disk = dev-data.disk; -if (disk-shared || +if (!disk-shared || !disk-src || (disk-type != VIR_DOMAIN_DISK_TYPE_BLOCK !(disk-type == VIR_DOMAIN_DISK_TYPE_VOLUME This code is a good candidate for creation of unit tests to validate the qemuAddSharedDevice / qemuRemoveSharedDevice operation with various different configs. Daniel -- |: http://berrange.com -o-http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :| -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] two hostdev devices problem
On 05/21/2013 04:03 AM, Ján Tomko wrote: On 05/21/2013 09:32 AM, Dominik Mostowiec wrote: hi, I try to add 2 VF by hostdev. Networks (vnet0, vnet1) with: forward mode='hostdev' managed='yes' pf dev='eth1'/ . Domain: interface type=network source network=vnet0/ interface type=network source network=vnet1/ virsh create error: error: internal error process exited while connecting to monitor: kvm: -device pci-assign,configfd=25,host=01:10.1,id=hostdev0,bus=pci.0,addr=0x4: Duplicate ID 'hostdev0' for device Hi, it seems we have been assigning the same id to all network hostdevs until this recent commit (not yet released): http://libvirt.org/git/?p=libvirt.git;a=commitdiff;h=6597cc25 If that patch has such an effect, it's purely accidental. Have you tested this? (I plan to test a before and after as soon as I've had breakfast) -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] two hostdev devices problem
On 05/21/2013 01:37 PM, Laine Stump wrote: On 05/21/2013 04:03 AM, Ján Tomko wrote: On 05/21/2013 09:32 AM, Dominik Mostowiec wrote: hi, I try to add 2 VF by hostdev. Networks (vnet0, vnet1) with: forward mode='hostdev' managed='yes' pf dev='eth1'/ . Domain: interface type=network source network=vnet0/ interface type=network source network=vnet1/ virsh create error: error: internal error process exited while connecting to monitor: kvm: -device pci-assign,configfd=25,host=01:10.1,id=hostdev0,bus=pci.0,addr=0x4: Duplicate ID 'hostdev0' for device Hi, it seems we have been assigning the same id to all network hostdevs until this recent commit (not yet released): http://libvirt.org/git/?p=libvirt.git;a=commitdiff;h=6597cc25 If that patch has such an effect, it's purely accidental. Have you tested this? (I plan to test a before and after as soon as I've had breakfast) I haven't tested it and looking at the code again, I might've been wrong :( Sorry about that. Jan -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [Qemu-devel] [qemu-devel] Default machine type setting for ppc64
Daniel P. Berrange berra...@redhat.com writes: On Tue, May 21, 2013 at 07:55:27PM +1000, Paul Mackerras wrote: On Tue, May 21, 2013 at 09:39:53AM +0100, Daniel P. Berrange wrote: QEMU has the notion of a default machine for each target, and that is what libvirt uses if the user hasn't specified a machine. It is not libvirt's job to override QEMU's notion of the default machine here, so if the 'mac99' machine type isn't suitable as the default either QEMU needs to change that for the ppc target, or the user needs to explicitly specify their desired machine type. We are getting the default changed to 'pseries', at least for cases where pseries support is compiled in, which isn't necessarily always. That will of course not satisfy the Freescale guys. I think libvirt needs some more sensible way to ask qemu what its capabilities are. Currently it has no way to ask qemu what machines can you emulate with kvm acceleration? If the user has asked for a KVM domain then the default machine should be one that can be provided by KVM. At present it isn't, on PowerPC. If QEMU can provide more intelligent info in this respect, then libvirt can use it. We're doing the best we can with picking defaults given the info QEMU currently provides us. We've talked in the past about having an accelerator specific machine default. I think this is a perfectly reasonable thing to do and would solve the problem for ARM and for PPC. That said, why is mac99 the default? It doesn't seem to work at all for me. Even with TCG, I've had more luck with -M pseries. While adding an accelerator specific default, if mac99 is the wrong default for TCG, then we should change it. Regards, Anthony Liguori Daniel -- |: http://berrange.com -o-http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :| -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [Qemu-devel] [qemu-devel] Default machine type setting for ppc64
On 21 May 2013 13:04, Anthony Liguori anth...@codemonkey.ws wrote: We've talked in the past about having an accelerator specific machine default. I think this is a perfectly reasonable thing to do and would solve the problem for ARM and for PPC. For ARM I would prefer not to have a default at all, and make the next level up specify it. It's reasonable to have a default machine choice for when you create a VM configuration; it's not so sensible to have a default that's picked every time you run the VM. The thing I think is most likely to be the useful choice for KVM/ARM isn't even in the tree yet... There's no user level difference between pick whether you wanted a model of a versatile-PB or a zaurus and pick whether you wanted a model of an x86-PC or an ARM zaurus. At the moment we require the user to specify the latter choice (by having them in separate executables) but try to guess the former. That said, why is mac99 the default? Presumably because it was a sensible choice when it was originally put in, and once you have a default you can't change it without breaking peoples' command lines. thanks -- PMM -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] interface: list all interfaces with flags == 0
On Tue, May 21, 2013 at 17:05:09 +0800, Guan Nan Ren wrote: virConnectListAllInterfaces should support to list all of interfaces when the value of flags is 0. The behaviour is consistent with other virConnectListAll* APIs --- diff --git a/src/interface/interface_backend_netcf.c b/src/interface/interface_backend_netcf.c index cbba4fd..c6e069a 100644 --- a/src/interface/interface_backend_netcf.c +++ b/src/interface/interface_backend_netcf.c ... @@ -361,16 +359,17 @@ netcfConnectListAllInterfaces(virConnectPtr conn, /* XXX: Filter the result, need to be splitted once new filter flags * except active|inactive are supported. */ -if (((status NETCF_IFACE_ACTIVE) - (flags VIR_CONNECT_LIST_INTERFACES_ACTIVE)) || -((status NETCF_IFACE_INACTIVE) - (flags VIR_CONNECT_LIST_INTERFACES_INACTIVE))) { -if (ifaces) { -iface_obj = virGetInterface(conn, ncf_if_name(iface), -ncf_if_mac_string(iface)); -tmp_iface_objs[niface_objs] = iface_obj; -} -niface_objs++; +if (MATCH(VIR_CONNECT_LIST_INTERFACES_FILTERS_ACTIVE) +!((MATCH(VIR_CONNECT_LIST_INTERFACES_ACTIVE) + (status NETCF_IFACE_ACTIVE)) || + (MATCH(VIR_CONNECT_LIST_INTERFACES_INACTIVE) + (status NETCF_IFACE_INACTIVE +continue; IMHO this is much harder to read. I'd just rewrite the original condition as (i.e., !MATCH(VIR_CONNECT_LIST_INTERFACES_FILTERS_ACTIVE) is the part that was missing): if (!MATCH(VIR_CONNECT_LIST_INTERFACES_FILTERS_ACTIVE) || (MATCH(VIR_CONNECT_LIST_INTERFACES_ACTIVE) (status NETCF_IFACE_ACTIVE)) || (MATCH(VIR_CONNECT_LIST_INTERFACES_INACTIVE) (status NETCF_IFACE_INACTIVE))) Moreover, your version is wrong as it skips ncf_if_free(iface) in case iface should be skipped. + +if (ifaces) { +iface_obj = virGetInterface(conn, ncf_if_name(iface), +ncf_if_mac_string(iface)); +tmp_iface_objs[niface_objs++] = iface_obj; } ncf_if_free(iface); diff --git a/src/interface/interface_backend_udev.c b/src/interface/interface_backend_udev.c index 1fd7d46..242fc15 100644 --- a/src/interface/interface_backend_udev.c +++ b/src/interface/interface_backend_udev.c ... @@ -363,18 +362,15 @@ udevConnectListAllInterfaces(virConnectPtr conn, status = STREQ(udev_device_get_sysattr_value(dev, operstate), up); /* Filter the results */ -if (status (flags VIR_CONNECT_LIST_INTERFACES_ACTIVE)) -add_to_list = 1; -else if (!status (flags VIR_CONNECT_LIST_INTERFACES_INACTIVE)) -add_to_list = 1; +if (MATCH(VIR_CONNECT_LIST_INTERFACES_FILTERS_ACTIVE) +!((MATCH(VIR_CONNECT_LIST_INTERFACES_ACTIVE) status) || + (MATCH(VIR_CONNECT_LIST_INTERFACES_INACTIVE) !status))) +continue; Same bug in skipping udev_device_unref(dev). And similarly hard to read test :-) /* If we matched a filter, then add it */ -if (add_to_list) { -if (ifaces) { -iface_obj = virGetInterface(conn, name, macaddr); -ifaces_list[count] = iface_obj; -} -count++; +if (ifaces) { +iface_obj = virGetInterface(conn, name, macaddr); +ifaces_list[count++] = iface_obj; } udev_device_unref(dev); } Jirka -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] interface: list all interfaces with flags == 0
On 05/21/2013 08:15 PM, Jiri Denemark wrote: On Tue, May 21, 2013 at 17:05:09 +0800, Guan Nan Ren wrote: virConnectListAllInterfaces should support to list all of interfaces when the value of flags is 0. The behaviour is consistent with other virConnectListAll* APIs --- diff --git a/src/interface/interface_backend_netcf.c b/src/interface/interface_backend_netcf.c index cbba4fd..c6e069a 100644 --- a/src/interface/interface_backend_netcf.c +++ b/src/interface/interface_backend_netcf.c ... @@ -361,16 +359,17 @@ netcfConnectListAllInterfaces(virConnectPtr conn, /* XXX: Filter the result, need to be splitted once new filter flags * except active|inactive are supported. */ -if (((status NETCF_IFACE_ACTIVE) - (flags VIR_CONNECT_LIST_INTERFACES_ACTIVE)) || -((status NETCF_IFACE_INACTIVE) - (flags VIR_CONNECT_LIST_INTERFACES_INACTIVE))) { -if (ifaces) { -iface_obj = virGetInterface(conn, ncf_if_name(iface), -ncf_if_mac_string(iface)); -tmp_iface_objs[niface_objs] = iface_obj; -} -niface_objs++; +if (MATCH(VIR_CONNECT_LIST_INTERFACES_FILTERS_ACTIVE) +!((MATCH(VIR_CONNECT_LIST_INTERFACES_ACTIVE) + (status NETCF_IFACE_ACTIVE)) || + (MATCH(VIR_CONNECT_LIST_INTERFACES_INACTIVE) + (status NETCF_IFACE_INACTIVE +continue; IMHO this is much harder to read. I'd just rewrite the original condition as (i.e., !MATCH(VIR_CONNECT_LIST_INTERFACES_FILTERS_ACTIVE) is the part that was missing): if (!MATCH(VIR_CONNECT_LIST_INTERFACES_FILTERS_ACTIVE) || (MATCH(VIR_CONNECT_LIST_INTERFACES_ACTIVE) (status NETCF_IFACE_ACTIVE)) || (MATCH(VIR_CONNECT_LIST_INTERFACES_INACTIVE) (status NETCF_IFACE_INACTIVE))) Moreover, your version is wrong as it skips ncf_if_free(iface) in case iface should be skipped. yes, currently, there are only one group of flags with two values(active/inactive), the way of yours is better to read. if in future, there are more than one group of flags which are going to support, the way of my version will be better. virConnectListAllDomains use this way to filter list of domains. Guannan -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 05/11] Convert Xen domain start/migration APIs to use virDomainDefPtr
On Mon, May 20, 2013 at 11:40:34AM -0600, Jim Fehlig wrote: I finally have some time to continue reviewing this series... Daniel P. Berrange wrote: From: Daniel P. Berrange berra...@redhat.com Introduce use of a virDomainDefPtr in the domain migrate start APIs to simplify introduction of ACL security checks. Not really the 'start' API, but GetXMLDesc, Define, and Undefine. Should those be part of the lifecycle changes made in patch 2? Opps bad description. I tried to make each patch as small as possible. So where I grouped several methods together, I only did it because they were mutually dependent wrt the refactoring. Will fix the description of this commit. @@ -44,7 +44,8 @@ int xenXMDomainGetState(virConnectPtr conn, virDomainDefPtr def, int *state, int *reason); -char *xenXMDomainGetXMLDesc(virDomainPtr domain, unsigned int flags); +virDomainDefPtr xenXMDomainGetXMLDesc(virConnectPtr conn, + virDomainDefPtr def); This still squeezes into one line too. As you've probably seen by now, I've preferred to split the lines when there are 1 parameter in the method, even if it would technically fit on one line. Daniel -- |: http://berrange.com -o-http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :| -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 06/11] Convert Xen domain VCPU driver methods to use virDomainDefPtr
On Mon, May 20, 2013 at 12:14:04PM -0600, Jim Fehlig wrote: Daniel P. Berrange wrote: From: Daniel P. Berrange berra...@redhat.com Introduce use of a virDomainDefPtr in the domain VCPU APIs to simplify introduction of ACL security checks. The virDomainPtr cannot be safely used, since the app may have supplied mis-matching name/uuid/id fields. eg the name points to domain X, while the uuid points to domain Y. Resolving the virDomainPtr to a virDomainDefPtr ensures a consistent name/uuid/id set. Signed-off-by: Daniel P. Berrange berra...@redhat.com --- src/xen/xen_driver.c | 84 src/xen/xen_hypervisor.c | 42 src/xen/xen_hypervisor.h | 9 -- src/xen/xend_internal.c | 81 ++ src/xen/xend_internal.h | 17 ++ src/xen/xm_internal.c| 30 + src/xen/xm_internal.h| 19 --- 7 files changed, 187 insertions(+), 95 deletions(-) diff --git a/src/xen/xen_driver.c b/src/xen/xen_driver.c index 8b7dec9..04cb69d 100644 --- a/src/xen/xen_driver.c +++ b/src/xen/xen_driver.c @@ -647,11 +647,30 @@ xenUnifiedConnectNumOfDomains(virConnectPtr conn) static virDomainPtr xenUnifiedDomainCreateXML(virConnectPtr conn, - const char *xmlDesc, unsigned int flags) + const char *xml, + unsigned int flags) { +xenUnifiedPrivatePtr priv = conn-privateData; +virDomainDefPtr def = NULL; +virDomainPtr ret = NULL; + virCheckFlags(0, NULL); -return xenDaemonCreateXML(conn, xmlDesc); +if (!(def = virDomainDefParseString(xml, priv-caps, priv-xmlopt, +1 VIR_DOMAIN_VIRT_XEN, +VIR_DOMAIN_XML_INACTIVE))) +goto cleanup; + +if (xenDaemonCreateXML(conn, def) 0) +goto cleanup; + +ret = virGetDomain(conn, def-name, def-uuid); +if (ret) +ret-id = def-id; + +cleanup: +virDomainDefFree(def); +return ret; } Should this hunk be in patch 2? Or perhaps it was meant for patch 5? Hmm, actually, yes, it should be in the previous patch. Daniel -- |: http://berrange.com -o-http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :| -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] two hostdev devices problem
Hmm, It seems to be working (after only simple tests). -- Dominik 2013/5/21 Ján Tomko jto...@redhat.com On 05/21/2013 01:37 PM, Laine Stump wrote: On 05/21/2013 04:03 AM, Ján Tomko wrote: On 05/21/2013 09:32 AM, Dominik Mostowiec wrote: hi, I try to add 2 VF by hostdev. Networks (vnet0, vnet1) with: forward mode='hostdev' managed='yes' pf dev='eth1'/ . Domain: interface type=network source network=vnet0/ interface type=network source network=vnet1/ virsh create error: error: internal error process exited while connecting to monitor: kvm: -device pci-assign,configfd=25,host=01:10.1,id=hostdev0,bus=pci.0,addr=0x4: Duplicate ID 'hostdev0' for device Hi, it seems we have been assigning the same id to all network hostdevs until this recent commit (not yet released): http://libvirt.org/git/?p=libvirt.git;a=commitdiff;h=6597cc25 If that patch has such an effect, it's purely accidental. Have you tested this? (I plan to test a before and after as soon as I've had breakfast) I haven't tested it and looking at the code again, I might've been wrong :( Sorry about that. Jan -- Pozdrawiam Dominik -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH] udev: should not list bridge devices
When using udev backend, virsh iface-list outputs bridge devices like: Name State MAC Address em1 active e8:39:35:58:d5:94 lo active 00:00:00:00:00:00 virbr0 active fe:54:00:a5:f6:42 The patch filters out bridge devices. --- src/interface/interface_backend_udev.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/interface/interface_backend_udev.c b/src/interface/interface_backend_udev.c index 1fd7d46..92648e8 100644 --- a/src/interface/interface_backend_udev.c +++ b/src/interface/interface_backend_udev.c @@ -78,6 +78,9 @@ udevGetDevices(struct udev *udev, virUdevStatus status) /* Ignore devices that are part of a bridge */ udev_enumerate_add_nomatch_sysattr(enumerate, brport/state, NULL); +/* Ignore bridge devices */ +udev_enumerate_add_nomatch_sysattr(enumerate, bridge/bridge_id, NULL); + /* State of the device */ switch (status) { case VIR_UDEV_IFACE_ACTIVE: -- 1.8.1.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH v2] interface: list all interfaces with flags == 0
virConnectListAllInterfaces should support to list all of interfaces when the value of flags is 0. The behaviour is consistent with other virConnectListAll* APIs --- src/conf/interface_conf.h | 4 src/interface/interface_backend_netcf.c | 29 +++-- src/interface/interface_backend_udev.c | 25 - 3 files changed, 31 insertions(+), 27 deletions(-) diff --git a/src/conf/interface_conf.h b/src/conf/interface_conf.h index e636c35..ae93811 100644 --- a/src/conf/interface_conf.h +++ b/src/conf/interface_conf.h @@ -211,4 +211,8 @@ char *virInterfaceDefFormat(const virInterfaceDefPtr def); void virInterfaceObjLock(virInterfaceObjPtr obj); void virInterfaceObjUnlock(virInterfaceObjPtr obj); +#define VIR_CONNECT_LIST_INTERFACES_FILTERS_ACTIVE \ +(VIR_CONNECT_LIST_INTERFACES_ACTIVE | \ + VIR_CONNECT_LIST_INTERFACES_INACTIVE) + #endif /* __INTERFACE_CONF_H__ */ diff --git a/src/interface/interface_backend_netcf.c b/src/interface/interface_backend_netcf.c index cbba4fd..d626017 100644 --- a/src/interface/interface_backend_netcf.c +++ b/src/interface/interface_backend_netcf.c @@ -260,6 +260,7 @@ static int netcfConnectListDefinedInterfaces(virConnectPtr conn, char **const na } +#define MATCH(FLAG) (flags (FLAG)) static int netcfConnectListAllInterfaces(virConnectPtr conn, virInterfacePtr **ifaces, @@ -276,8 +277,7 @@ netcfConnectListAllInterfaces(virConnectPtr conn, int ret = -1; char **names = NULL; -virCheckFlags(VIR_CONNECT_LIST_INTERFACES_ACTIVE | - VIR_CONNECT_LIST_INTERFACES_INACTIVE, -1); +virCheckFlags(VIR_CONNECT_LIST_INTERFACES_FILTERS_ACTIVE, -1); interfaceDriverLock(driver); @@ -293,7 +293,6 @@ netcfConnectListAllInterfaces(virConnectPtr conn, _(failed to get number of host interfaces: %s%s%s), errmsg, details ? - : , details ? details : ); -ret = -1; goto cleanup; } @@ -304,7 +303,6 @@ netcfConnectListAllInterfaces(virConnectPtr conn, if (VIR_ALLOC_N(names, count) 0) { virReportOOMError(); -ret = -1; goto cleanup; } @@ -361,16 +359,19 @@ netcfConnectListAllInterfaces(virConnectPtr conn, /* XXX: Filter the result, need to be splitted once new filter flags * except active|inactive are supported. */ -if (((status NETCF_IFACE_ACTIVE) - (flags VIR_CONNECT_LIST_INTERFACES_ACTIVE)) || -((status NETCF_IFACE_INACTIVE) - (flags VIR_CONNECT_LIST_INTERFACES_INACTIVE))) { -if (ifaces) { -iface_obj = virGetInterface(conn, ncf_if_name(iface), -ncf_if_mac_string(iface)); -tmp_iface_objs[niface_objs] = iface_obj; -} -niface_objs++; +if (MATCH(VIR_CONNECT_LIST_INTERFACES_FILTERS_ACTIVE) +!((MATCH(VIR_CONNECT_LIST_INTERFACES_ACTIVE) + (status NETCF_IFACE_ACTIVE)) || + (MATCH(VIR_CONNECT_LIST_INTERFACES_INACTIVE) + (status NETCF_IFACE_INACTIVE { +ncf_if_free(iface); +continue; +} + +if (ifaces) { +iface_obj = virGetInterface(conn, ncf_if_name(iface), +ncf_if_mac_string(iface)); +tmp_iface_objs[niface_objs++] = iface_obj; } ncf_if_free(iface); diff --git a/src/interface/interface_backend_udev.c b/src/interface/interface_backend_udev.c index 1fd7d46..428adc8 100644 --- a/src/interface/interface_backend_udev.c +++ b/src/interface/interface_backend_udev.c @@ -282,6 +282,7 @@ udevConnectListDefinedInterfaces(virConnectPtr conn, VIR_UDEV_IFACE_INACTIVE); } +#define MATCH(FLAG) (flags (FLAG)) static int udevConnectListAllInterfaces(virConnectPtr conn, virInterfacePtr **ifaces, @@ -299,8 +300,7 @@ udevConnectListAllInterfaces(virConnectPtr conn, int status = 0; int ret; -virCheckFlags(VIR_CONNECT_LIST_INTERFACES_ACTIVE | - VIR_CONNECT_LIST_INTERFACES_INACTIVE, -1); +virCheckFlags(VIR_CONNECT_LIST_INTERFACES_FILTERS_ACTIVE, -1); /* Grab a udev reference */ udev = udev_ref(driverState-udev); @@ -354,7 +354,6 @@ udevConnectListAllInterfaces(virConnectPtr conn, const char *path; const char *name; const char *macaddr; -int add_to_list = 0; path = udev_list_entry_get_name(dev_entry); dev = udev_device_new_from_syspath(udev, path); @@ -363,18 +362,17 @@ udevConnectListAllInterfaces(virConnectPtr conn, status = STREQ(udev_device_get_sysattr_value(dev, operstate), up); /* Filter the results */ -if (status (flags
Re: [libvirt] [PATCH 0/3] Resolve Coverity found issues
On 05/16/2013 10:01 AM, John Ferlan wrote: Upgraded to Coverity 6.5.3 which uncovered a few code paths with issues. John Ferlan (3): lxc_process: Resolve Coverity NULL_RETURNS error xencapstest: Resolve Coverity CHECKED_RETURN error shunloadtest: Resolve Coverity CHECKED_RETURN error src/lxc/lxc_process.c | 4 ++-- tests/shunloadhelper.c | 12 tests/shunloadtest.c | 26 +- tests/xencapstest.c| 3 ++- 4 files changed, 29 insertions(+), 16 deletions(-) patches 2/3 and 3/3 were pushed, I'm reworking 1/3 to store the virConnectPtr John -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 3/3 v3] qemu: add ', share=policy' to qemu commandline
On 05/16/2013 03:00 PM, Guannan Ren wrote: example: qemu ${otherargs} \ -vnc 127.0.0.1:0,share=allow-exclusive --- src/qemu/qemu_command.c | 36 tests/qemuargv2xmltest.c | 1 + tests/qemuxml2argvtest.c | 1 + You forgot to add the .args and .xml files. 3 files changed, 38 insertions(+) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 5b95c07..a462153 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -6098,6 +6098,19 @@ qemuBuildGraphicsVNCCommandLine(virQEMUDriverConfigPtr cfg, virBufferAsprintf(opt, ,websocket=%d, graphics-data.vnc.websocket); } +if (graphics-data.vnc.sharePolicy) { +if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_VNC_SHARE_POLICY)) { +virReportError(VIR_ERR_CONFIG_UNSUPPORTED, %s, + _(vnc display sharing policy is not + supported with this QEMU)); +goto error; +} + +virBufferAsprintf(opt, ,share=%s, + virDomainGraphicsVNCSharePolicyTypeToString( + graphics-data.vnc.sharePolicy)); +} + if (graphics-data.vnc.auth.passwd || cfg-vncPassword) virBufferAddLit(opt, ,password); @@ -10013,6 +10026,29 @@ virDomainDefPtr qemuParseCommandLine(virCapsPtr qemuCaps, vnc-data.vnc.websocket = vnc-data.vnc.port + 5700; } +} else if (STRPREFIX(opts, share=)) { +char *sharePolicy = opts + strlen(share=); +if (sharePolicy *sharePolicy) { sharePolicy is definitely non-NULL here. +int policy = + virDomainGraphicsVNCSharePolicyTypeFromString(sharePolicy); + +if (policy 0) { +virReportError(VIR_ERR_INTERNAL_ERROR, + _(unknown vnc display sharing policy '%s'), + sharePolicy); +virDomainGraphicsDefFree(vnc); +VIR_FREE(orig_opts); +goto error; +} else { +vnc-data.vnc.sharePolicy = policy; +} +} else { +virReportError(VIR_ERR_INTERNAL_ERROR, missing %s breaks syntax-check + _(missing vnc sharing policy)); +virDomainGraphicsDefFree(vnc); +VIR_FREE(orig_opts); +goto error; +} } opts = nextopt; Jan -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] This patch fixes up a previous patch to work in containers
It also adds the ability to pass in privileged field into Security Manager so that writing to /run/setrans only attempted on privileged machines [PATCH] libvirt writes an mcs translation file to /run/setrans -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH] libvirt writes an mcs translation file to /run/setrans directory
From: Dan Walsh dwa...@redhat.com mcstransd is a translation tool that can translate MCS Labels into human understandable code. I have patched it to watch for translation files in the /run/setrans directory. This allows us to run commands like ps -eZ and see system_u:system_r:svirt_t:Fedora18 rather then system_u:system_r:svirt_t:s0:c1,c2. When used with containers it would make an easy way to list all processes within a container using ps -eZ | grep Fedora18 Pass in privileged field into Security Manager so this is only attempted on privileged machines --- src/lxc/lxc_container.c | 8 +++--- src/lxc/lxc_controller.c| 2 +- src/lxc/lxc_driver.c| 3 ++- src/qemu/qemu_conf.c| 2 ++ src/qemu/qemu_conf.h| 1 + src/qemu/qemu_driver.c | 9 --- src/security/security_manager.c | 29 +++-- src/security/security_manager.h | 7 +++-- src/security/security_selinux.c | 57 - 9 files changed, 98 insertions(+), 20 deletions(-) diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c index 48ccc09..cb6ae6a 100644 --- a/src/lxc/lxc_container.c +++ b/src/lxc/lxc_container.c @@ -1829,6 +1829,10 @@ static int lxcContainerSetupPivotRoot(virDomainDefPtr vmDef, if (lxcContainerPopulateDevices(ttyPaths, nttyPaths) 0) goto cleanup; +VIR_DEBUG(Setting up security labeling); +if (virSecurityManagerSetProcessLabel(securityDriver, vmDef) 0) +goto cleanup; + /* Sets up any non-root mounts from guest config */ if (lxcContainerMountAllFS(vmDef, sec_mount_options) 0) goto cleanup; @@ -2027,10 +2031,6 @@ static int lxcContainerChild(void *data) goto cleanup; } -VIR_DEBUG(Setting up security labeling); -if (virSecurityManagerSetProcessLabel(argv-securityDriver, vmDef) 0) -goto cleanup; - if (lxcContainerSetStdio(argv-monitor, ttyfd, argv-handshakefd) 0) { goto cleanup; } diff --git a/src/lxc/lxc_controller.c b/src/lxc/lxc_controller.c index 730236e..5a4c809 100644 --- a/src/lxc/lxc_controller.c +++ b/src/lxc/lxc_controller.c @@ -1732,7 +1732,7 @@ int main(int argc, char *argv[]) if (!(ctrl-securityManager = virSecurityManagerNew(securityDriver, LXC_DRIVER_NAME, -false, false, false))) +false, false, false, true))) goto cleanup; if (ctrl-def-seclabels) { diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c index 997f81d..a80cc9b 100644 --- a/src/lxc/lxc_driver.c +++ b/src/lxc/lxc_driver.c @@ -1358,7 +1358,8 @@ lxcSecurityInit(virLXCDriverPtr driver) LXC_DRIVER_NAME, false, driver-securityDefaultConfined, - driver-securityRequireConfined); + driver-securityRequireConfined, + true); if (!mgr) goto error; diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index 098e49c..b92a27b 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -250,6 +250,7 @@ virQEMUDriverConfigPtr virQEMUDriverConfigNew(bool privileged) cfg-securityDefaultConfined = true; cfg-securityRequireConfined = false; +cfg-securityPrivileged = privileged; cfg-keepAliveInterval = 5; cfg-keepAliveCount = 5; @@ -399,6 +400,7 @@ int virQEMUDriverConfigLoadFile(virQEMUDriverConfigPtr cfg, GET_VALUE_BOOL(security_default_confined, cfg-securityDefaultConfined); GET_VALUE_BOOL(security_require_confined, cfg-securityRequireConfined); +GET_VALUE_BOOL(security_privileged, cfg-securityPrivileged); GET_VALUE_BOOL(spice_tls, cfg-spiceTLS); GET_VALUE_STR(spice_tls_x509_cert_dir, cfg-spiceTLSx509certdir); diff --git a/src/qemu/qemu_conf.h b/src/qemu/qemu_conf.h index df0791e..06824ae 100644 --- a/src/qemu/qemu_conf.h +++ b/src/qemu/qemu_conf.h @@ -138,6 +138,7 @@ struct _virQEMUDriverConfig { char **securityDriverNames; bool securityDefaultConfined; bool securityRequireConfined; +bool securityPrivileged; char *saveImageFormat; char *dumpImageFormat; diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 203cc6d..7a68e8a 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -322,7 +322,8 @@ qemuSecurityInit(virQEMUDriverPtr driver) QEMU_DRIVER_NAME, cfg-allowDiskFormatProbing, cfg-securityDefaultConfined, -
[libvirt] [PATCHv4 0/4] Multiple TX queue support
Fixed version with Laine's comments worked in [1]. Moreover, most of the patches joined together. Patches 2, 3 and 5 has been ACKed already. BTW, patch 4 is really a different to patch 3. The only thing they share is a commit message body. Kernel and subsequently QEMU learned multiple transmit queues a while ago. The feature has a nice advantage, it allows a single guest to transmit multiple flows of network data using multiple CPUs simultaneously which increase traffic bandwidth. A lot. The documentation how to use this is available at [2] or [3]. 1: https://www.redhat.com/archives/libvir-list/2013-May/msg01196.html 2: https://git.kernel.org/cgit/linux/kernel/git/davem/net-next.git/tree/Documentation/networking/tuntap.txt 3: http://git.qemu.org/?p=qemu.git;a=blob;f=qemu-options.hx;hb=HEAD#l1363 Michal Privoznik (4): Introduce /domain/devices/interface/driver/@queues attribute qemu: Move interface cmd line construction into a separate function qemu: Adapt qemuBuildInterfaceCommandLine to to multiqueue net qemu: Enable multiqueue network docs/formatdomain.html.in | 12 +- docs/schemas/domaincommon.rng | 5 + src/conf/domain_conf.c | 15 + src/conf/domain_conf.h | 1 + src/network/bridge_driver.c| 2 +- src/qemu/qemu_command.c| 462 + src/qemu/qemu_command.h| 13 +- src/qemu/qemu_hotplug.c| 113 +++-- src/qemu/qemu_monitor.c| 78 ++-- src/qemu/qemu_monitor.h| 8 +- src/uml/uml_conf.c | 5 +- src/util/virnetdevtap.c| 113 ++--- src/util/virnetdevtap.h| 2 + .../qemuxml2argvdata/qemuxml2argv-vhost_queues.xml | 51 +++ tests/qemuxml2xmltest.c| 1 + 15 files changed, 593 insertions(+), 288 deletions(-) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-vhost_queues.xml -- 1.8.2.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCHv4 1/4] Introduce /domain/devices/interface/driver/@queues attribute
This attribute is going to represent number of queues for multique vhost network interface. This commit implements XML extension part of the feature and add one test as well. For now, we can only do xml2xml test as qemu command line generation code is not adapted yet. --- docs/formatdomain.html.in | 12 - docs/schemas/domaincommon.rng | 5 +++ src/conf/domain_conf.c | 15 +++ src/conf/domain_conf.h | 1 + .../qemuxml2argvdata/qemuxml2argv-vhost_queues.xml | 51 ++ tests/qemuxml2xmltest.c| 1 + 6 files changed, 84 insertions(+), 1 deletion(-) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-vhost_queues.xml diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index d9814dd..128e5b3 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -3265,7 +3265,7 @@ qemu-kvm -net nic,model=? /dev/null lt;source network='default'/gt; lt;target dev='vnet1'/gt; lt;model type='virtio'/gt; - blt;driver name='vhost' txmode='iothread' ioeventfd='on' event_idx='off'/gt;/b + blt;driver name='vhost' txmode='iothread' ioeventfd='on' event_idx='off' queues='5'/gt;/b lt;/interfacegt; lt;/devicesgt; .../pre @@ -3359,6 +3359,16 @@ qemu-kvm -net nic,model=? /dev/null bIn general you should leave this option alone, unless you are very certain you know what you are doing./b /dd + dtcodequeues/code/dt + dd +The optional codequeues/code attribute controls the number of +queues to be used for thea href=http://www.linux-kvm.org/page/Multiqueue; +Multiqueue virtio-net/a feature. If the interface has codelt;model +type='virtio'/gt;/code, multiple packet processing queues can be +created; each queue will potentially be handled by a different +processor, resulting in much higher throughput. +span class=sinceSince 1.0.6 (QEMU and KVM only)/span + /dd /dl h5a name=elementsNICSTargetOverrideOverriding the target element/a/h5 diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index b53099b..2190877 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -2013,6 +2013,11 @@ /attribute /optional optional +attribute name='queues' + ref name=positiveInteger/ +/attribute + /optional + optional attribute name=txmode choice valueiothread/value diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index e7a0381..17abbe5 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -5970,6 +5970,7 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt, char *txmode = NULL; char *ioeventfd = NULL; char *event_idx = NULL; +char *queues = NULL; char *filter = NULL; char *internal = NULL; char *devaddr = NULL; @@ -6081,6 +6082,7 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt, txmode = virXMLPropString(cur, txmode); ioeventfd = virXMLPropString(cur, ioeventfd); event_idx = virXMLPropString(cur, event_idx); +queues = virXMLPropString(cur, queues); } else if (xmlStrEqual(cur-name, BAD_CAST filterref)) { if (filter) { virReportError(VIR_ERR_XML_ERROR, %s, @@ -6371,6 +6373,16 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt, } def-driver.virtio.event_idx = idx; } +if (queues) { +unsigned int q; +if (virStrToLong_ui(queues, NULL, 10, q) 0) { +virReportError(VIR_ERR_XML_DETAIL, + _('queues' attribute must be positive number: %s), + queues); +goto error; +} +def-driver.virtio.queues = q; +} } def-linkstate = VIR_DOMAIN_NET_INTERFACE_LINK_STATE_DEFAULT; @@ -6424,6 +6436,7 @@ cleanup: VIR_FREE(txmode); VIR_FREE(ioeventfd); VIR_FREE(event_idx); +VIR_FREE(queues); VIR_FREE(filter); VIR_FREE(type); VIR_FREE(internal); @@ -14450,6 +14463,8 @@ virDomainNetDefFormat(virBufferPtr buf, virBufferAsprintf(buf, event_idx='%s', virDomainVirtioEventIdxTypeToString(def-driver.virtio.event_idx)); } +if (def-driver.virtio.queues) +virBufferAsprintf(buf, queues='%u', def-driver.virtio.queues); virBufferAddLit(buf, /\n); } } diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index e74da1c..167831c 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@
[libvirt] [PATCHv4 4/4] qemu: Enable multiqueue network
--- src/qemu/qemu_command.c | 36 src/qemu/qemu_hotplug.c | 37 ++--- 2 files changed, 54 insertions(+), 19 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 7059b08..0474670 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -6503,14 +6503,28 @@ qemuBuildInterfaceCommandLine(virCommandPtr cmd, if (!bootindex) bootindex = net-info.bootIndex; +/* Currently nothing else then TAP devices supports multiqueue. */ +if (net-driver.virtio.queues +!(actualType == VIR_DOMAIN_NET_TYPE_NETWORK || + actualType == VIR_DOMAIN_NET_TYPE_BRIDGE)) { +virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _(Multiqueue network is not supported for: %s), + virDomainNetTypeToString(actualType)); +return -1; +} + if (actualType == VIR_DOMAIN_NET_TYPE_NETWORK || actualType == VIR_DOMAIN_NET_TYPE_BRIDGE) { -if (VIR_ALLOC(tapfd) 0 || VIR_ALLOC(tapfdName) 0) { +tapfdSize = net-driver.virtio.queues; +if (!tapfdSize) +tapfdSize = 1; + +if (VIR_ALLOC_N(tapfd, tapfdSize) 0 || +VIR_ALLOC_N(tapfdName, tapfdSize) 0) { virReportOOMError(); goto cleanup; } -tapfdSize = 1; if (qemuNetworkIfaceConnect(def, conn, driver, net, qemuCaps, tapfd, tapfdSize) 0) goto cleanup; @@ -6532,11 +6546,15 @@ qemuBuildInterfaceCommandLine(virCommandPtr cmd, actualType == VIR_DOMAIN_NET_TYPE_DIRECT) { /* Attempt to use vhost-net mode for these types of network device */ -if (VIR_ALLOC(vhostfd) 0 || VIR_ALLOC(vhostfdName)) { +vhostfdSize = net-driver.virtio.queues; +if (!vhostfdSize) +vhostfdSize = 1; + +if (VIR_ALLOC_N(vhostfd, vhostfdSize) 0 || +VIR_ALLOC_N(vhostfdName, vhostfdSize)) { virReportOOMError(); goto cleanup; } -vhostfdSize = 1; if (qemuOpenVhostNet(def, net, qemuCaps, vhostfd, vhostfdSize) 0) goto cleanup; @@ -6600,15 +6618,17 @@ qemuBuildInterfaceCommandLine(virCommandPtr cmd, cleanup: if (ret 0) virDomainConfNWFilterTeardown(net); -for (i = 0; i tapfdSize; i++) { +for (i = 0; tapfd i tapfdSize; i++) { if (ret 0) VIR_FORCE_CLOSE(tapfd[i]); -VIR_FREE(tapfdName[i]); +if (tapfdName) +VIR_FREE(tapfdName[i]); } -for (i = 0; i vhostfdSize; i++) { +for (i = 0; vhostfd i vhostfdSize; i++) { if (ret 0) VIR_FORCE_CLOSE(vhostfd[i]); -VIR_FREE(vhostfdName[i]); +if (vhostfdName) +VIR_FREE(vhostfdName[i]); } VIR_FREE(tapfd); VIR_FREE(vhostfd); diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 7e50592..e7d200f 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -740,13 +740,26 @@ int qemuDomainAttachNetDevice(virConnectPtr conn, goto cleanup; } +/* Currently nothing else then TAP devices supports multiqueue. */ +if (net-driver.virtio.queues +!(actualType == VIR_DOMAIN_NET_TYPE_NETWORK || + actualType == VIR_DOMAIN_NET_TYPE_BRIDGE)) { +virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _(Multiqueue network is not supported for: %s), + virDomainNetTypeToString(actualType)); +return -1; +} + if (actualType == VIR_DOMAIN_NET_TYPE_BRIDGE || actualType == VIR_DOMAIN_NET_TYPE_NETWORK) { -if (VIR_ALLOC(tapfd) 0 || VIR_ALLOC(vhostfd) 0) { +tapfdSize = vhostfdSize = net-driver.virtio.queues; +if (!tapfdSize) +tapfdSize = vhostfdSize = 1; +if (VIR_ALLOC_N(tapfd, tapfdSize) 0 || +VIR_ALLOC_N(vhostfd, vhostfdSize) 0) { virReportOOMError(); goto cleanup; } -tapfdSize = vhostfdSize = 1; if (qemuNetworkIfaceConnect(vm-def, conn, driver, net, priv-qemuCaps, tapfd, tapfdSize) 0) goto cleanup; @@ -754,11 +767,11 @@ int qemuDomainAttachNetDevice(virConnectPtr conn, if (qemuOpenVhostNet(vm-def, net, priv-qemuCaps, vhostfd, vhostfdSize) 0) goto cleanup; } else if (actualType == VIR_DOMAIN_NET_TYPE_DIRECT) { +tapfdSize = vhostfdSize = 1; if (VIR_ALLOC(tapfd) 0 || VIR_ALLOC(vhostfd) 0) { virReportOOMError(); goto cleanup; } -tapfdSize = vhostfdSize = 1; if ((tapfd[0] = qemuPhysIfaceConnect(vm-def, driver, net, priv-qemuCaps, VIR_NETDEV_VPORT_PROFILE_OP_CREATE)) 0) @@ -767,11 +780,11 @@
Re: [libvirt] [PATCH] udev: should not list bridge devices
On 05/21/2013 09:28 AM, Guannan Ren wrote: When using udev backend, virsh iface-list outputs bridge devices like: Name State MAC Address em1 active e8:39:35:58:d5:94 lo active 00:00:00:00:00:00 virbr0 active fe:54:00:a5:f6:42 The patch filters out bridge devices. --- src/interface/interface_backend_udev.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/interface/interface_backend_udev.c b/src/interface/interface_backend_udev.c index 1fd7d46..92648e8 100644 --- a/src/interface/interface_backend_udev.c +++ b/src/interface/interface_backend_udev.c @@ -78,6 +78,9 @@ udevGetDevices(struct udev *udev, virUdevStatus status) /* Ignore devices that are part of a bridge */ udev_enumerate_add_nomatch_sysattr(enumerate, brport/state, NULL); +/* Ignore bridge devices */ +udev_enumerate_add_nomatch_sysattr(enumerate, bridge/bridge_id, NULL); + NACK. It should list bridge devices. What shouldn't be listed is *transient* interfaces (such as the bridge devices created by libvirt). This is a problem inherent in the design of the udev driver. It's examining the current state of the network system, while the original intent of libvirt's interface driver was really to examine/modify the persistent system config. I pointed this out to Doug at the time he added the udev driver, and he acknowledged the problem but couldn't think of a simple way to eliminate it, and it didn't seem serious enough to delay adding in the driver. -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCHv4 3/4] qemu: Adapt qemuBuildInterfaceCommandLine to to multiqueue net
In order to learn libvirt multiqueue several things must be done: 1) The '/dev/net/tun' device needs to be opened multiple times with IFF_MULTI_QUEUE flag passed to ioctl(fd, TUNSETIFF, ifr); 2) Similar, the '/dev/vhost-net' must be opened as many times as in 1) in order to keep 1:1 ratio recommended by qemu and kernel folks. 3) The command line construction code needs to switch from 'fd=X' to 'fds=X:Y:...:Z' and from 'vhostfd=X' to 'vhostfds=X:Y:...:Z'. 4) The monitor handling code needs to learn to pass multiple FDs. --- src/network/bridge_driver.c | 2 +- src/qemu/qemu_command.c | 260 ++-- src/qemu/qemu_command.h | 13 ++- src/qemu/qemu_hotplug.c | 98 - src/qemu/qemu_monitor.c | 78 +++-- src/qemu/qemu_monitor.h | 8 +- src/uml/uml_conf.c | 5 +- src/util/virnetdevtap.c | 113 ++- src/util/virnetdevtap.h | 2 + 9 files changed, 378 insertions(+), 201 deletions(-) diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c index 6c6ce6d..ad4ab00 100644 --- a/src/network/bridge_driver.c +++ b/src/network/bridge_driver.c @@ -2495,7 +2495,7 @@ networkStartNetworkVirtual(struct network_driver *driver, /* Keep tun fd open and interface up to allow for IPv6 DAD to happen */ if (virNetDevTapCreateInBridgePort(network-def-bridge, macTapIfName, network-def-mac, - NULL, tapfd, NULL, NULL, + NULL, tapfd, 1, NULL, NULL, VIR_NETDEV_TAP_CREATE_USE_MAC_FOR_BRIDGE | VIR_NETDEV_TAP_CREATE_IFUP | VIR_NETDEV_TAP_CREATE_PERSIST) 0) { diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 6f4028e..7059b08 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -281,11 +281,12 @@ qemuNetworkIfaceConnect(virDomainDefPtr def, virConnectPtr conn, virQEMUDriverPtr driver, virDomainNetDefPtr net, -virQEMUCapsPtr qemuCaps) +virQEMUCapsPtr qemuCaps, +int *tapfd, +int *tapfdSize) { char *brname = NULL; -int err; -int tapfd = -1; +int ret = -1; unsigned int tap_create_flags = VIR_NETDEV_TAP_CREATE_IFUP; bool template_ifname = false; int actualType = virDomainNetGetActualType(net); @@ -297,7 +298,7 @@ qemuNetworkIfaceConnect(virDomainDefPtr def, virNetworkPtr network = virNetworkLookupByName(conn, net-data.network.name); if (!network) -return -1; +return ret; active = virNetworkIsActive(network); if (active != 1) { @@ -322,18 +323,18 @@ qemuNetworkIfaceConnect(virDomainDefPtr def, virFreeError(errobj); if (fail) -return -1; +return ret; } else if (actualType == VIR_DOMAIN_NET_TYPE_BRIDGE) { if (!(brname = strdup(virDomainNetGetActualBridgeName(net { virReportOOMError(); -return -1; +return ret; } } else { virReportError(VIR_ERR_INTERNAL_ERROR, _(Network type %d is not supported), virDomainNetGetActualType(net)); -return -1; +return ret; } if (!net-ifname || @@ -353,69 +354,95 @@ qemuNetworkIfaceConnect(virDomainDefPtr def, tap_create_flags |= VIR_NETDEV_TAP_CREATE_VNET_HDR; } -if (cfg-privileged) -err = virNetDevTapCreateInBridgePort(brname, net-ifname, net-mac, - def-uuid, tapfd, - virDomainNetGetActualVirtPortProfile(net), - virDomainNetGetActualVlan(net), - tap_create_flags); -else -err = qemuCreateInBridgePortWithHelper(cfg, brname, - net-ifname, - tapfd, tap_create_flags); - -virDomainAuditNetDevice(def, net, /dev/net/tun, tapfd = 0); -if (err 0) { -if (template_ifname) -VIR_FREE(net-ifname); -tapfd = -1; +if (cfg-privileged) { +if (virNetDevTapCreateInBridgePort(brname, net-ifname, net-mac, + def-uuid, tapfd, *tapfdSize, + virDomainNetGetActualVirtPortProfile(net), + virDomainNetGetActualVlan(net), + tap_create_flags) 0) { +
Re: [libvirt] [PATCH] udev: should not list bridge devices
On 05/21/2013 10:09 PM, Laine Stump wrote: On 05/21/2013 09:28 AM, Guannan Ren wrote: When using udev backend, virsh iface-list outputs bridge devices like: Name State MAC Address em1 active e8:39:35:58:d5:94 lo active 00:00:00:00:00:00 virbr0 active fe:54:00:a5:f6:42 The patch filters out bridge devices. --- src/interface/interface_backend_udev.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/interface/interface_backend_udev.c b/src/interface/interface_backend_udev.c index 1fd7d46..92648e8 100644 --- a/src/interface/interface_backend_udev.c +++ b/src/interface/interface_backend_udev.c @@ -78,6 +78,9 @@ udevGetDevices(struct udev *udev, virUdevStatus status) /* Ignore devices that are part of a bridge */ udev_enumerate_add_nomatch_sysattr(enumerate, brport/state, NULL); +/* Ignore bridge devices */ +udev_enumerate_add_nomatch_sysattr(enumerate, bridge/bridge_id, NULL); + NACK. It should list bridge devices. What shouldn't be listed is *transient* interfaces (such as the bridge devices created by libvirt). This is a problem inherent in the design of the udev driver. It's examining the current state of the network system, while the original intent of libvirt's interface driver was really to examine/modify the persistent system config. Get it, if so, netcf does a right work. Thanks for this explanation. I pointed this out to Doug at the time he added the udev driver, and he acknowledged the problem but couldn't think of a simple way to eliminate it, and it didn't seem serious enough to delay adding in the driver. -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 0/3 v4] add 'sharePolicy' attribute for qemu vnc sharing policy
v3-v4 add missing .args, .xml files (I raw it in git Untracked files this morning and thought about it for a while, then git-cleaned them...) rebase work. v2-v3 rebase work. v1-v2: changed attribute name from 'policy' to 'sharePolicy' renamed caps flag name: QEMU_CAPS_VNC_SHARE_POLICY fixed issues pointed out in v1 review have to keep hard-coded version probe after checking qemu -help and qmp command. As there were some vnc patches recently, I chose do rebase work a little later. These patches try to add a new attribute 'sharePolicy' to element graphics of vnc type. This attribute has three values: allow-exclusive,force-shared and ignore. -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 3/3 v4] qemu: add ', share=policy' to qemu commandline
example: qemu ${otherargs} \ -vnc 127.0.0.1:0,share=allow-exclusive --- src/qemu/qemu_command.c| 36 ++ tests/qemuargv2xmltest.c | 1 + .../qemuxml2argv-graphics-vnc-policy.args | 4 +++ .../qemuxml2argv-graphics-vnc-policy.xml | 35 + tests/qemuxml2argvtest.c | 1 + 5 files changed, 77 insertions(+) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-policy.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-policy.xml diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 33a1910..1f7e717 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -6099,6 +6099,19 @@ qemuBuildGraphicsVNCCommandLine(virQEMUDriverConfigPtr cfg, virBufferAsprintf(opt, ,websocket=%d, graphics-data.vnc.websocket); } +if (graphics-data.vnc.sharePolicy) { +if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_VNC_SHARE_POLICY)) { +virReportError(VIR_ERR_CONFIG_UNSUPPORTED, %s, + _(vnc display sharing policy is not + supported with this QEMU)); +goto error; +} + +virBufferAsprintf(opt, ,share=%s, + virDomainGraphicsVNCSharePolicyTypeToString( + graphics-data.vnc.sharePolicy)); +} + if (graphics-data.vnc.auth.passwd || cfg-vncPassword) virBufferAddLit(opt, ,password); @@ -10030,6 +10043,29 @@ virDomainDefPtr qemuParseCommandLine(virCapsPtr qemuCaps, vnc-data.vnc.websocket = vnc-data.vnc.port + 5700; } +} else if (STRPREFIX(opts, share=)) { +char *sharePolicy = opts + strlen(share=); +if (sharePolicy *sharePolicy) { +int policy = + virDomainGraphicsVNCSharePolicyTypeFromString(sharePolicy); + +if (policy 0) { +virReportError(VIR_ERR_INTERNAL_ERROR, + _(unknown vnc display sharing policy '%s'), + sharePolicy); +virDomainGraphicsDefFree(vnc); +VIR_FREE(orig_opts); +goto error; +} else { +vnc-data.vnc.sharePolicy = policy; +} +} else { +virReportError(VIR_ERR_INTERNAL_ERROR, %s, + _(missing vnc sharing policy)); +virDomainGraphicsDefFree(vnc); +VIR_FREE(orig_opts); +goto error; +} } opts = nextopt; diff --git a/tests/qemuargv2xmltest.c b/tests/qemuargv2xmltest.c index 58fabdb..652cd09 100644 --- a/tests/qemuargv2xmltest.c +++ b/tests/qemuargv2xmltest.c @@ -201,6 +201,7 @@ mymain(void) DO_TEST(graphics-vnc); DO_TEST(graphics-vnc-socket); DO_TEST(graphics-vnc-websocket); +DO_TEST(graphics-vnc-policy); DO_TEST(graphics-vnc-sasl); DO_TEST(graphics-vnc-tls); diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-policy.args b/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-policy.args new file mode 100644 index 000..1b61fcf --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-policy.args @@ -0,0 +1,4 @@ +LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \ +/usr/bin/qemu -S -M pc -m 214 -smp 1 -monitor unix:/tmp/test-monitor,server,nowait \ +-no-acpi -boot c -usb -hda /dev/HostVG/QEMUGuest1 \ +-net none -serial none -parallel none -vnc 127.0.0.1:0,share=allow-exclusive diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-policy.xml b/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-policy.xml new file mode 100644 index 000..6c95c8a --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-policy.xml @@ -0,0 +1,35 @@ +domain type='qemu' + nameQEMUGuest1/name + uuidc7a5fdbd-edaf-9455-926a-d65c16db1809/uuid + memory unit='KiB'219100/memory + currentMemory unit='KiB'219100/currentMemory + vcpu placement='static'1/vcpu + os +type arch='i686' machine='pc'hvm/type +boot dev='hd'/ + /os + clock offset='utc'/ + on_poweroffdestroy/on_poweroff + on_rebootrestart/on_reboot + on_crashdestroy/on_crash + devices +emulator/usr/bin/qemu/emulator +disk
[libvirt] [PATCHv4 2/4] qemu: Move interface cmd line construction into a separate function
Currently, we have one huge function to construct qemu command line. This is very ineffective esp. if there's a fault somewhere. --- src/qemu/qemu_command.c | 224 +--- 1 file changed, 117 insertions(+), 107 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 33a1910..6f4028e 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -6406,6 +6406,117 @@ qemuBuildGraphicsCommandLine(virQEMUDriverConfigPtr cfg, return 0; } +static int +qemuBuildInterfaceCommandLine(virCommandPtr cmd, + virQEMUDriverPtr driver, + virConnectPtr conn, + virDomainDefPtr def, + virDomainNetDefPtr net, + virQEMUCapsPtr qemuCaps, + int vlan, + int bootindex, + enum virNetDevVPortProfileOp vmop) +{ +int ret = -1; +int tapfd = -1; +int vhostfd = -1; +char *nic = NULL, *host = NULL; +char *tapfdName = NULL; +char *vhostfdName = NULL; +int actualType = virDomainNetGetActualType(net); + +if (actualType == VIR_DOMAIN_NET_TYPE_HOSTDEV) { +/* NET_TYPE_HOSTDEV devices are really hostdev devices, so + * their commandlines are constructed with other hostdevs. + */ +return 0; +} + +if (!bootindex) +bootindex = net-info.bootIndex; + +if (actualType == VIR_DOMAIN_NET_TYPE_NETWORK || +actualType == VIR_DOMAIN_NET_TYPE_BRIDGE) { +tapfd = qemuNetworkIfaceConnect(def, conn, driver, net, qemuCaps); +if (tapfd 0) +goto cleanup; +} else if (actualType == VIR_DOMAIN_NET_TYPE_DIRECT) { +tapfd = qemuPhysIfaceConnect(def, driver, net, qemuCaps, vmop); +if (tapfd 0) +goto cleanup; +} + +if (actualType == VIR_DOMAIN_NET_TYPE_NETWORK || +actualType == VIR_DOMAIN_NET_TYPE_BRIDGE || +actualType == VIR_DOMAIN_NET_TYPE_ETHERNET || +actualType == VIR_DOMAIN_NET_TYPE_DIRECT) { +/* Attempt to use vhost-net mode for these types of + network device */ +if (qemuOpenVhostNet(def, net, qemuCaps, vhostfd) 0) +goto cleanup; +} + +if (tapfd = 0) { +virCommandTransferFD(cmd, tapfd); +if (virAsprintf(tapfdName, %d, tapfd) 0) { +virReportOOMError(); +goto cleanup; +} +} + +if (vhostfd = 0) { +virCommandTransferFD(cmd, vhostfd); +if (virAsprintf(vhostfdName, %d, vhostfd) 0) { +virReportOOMError(); +goto cleanup; +} +} + +/* Possible combinations: + * + * 1. Old way: -net nic,model=e1000,vlan=1 -net tap,vlan=1 + * 2. Semi-new: -device e1000,vlan=1-net tap,vlan=1 + * 3. Best way: -netdev type=tap,id=netdev1 -device e1000,id=netdev1 + * + * NB, no support for -netdev without use of -device + */ +if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_NETDEV) +virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) { +if (!(host = qemuBuildHostNetStr(net, driver, + ',', vlan, tapfdName, + vhostfdName))) +goto cleanup; +virCommandAddArgList(cmd, -netdev, host, NULL); +} +if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) { +if (!(nic = qemuBuildNicDevStr(net, vlan, bootindex, qemuCaps))) +goto cleanup; +virCommandAddArgList(cmd, -device, nic, NULL); +} else { +if (!(nic = qemuBuildNicStr(net, nic,, vlan))) +goto cleanup; +virCommandAddArgList(cmd, -net, nic, NULL); +} +if (!(virQEMUCapsGet(qemuCaps, QEMU_CAPS_NETDEV) + virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE))) { +if (!(host = qemuBuildHostNetStr(net, driver, + ',', vlan, tapfdName, + vhostfdName))) +goto cleanup; +virCommandAddArgList(cmd, -net, host, NULL); +} + +ret = 0; +cleanup: +if (ret 0) +virDomainConfNWFilterTeardown(net); +VIR_FREE(nic); +VIR_FREE(host); +VIR_FREE(tapfdName); +VIR_FREE(vhostfdName); +return ret; +} + qemuBuildCommandLineCallbacks buildCommandLineCallbacks = { .qemuGetSCSIDeviceSgName = virSCSIDeviceGetSgName, }; @@ -7344,118 +7455,17 @@ qemuBuildCommandLine(virConnectPtr conn, for (i = 0 ; i def-nnets ; i++) { virDomainNetDefPtr net = def-nets[i]; -char *nic, *host; -char tapfd_name[50] = ; -char vhostfd_name[50] = ; -int vlan; -int bootindex = bootNet; -int actualType = virDomainNetGetActualType(net); - -if (actualType == VIR_DOMAIN_NET_TYPE_HOSTDEV) { -
[libvirt] [PATCH 1/3 v4] qemu: new vnc display sharing policy caps flag
QEMU_CAPS_VNC_SHARE_POLICY (qemu = 1.1) --- src/qemu/qemu_capabilities.c | 7 ++- src/qemu/qemu_capabilities.h | 1 + tests/qemuhelptest.c | 9 ++--- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 82129a2..b13a5ab 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -231,6 +231,8 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST, vnc-websocket, drive-discard, mlock, + + vnc-share-policy, /* 150 */ ); struct _virQEMUCaps { @@ -1188,8 +1190,10 @@ virQEMUCapsComputeCmdFlags(const char *help, if (version = 11000) virQEMUCapsSet(qemuCaps, QEMU_CAPS_CPU_HOST); -if (version = 1001000) +if (version = 1001000) { virQEMUCapsSet(qemuCaps, QEMU_CAPS_IPV6_MIGRATION); +virQEMUCapsSet(qemuCaps, QEMU_CAPS_VNC_SHARE_POLICY); +} if (version = 1002000) virQEMUCapsSet(qemuCaps, QEMU_CAPS_DEVICE_VIDEO_PRIMARY); @@ -2433,6 +2437,7 @@ virQEMUCapsInitQMPBasic(virQEMUCapsPtr qemuCaps) virQEMUCapsSet(qemuCaps, QEMU_CAPS_IPV6_MIGRATION); virQEMUCapsSet(qemuCaps, QEMU_CAPS_MACHINE_OPT); virQEMUCapsSet(qemuCaps, QEMU_CAPS_DUMP_GUEST_CORE); +virQEMUCapsSet(qemuCaps, QEMU_CAPS_VNC_SHARE_POLICY); } /* Capabilities that are architecture depending diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index 117bf8a..90d08c6 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -188,6 +188,7 @@ enum virQEMUCapsFlags { QEMU_CAPS_VNC_WEBSOCKET = 147, /* -vnc x:y,websocket */ QEMU_CAPS_DRIVE_DISCARD = 148, /* -drive discard=off(ignore)|on(unmap) */ QEMU_CAPS_MLOCK = 149, /* -realtime mlock=on|off */ +QEMU_CAPS_VNC_SHARE_POLICY = 150, /* set display sharing policy */ QEMU_CAPS_LAST, /* this must always be the last item */ }; diff --git a/tests/qemuhelptest.c b/tests/qemuhelptest.c index f7f88d0..f6bf7dd 100644 --- a/tests/qemuhelptest.c +++ b/tests/qemuhelptest.c @@ -827,7 +827,8 @@ mymain(void) QEMU_CAPS_IPV6_MIGRATION, QEMU_CAPS_DEVICE_PCI_BRIDGE, QEMU_CAPS_DEVICE_SCSI_GENERIC, -QEMU_CAPS_DEVICE_SCSI_GENERIC_BOOTINDEX); +QEMU_CAPS_DEVICE_SCSI_GENERIC_BOOTINDEX, +QEMU_CAPS_VNC_SHARE_POLICY); DO_TEST(qemu-1.2.0, 1002000, 0, 0, QEMU_CAPS_VNC_COLON, QEMU_CAPS_NO_REBOOT, @@ -933,7 +934,8 @@ mymain(void) QEMU_CAPS_IPV6_MIGRATION, QEMU_CAPS_DEVICE_PCI_BRIDGE, QEMU_CAPS_DEVICE_SCSI_GENERIC, -QEMU_CAPS_DEVICE_SCSI_GENERIC_BOOTINDEX); +QEMU_CAPS_DEVICE_SCSI_GENERIC_BOOTINDEX, +QEMU_CAPS_VNC_SHARE_POLICY); DO_TEST(qemu-kvm-1.2.0, 1002000, 1, 0, QEMU_CAPS_VNC_COLON, QEMU_CAPS_NO_REBOOT, @@ -1044,7 +1046,8 @@ mymain(void) QEMU_CAPS_IPV6_MIGRATION, QEMU_CAPS_DEVICE_PCI_BRIDGE, QEMU_CAPS_DEVICE_SCSI_GENERIC, -QEMU_CAPS_DEVICE_SCSI_GENERIC_BOOTINDEX); +QEMU_CAPS_DEVICE_SCSI_GENERIC_BOOTINDEX, +QEMU_CAPS_VNC_SHARE_POLICY); return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE; } -- 1.8.1.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 2/3 v4] conf: add 'sharePolicy' attribute to graphics element for vnc
-vnc :5900,share=allow-exclusive allows clients to ask for exclusive access which is implemented by dropping other connections Connecting multiple clients in parallel requires all clients asking for a shared session (vncviewer: -shared switch) -vnc :5900,share=force-shared disables exclusive client access. Useful for shared desktop sessions, where you don't want someone forgetting specify -shared disconnect everybody else. -vnc :5900,share=ignore completely ignores the shared flag and allows everybody connect unconditionally --- docs/formatdomain.html.in | 13 +++-- docs/schemas/domaincommon.rng | 9 + src/conf/domain_conf.c| 28 src/conf/domain_conf.h| 11 +++ src/libvirt_private.syms | 2 ++ 5 files changed, 61 insertions(+), 2 deletions(-) diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index d9814dd..8c12690 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -3621,7 +3621,7 @@ qemu-kvm -net nic,model=? /dev/null ... lt;devicesgt; lt;graphics type='sdl' display=':0.0'/gt; -lt;graphics type='vnc' port='5904'gt; +lt;graphics type='vnc' port='5904' sharePolicy='allow-exclusive'gt; lt;listen type='address' address='1.2.3.4'/gt; lt;/graphicsgt; lt;graphics type='rdp' autoport='yes' multiUser='yes' /gt; @@ -3664,7 +3664,16 @@ qemu-kvm -net nic,model=? /dev/null allows control of connected client during password changes. VNC accepts codekeep/code value only. span class=sincesince 0.9.3/span -NB, this may not be supported by all hypervisors.br/ br/ +NB, this may not be supported by all hypervisors.br/ +The optional codesharePolicy/code attribute specifies vnc server +display sharing policy. allow-exclusive allows clients to ask +for exclusive access by dropping other connections. Connecting +multiple clients in parallel requires all clients asking for a +shared session (vncviewer: -Shared switch). This is the default +value. force-shared disables exclusive client access, every +connection has to specify -Shared switch for vncviewer. ignore +welcomes every connection unconditionally +span class=sincesince 1.0.6/span. br/ br/ Rather than using listen/port, QEMU supports a codesocket/code attribute for listening on a unix domain socket path.span class=sinceSince 0.8.8/span diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index b53099b..939654f 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -2135,6 +2135,15 @@ ref name=addrIPorName/ /attribute /optional + optional +attribute name='sharePolicy' + choice +valueallow-exclusive/value +valueforce-shared/value +valueignore/value + /choice +/attribute + /optional /group group optional diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index e7a0381..812a0d6 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -515,6 +515,13 @@ VIR_ENUM_IMPL(virDomainGraphicsAuthConnected, disconnect, keep) +VIR_ENUM_IMPL(virDomainGraphicsVNCSharePolicy, + VIR_DOMAIN_GRAPHICS_VNC_SHARE_LAST, + default, + allow-exclusive, + force-shared, + ignore) + VIR_ENUM_IMPL(virDomainGraphicsSpiceChannelName, VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_LAST, main, @@ -7703,6 +7710,7 @@ virDomainGraphicsDefParseXML(xmlNodePtr node, if (def-type == VIR_DOMAIN_GRAPHICS_TYPE_VNC) { char *port = virXMLPropString(node, port); char *websocket = virXMLPropString(node, websocket); +char *sharePolicy = virXMLPropString(node, sharePolicy); char *autoport; if (port) { @@ -7745,6 +7753,21 @@ virDomainGraphicsDefParseXML(xmlNodePtr node, VIR_FREE(websocket); } +if (sharePolicy) { +int policy = + virDomainGraphicsVNCSharePolicyTypeFromString(sharePolicy); + +if (policy 0) { +virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _(unknown vnc display sharing policy '%s'), sharePolicy); +VIR_FREE(sharePolicy); +goto error; +} else { +def-data.vnc.sharePolicy = policy; +} +VIR_FREE(sharePolicy); +} + def-data.vnc.socket = virXMLPropString(node, socket); def-data.vnc.keymap = virXMLPropString(node, keymap); @@ -15280,6 +15303,11 @@
Re: [libvirt] [PATCH] interface: list all interfaces with flags == 0
On 05/21/2013 06:49 AM, Guannan Ren wrote: Guannan's logic says when to drop: +if (MATCH(VIR_CONNECT_LIST_INTERFACES_FILTERS_ACTIVE) +!((MATCH(VIR_CONNECT_LIST_INTERFACES_ACTIVE) + (status NETCF_IFACE_ACTIVE)) || + (MATCH(VIR_CONNECT_LIST_INTERFACES_INACTIVE) + (status NETCF_IFACE_INACTIVE +continue; Jirka's logic says when to keep; so it would need a ! around the overall expression if we want to turn it into the condition that represents when to drop. if (!MATCH(VIR_CONNECT_LIST_INTERFACES_FILTERS_ACTIVE) || (MATCH(VIR_CONNECT_LIST_INTERFACES_ACTIVE) (status NETCF_IFACE_ACTIVE)) || (MATCH(VIR_CONNECT_LIST_INTERFACES_INACTIVE) (status NETCF_IFACE_INACTIVE))) yes, currently, there are only one group of flags with two values(active/inactive), the way of yours is better to read. if in future, there are more than one group of flags which are going to support, the way of my version will be better. Let's compare what happens for all four combinations of the two flags [active is flag 1, inactive is flag 2]: flags status Guannan's [0 means keep] Jirka's [1 means keep] 0 active 0!(0||0)=keep !0||0||0=keep 0 inactive 0!(0||0)=keep !0||0||0=keep 1 active 1!(1||0)=keep !1||1||0=keep 1 inactive 1!(0||0)=drop !1||0||0=drop 2 active 1!(0||0)=drop !1||0||0=drop 2 inactive 1!(0||1)=keep !1||0||1=keep 3 active 1!(1||0)=keep !1||1||0=keep 3 inactive 1!(0||1)=keep !1||0||1=keep Ultimately, the two expressions are equivalent (you can use deMorgan's law to prove the equivalence), but I find Jirka's positive logic a bit easier to reason with than Guannan's negative logic, even if Guannan's style copied from how we did it on other API. I do agree that for purposes of adding future filter groups, as well as minimizing nested conditionals, that the logic looks better in terms of drop checks: foreach item: if (filter group 1 drops) continue; if (filter group 2 drops) continue; item was kept by all filters, add it to return rather than logic in terms of keep checks: foreach item: if (filter group 1 keeps) if (filter group 2 keeps) add it to return -- Eric Blake eblake redhat com+1-919-301-3266 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH v2] interface: list all interfaces with flags == 0
On 05/21/2013 07:29 AM, Guannan Ren wrote: virConnectListAllInterfaces should support to list all of interfaces when the value of flags is 0. The behaviour is consistent with other virConnectListAll* APIs --- src/conf/interface_conf.h | 4 src/interface/interface_backend_netcf.c | 29 +++-- src/interface/interface_backend_udev.c | 25 - 3 files changed, 31 insertions(+), 27 deletions(-) ACK. -- Eric Blake eblake redhat com+1-919-301-3266 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 2/7] qemu: Abstract code for memory controller setting into a helper
On 05/20/2013 01:35 PM, Osier Yang wrote: (!virCgroupHasController(priv-cgroup,VIR_CGROUP_CONTROLLER_MEMORY)) { +if (vm-def-mem.hard_limit != 0 || +vm-def-mem.soft_limit != 0 || +vm-def-mem.swap_hard_limit != 0) { +virReportError(VIR_ERR_CONFIG_UNSUPPORTED, %s, + _(Memory cgroup is not available on this host)); +return -1; +} else { +VIR_WARN(Could not autoset a RSS limit for domain %s, vm-def-name); +return 0; +} Not sure why we need this VIR_WARN at all. If no limits are set in the XML, then we should not warn about a missing feature that we don't actually need. Agreed. Having a warning for no XML config is confused. I removed it. We may not need the warning, but the return 0 must stay. I can't start guests on my system with no memory controller after this commit. -- Mit freundlichen Grüßen/Kind Regards Viktor Mihajlovski IBM Deutschland Research Development GmbH Vorsitzender des Aufsichtsrats: Martina Köderitz Geschäftsführung: Dirk Wittkopp Sitz der Gesellschaft: Böblingen Registergericht: Amtsgericht Stuttgart, HRB 243294 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [Qemu-devel] [qemu-devel] Default machine type setting for ppc64
On 21/05/13 14:04, Anthony Liguori wrote: Daniel P. Berrange berra...@redhat.com writes: On Tue, May 21, 2013 at 07:55:27PM +1000, Paul Mackerras wrote: On Tue, May 21, 2013 at 09:39:53AM +0100, Daniel P. Berrange wrote: QEMU has the notion of a default machine for each target, and that is what libvirt uses if the user hasn't specified a machine. It is not libvirt's job to override QEMU's notion of the default machine here, so if the 'mac99' machine type isn't suitable as the default either QEMU needs to change that for the ppc target, or the user needs to explicitly specify their desired machine type. We are getting the default changed to 'pseries', at least for cases where pseries support is compiled in, which isn't necessarily always. That will of course not satisfy the Freescale guys. I think libvirt needs some more sensible way to ask qemu what its capabilities are. Currently it has no way to ask qemu what machines can you emulate with kvm acceleration? If the user has asked for a KVM domain then the default machine should be one that can be provided by KVM. At present it isn't, on PowerPC. If QEMU can provide more intelligent info in this respect, then libvirt can use it. We're doing the best we can with picking defaults given the info QEMU currently provides us. We've talked in the past about having an accelerator specific machine default. I think this is a perfectly reasonable thing to do and would solve the problem for ARM and for PPC. If we get such thing, then virtio-ccw might also be the right default for kvm on s390. Christian -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 2/7] qemu: Abstract code for memory controller setting into a helper
On 21/05/13 22:56, Viktor Mihajlovski wrote: On 05/20/2013 01:35 PM, Osier Yang wrote: (!virCgroupHasController(priv-cgroup,VIR_CGROUP_CONTROLLER_MEMORY)) { +if (vm-def-mem.hard_limit != 0 || +vm-def-mem.soft_limit != 0 || +vm-def-mem.swap_hard_limit != 0) { +virReportError(VIR_ERR_CONFIG_UNSUPPORTED, %s, + _(Memory cgroup is not available on this host)); +return -1; +} else { +VIR_WARN(Could not autoset a RSS limit for domain %s, vm-def-name); +return 0; +} Not sure why we need this VIR_WARN at all. If no limits are set in the XML, then we should not warn about a missing feature that we don't actually need. Agreed. Having a warning for no XML config is confused. I removed it. We may not need the warning, but the return 0 must stay. I can't start guests on my system with no memory controller after this commit. oops, I blindly removed it. Will fix soon. -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 2/7] qemu: Abstract code for memory controller setting into a helper
On Tue, May 21, 2013 at 04:56:37PM +0200, Viktor Mihajlovski wrote: On 05/20/2013 01:35 PM, Osier Yang wrote: (!virCgroupHasController(priv-cgroup,VIR_CGROUP_CONTROLLER_MEMORY)) { +if (vm-def-mem.hard_limit != 0 || +vm-def-mem.soft_limit != 0 || +vm-def-mem.swap_hard_limit != 0) { +virReportError(VIR_ERR_CONFIG_UNSUPPORTED, %s, + _(Memory cgroup is not available on this host)); +return -1; +} else { +VIR_WARN(Could not autoset a RSS limit for domain %s, vm-def-name); +return 0; +} Not sure why we need this VIR_WARN at all. If no limits are set in the XML, then we should not warn about a missing feature that we don't actually need. Agreed. Having a warning for no XML config is confused. I removed it. We may not need the warning, but the return 0 must stay. I can't start guests on my system with no memory controller after this commit. Yes, absolutely. I only suggested killing the warning, the 'return 0' must remain for sure. Daniel -- |: http://berrange.com -o-http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :| -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [Qemu-devel] [qemu-devel] Default machine type setting for ppc64
On 2013年05月21日 17:25, Daniel P. Berrange wrote: On Tue, May 21, 2013 at 05:02:51PM +0800, Li Zhang wrote: On 2013年05月21日 16:45, Peter Maydell wrote: On 21 May 2013 09:39, Daniel P. Berrange berra...@redhat.com wrote: Libvirt has always had support for specifying what machine type to use. This discussion is simply about what machine type to default to, if the user hasn't explicitly asked for one. QEMU has the notion of a default machine for each target, and that is what libvirt uses if the user hasn't specified a machine. It is not libvirt's job to override QEMU's notion of the default machine here, Agreed; thanks for the clarification. so if the 'mac99' machine type isn't suitable as the default either QEMU needs to change that for the ppc target, or the user needs to explicitly specify their desired machine type. OK, that makes sense. So is the problem here just configuration or is it the next layer above libvirt not being configurable? Currently, the next layer above libvirt is not configurable. It is dependent on this default setting. Users also expect to start one VM successfully by default. What is the application above libvirt you are using ? It clearly needs to be fixed if it is to use non-x86 archs successfully. Sorry for replying late. The applications are openstack and ovirt. Thanks. -- Li Daniel -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH] qemu: Don't remove the return 0
Commit f60a50c7957 intended to remove the warning only, but not with the return 0 together. --- src/qemu/qemu_cgroup.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c index ff9a075..fb88802 100644 --- a/src/qemu/qemu_cgroup.c +++ b/src/qemu/qemu_cgroup.c @@ -471,6 +471,8 @@ qemuSetupMemoryCgroup(virDomainObjPtr vm) virReportError(VIR_ERR_CONFIG_UNSUPPORTED, %s, _(Memory cgroup is not available on this host)); return -1; +} else { +return 0; } } -- 1.8.1.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] qemu: Don't remove the return 0
On 05/21/2013 09:04 AM, Osier Yang wrote: Commit f60a50c7957 intended to remove the warning only, but not with the return 0 together. --- src/qemu/qemu_cgroup.c | 2 ++ 1 file changed, 2 insertions(+) ACK. diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c index ff9a075..fb88802 100644 --- a/src/qemu/qemu_cgroup.c +++ b/src/qemu/qemu_cgroup.c @@ -471,6 +471,8 @@ qemuSetupMemoryCgroup(virDomainObjPtr vm) virReportError(VIR_ERR_CONFIG_UNSUPPORTED, %s, _(Memory cgroup is not available on this host)); return -1; +} else { +return 0; } } -- Eric Blake eblake redhat com+1-919-301-3266 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 02/31] src/libxl: Remove the whitespace before '; '
On 05/21/2013 04:00 AM, Osier Yang wrote: --- src/libxl/libxl_conf.c | 4 ++-- src/libxl/libxl_driver.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) ACK. -- Eric Blake eblake redhat com+1-919-301-3266 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] qemu: Don't remove the return 0
On Tue, May 21, 2013 at 11:04:36PM +0800, Osier Yang wrote: Commit f60a50c7957 intended to remove the warning only, but not with the return 0 together. --- src/qemu/qemu_cgroup.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c index ff9a075..fb88802 100644 --- a/src/qemu/qemu_cgroup.c +++ b/src/qemu/qemu_cgroup.c @@ -471,6 +471,8 @@ qemuSetupMemoryCgroup(virDomainObjPtr vm) virReportError(VIR_ERR_CONFIG_UNSUPPORTED, %s, _(Memory cgroup is not available on this host)); return -1; +} else { +return 0; } } ACK Daniel -- |: http://berrange.com -o-http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :| -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 03/31] src/conf: Remove the whitespace before '; '
On 05/21/2013 04:00 AM, Osier Yang wrote: --- src/conf/capabilities.c | 50 +- src/conf/cpu_conf.c | 14 +-- src/conf/domain_audit.c | 10 +- src/conf/domain_conf.c | 230 ++-- src/conf/domain_event.c | 32 +++--- src/conf/interface_conf.c | 8 +- src/conf/network_conf.c | 28 +++--- src/conf/node_device_conf.c | 12 +-- src/conf/nwfilter_conf.c| 8 +- src/conf/storage_conf.c | 8 +- 10 files changed, 200 insertions(+), 200 deletions(-) Longer, but still mechanical :) ACK. This is getting long; I'll do a bulk reply after reading through the next few patches. -- Eric Blake eblake redhat com+1-919-301-3266 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [Qemu-devel] [qemu-devel] Default machine type setting for ppc64
On 2013年05月21日 17:55, Paul Mackerras wrote: On Tue, May 21, 2013 at 09:39:53AM +0100, Daniel P. Berrange wrote: On Tue, May 21, 2013 at 09:31:26AM +0100, Peter Maydell wrote: On 21 May 2013 09:19, Li Zhang zhlci...@gmail.com wrote: We encounter this problem in openstack which always use default machine type. Currently, QEMU sets mac99 as default setting for ppc64 but it doesn't work on our platform at all. I tried to fix this in libvirt which it is not acceptable because libvirt only considers to get default setting from QEMU. This will need to be fixed for ARM -- the whole idea of there being a sensible default machine type and it being the one QEMU starts by default is pretty x86-centric. libvirt needs to have support for specifying which machine to use. Libvirt has always had support for specifying what machine type to use. This discussion is simply about what machine type to default to, if the user hasn't explicitly asked for one. So, the situation is that the XML in question has typehvm/type, in the os section. Does that say anything about what type of machine is being requested? Why is the machine type in the os section rather than the domain section? QEMU has the notion of a default machine for each target, and that is what libvirt uses if the user hasn't specified a machine. It is not libvirt's job to override QEMU's notion of the default machine here, so if the 'mac99' machine type isn't suitable as the default either QEMU needs to change that for the ppc target, or the user needs to explicitly specify their desired machine type. We are getting the default changed to 'pseries', at least for cases where pseries support is compiled in, which isn't necessarily always. That will of course not satisfy the Freescale guys. You are right. This default setting can't satisfy every platform. So it will needs management tool to add one machine type option, if it wants to support different machine types for ppc64. Thanks. :) I think libvirt needs some more sensible way to ask qemu what its capabilities are. Currently it has no way to ask qemu what machines can you emulate with kvm acceleration? If the user has asked for a KVM domain then the default machine should be one that can be provided by KVM. At present it isn't, on PowerPC. Paul. -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] qemu: Don't remove the return 0
On 21/05/13 23:07, Eric Blake wrote: On 05/21/2013 09:04 AM, Osier Yang wrote: Commit f60a50c7957 intended to remove the warning only, but not with the return 0 together. --- src/qemu/qemu_cgroup.c | 2 ++ 1 file changed, 2 insertions(+) ACK. Pushed, thanks. -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] two hostdev devices problem
On Tue, May 21, 2013 at 11:29:26AM -0400, Laine Stump wrote: On 05/21/2013 07:44 AM, Ján Tomko wrote: On 05/21/2013 01:37 PM, Laine Stump wrote: On 05/21/2013 04:03 AM, Ján Tomko wrote: On 05/21/2013 09:32 AM, Dominik Mostowiec wrote: hi, I try to add 2 VF by hostdev. Networks (vnet0, vnet1) with: forward mode='hostdev' managed='yes' pf dev='eth1'/ . Domain: interface type=network source network=vnet0/ interface type=network source network=vnet1/ virsh create error: error: internal error process exited while connecting to monitor: kvm: -device pci-assign,configfd=25,host=01:10.1,id=hostdev0,bus=pci.0,addr=0x4: Duplicate ID 'hostdev0' for device Hi, it seems we have been assigning the same id to all network hostdevs until this recent commit (not yet released): http://libvirt.org/git/?p=libvirt.git;a=commitdiff;h=6597cc25 If that patch has such an effect, it's purely accidental. Have you tested this? (I plan to test a before and after as soon as I've had breakfast) I haven't tested it and looking at the code again, I might've been wrong :( Sorry about that. Nothing to be sorry about even if you weren't right. And as it turns out you *were* right! I was curious why, so I tested with a 1.0.4 build running under gdb. The reason for the failure was that the person who wrote the code in qemuBuildCommandLine that called qemuAssignDeviceHostdevAlias() (as well as the person who reviewed that code, which would be me :-/) missed a detail of qemuAssignDeviceHostdevAlias() - it only searches for a free alias index if you send -1 as the index, otherwise it just uses the index you send. This is what was being called: qemuAssignDeviceHostdevAlias(def, hostdev, (def-nhostdevs-1)) So the first time def-nhostdevs-1 == -1, and a search would be made in the (empty) hostdevs array, resulting in an index of 0 being used. The second time it's called, def-nhostdevs-1 == 0, so it would just use 0 without even checking for a conflict. My patch for VFIO (the one Jan pointed out as being a fix) completely removed this code from qemuBuildCommandLine(), relying instead on the alias being assigned with all other aliases in qemuAssignDeviceAliases(). (I didn't do this on purpose to fix this bug though; I did it because the old code had become redundant). Anyway, thanks for being so observant. I otherwise would have wasted investigation time wondering why it wasn't broken for me. So the fact that we missed this suggests we have a gap in our XML-ARGV test coverage for host device assignment, right ? Daniel -- |: http://berrange.com -o-http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :| -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 30/31] nwfitler: Change the comment style
On 21/05/13 23:35, Eric Blake wrote: On 05/21/2013 04:01 AM, Osier Yang wrote: The more common habit is to add the comment after the statements. --- src/nwfilter/nwfilter_dhcpsnoop.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/nwfilter/nwfilter_dhcpsnoop.c b/src/nwfilter/nwfilter_dhcpsnoop.c index b9921e5..451c783 100644 --- a/src/nwfilter/nwfilter_dhcpsnoop.c +++ b/src/nwfilter/nwfilter_dhcpsnoop.c @@ -369,7 +369,7 @@ virNWFilterSnoopListAdd(virNWFilterSnoopIPLeasePtr plnew, for (pl = *end; pl plnew-timeout pl-timeout; pl = pl-prev) -/* empty */ ; +; /* empty */ How did you determine which style was more common? Do you have 'git grep | wc' numbers to back your claim? I guess putting the comment after makes it easier to avoid false positives in patch 31? Yes, you are right. :-) As far I saw when writing the script to exclude the empty statements, all other comments for an empty statements are after ; I did notice a couple of empty while loops in earlier patches (let me search for them again...) found it: patch 8/31. Reply coming up there, soon. ACK to all patches up to 30 where I didn't explicitly reply. Pushed 1 to 30. Thanks. Weak ack to this one (I don't care if it goes in, but I also don't mind if it gets omitted). I leave this one for more opinion, if there is no more opinion till tomorrow, will push it. -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 01/31] src/network: Remove the whitespace before '; '
On 05/21/2013 04:00 AM, Osier Yang wrote: --- src/network/bridge_driver.c | 22 +++--- 1 file changed, 11 insertions(+), 11 deletions(-) ACK. -- Eric Blake eblake redhat com+1-919-301-3266 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 08/31] src/phyp: Remove the whitespace before '; '
On 05/21/2013 04:00 AM, Osier Yang wrote: --- src/phyp/phyp_driver.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) ACK for being mechanical. However... diff --git a/src/phyp/phyp_driver.c b/src/phyp/phyp_driver.c index 4594cbf..70d3adb 100644 --- a/src/phyp/phyp_driver.c +++ b/src/phyp/phyp_driver.c @@ -1008,7 +1008,7 @@ connected: libssh2_session_set_blocking(session, 0); while ((rc = libssh2_session_startup(session, sock)) == - LIBSSH2_ERROR_EAGAIN) ; + LIBSSH2_ERROR_EAGAIN); My review of patch 30/31 made me revisit this patch. It has an empty while loop. Should we enforce a particular style where all empty-bodied loops should use a more obvious style to prove that we knew what we were doing? For example: while ((rc = libssh2_session_startup(session, sock)) == LIBSSH2_ERROR_EAGAIN) ; /* empty */ or while ((rc = libssh2_session_startup(session, sock)) == LIBSSH2_ERROR_EAGAIN) { /* empty */ } If so, how would we enforce such a style? -- Eric Blake eblake redhat com+1-919-301-3266 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 30/31] nwfitler: Change the comment style
s/nwfitler/nwfilter/ in the subject Jan -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 30/31] nwfitler: Change the comment style
On 05/21/2013 04:01 AM, Osier Yang wrote: The more common habit is to add the comment after the statements. --- src/nwfilter/nwfilter_dhcpsnoop.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/nwfilter/nwfilter_dhcpsnoop.c b/src/nwfilter/nwfilter_dhcpsnoop.c index b9921e5..451c783 100644 --- a/src/nwfilter/nwfilter_dhcpsnoop.c +++ b/src/nwfilter/nwfilter_dhcpsnoop.c @@ -369,7 +369,7 @@ virNWFilterSnoopListAdd(virNWFilterSnoopIPLeasePtr plnew, for (pl = *end; pl plnew-timeout pl-timeout; pl = pl-prev) -/* empty */ ; +; /* empty */ How did you determine which style was more common? Do you have 'git grep | wc' numbers to back your claim? I guess putting the comment after makes it easier to avoid false positives in patch 31? I did notice a couple of empty while loops in earlier patches (let me search for them again...) found it: patch 8/31. Reply coming up there, soon. ACK to all patches up to 30 where I didn't explicitly reply. Weak ack to this one (I don't care if it goes in, but I also don't mind if it gets omitted). -- Eric Blake eblake redhat com+1-919-301-3266 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list