[libvirt] [libivrt][RFC]Send "netdev_del" command after receive the DEVICE_DELETED event
Hi all: There maybe a bug about detaching virtual net device(such as virtio nic、 RTL8138、E1000)。 When live detaching the net device, there are some problems: (1)If the Guest OS don't support the hot plugging pci device, detach the virtual network device by Libvirt, the "net device" in Qemu will still exist, but "hostnet"(tap) in Qemu will be removed. so the net device in Guest OS will be of no effect. (2)If reject the nic in Guest OS, Qemu will remove the "net device", then Qemu send DEVICE_DELETED to Libvirt, Libvirt receive the event in event-loop thread and release info of the net device in qemuDomainRemoveNetDevice func. but "hostnet" in Qemu still exist. So next live attaching virtual net device will be failed because of "Duplicate ID". #virsh attach-device win2008_st_r2_64 net.xml --live error: Failed to attach device from net.xml error: internal error: unable to execute QEMU command 'netdev_add': Duplicate ID 'hostnet0' for netdev (3)In addition, in qemuDomainDetachNetDevice, detach net device func, "netdev_del" command will be sent after sending "device_del" command at once. So it is violent to remove the tap device before the net device is completely removed. So I think it's more logical that doing the work of sending Qemu command "netdev_del" after receive the DEVICE_DELETED event. It can avoid the conflict of device info between Libvirt side and Qemu side. I create a thread in qemuDomainRemoveDevice,the handle of DEVICE_DELETED event, to execute QEMU command "netdev_del". But I find there is another problem when sending monitor msg in multiply threads. in "qemuMonitorSend", monitor lock maybe unlocked and locked, so another thread has the opportunity to get the monitor lock, and use the same monitor. It will occur error. I wonder if it is workable that sending "netdev_del" command after receive the DEVICE_DELETED event. Thanks. -xie -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [libvirt-java] [PATCH] Set Java source level in pom
On 03/25/2014 10:19 PM, Eric Blake wrote: > On 03/25/2014 09:29 PM, Chris Ellis wrote: >> Hi >> >> Simple patch to set the Java source level within the pom, this makes it >> easier to import the project into Eclipse. I've also added an ignore for >> a local pom file. >> >> I've added plugins to publish the sources and javadocs into Maven. This >> allows Maven (and IDE integration) to automatically use the javadocs and >> source. This should make life easier for users of libvirt-java. >> >> Regards, >> Chris >> >> Chris Ellis (1): >> Update pom to include Java source level >> >> .gitignore | 1 + >> pom.xml.in | 41 + >> 2 files changed, 42 insertions(+) >> > > There was no patch accompanying this diffstat. See what the archives > saw: https://www.redhat.com/archives/libvir-list/2014-March/msg01591.html > > You might want to try sending again :) Ah, I see it now: https://www.redhat.com/archives/libvir-list/2014-March/msg01593.html Usually git numbers a cover letter as 0/N to make it obvious it is a cover; also, a cover letter isn't necessary when sending a single patch. At any rate, I'll leave the actual patch review up to someone more familiar with Maven. -- 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
[libvirt] [libvirt-java] [PATCH] Update pom to include Java source level
Update the pom to set the Java source level. This enables Eclipse to correctly configure itself. Also include plugins to publish the source and javadocs vai Maven. Update .gitignore to exclude a local pom. --- .gitignore | 1 + pom.xml.in | 41 + 2 files changed, 42 insertions(+) diff --git a/.gitignore b/.gitignore index 28ddc6e..cbc1cf6 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,5 @@ .settings target README +pom.xml diff --git a/pom.xml.in b/pom.xml.in index 4f49a3a..fd743ad 100644 --- a/pom.xml.in +++ b/pom.xml.in @@ -30,6 +30,47 @@ [3.4.1,4.0.0] + + + + +org.apache.maven.plugins +maven-compiler-plugin + +1.6 +1.5 + + + +org.apache.maven.plugins +maven-source-plugin + + +package-source +package + +jar + + + + + + + +org.apache.maven.plugins +maven-javadoc-plugin + + +package-javadocs +package + +jar + + + + + + -- 1.8.4.5 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [libvirt-java] [PATCH] Set Java source level in pom
On 03/25/2014 09:29 PM, Chris Ellis wrote: > Hi > > Simple patch to set the Java source level within the pom, this makes it > easier to import the project into Eclipse. I've also added an ignore for > a local pom file. > > I've added plugins to publish the sources and javadocs into Maven. This > allows Maven (and IDE integration) to automatically use the javadocs and > source. This should make life easier for users of libvirt-java. > > Regards, > Chris > > Chris Ellis (1): > Update pom to include Java source level > > .gitignore | 1 + > pom.xml.in | 41 + > 2 files changed, 42 insertions(+) > There was no patch accompanying this diffstat. See what the archives saw: https://www.redhat.com/archives/libvir-list/2014-March/msg01591.html You might want to try sending again :) -- 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
[libvirt] [libvirt-java] [PATCH] Set Java source level in pom
Hi Simple patch to set the Java source level within the pom, this makes it easier to import the project into Eclipse. I've also added an ignore for a local pom file. I've added plugins to publish the sources and javadocs into Maven. This allows Maven (and IDE integration) to automatically use the javadocs and source. This should make life easier for users of libvirt-java. Regards, Chris Chris Ellis (1): Update pom to include Java source level .gitignore | 1 + pom.xml.in | 41 + 2 files changed, 42 insertions(+) -- 1.8.4.5 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 1/2] Add close listener types
--- src/main/java/org/libvirt/event/ConnectionCloseListener.java | 9 + src/main/java/org/libvirt/event/ConnectionCloseReason.java | 8 2 files changed, 17 insertions(+) create mode 100644 src/main/java/org/libvirt/event/ConnectionCloseListener.java create mode 100644 src/main/java/org/libvirt/event/ConnectionCloseReason.java diff --git a/src/main/java/org/libvirt/event/ConnectionCloseListener.java b/src/main/java/org/libvirt/event/ConnectionCloseListener.java new file mode 100644 index 000..f6e8973 --- /dev/null +++ b/src/main/java/org/libvirt/event/ConnectionCloseListener.java @@ -0,0 +1,9 @@ +package org.libvirt.event; + +import org.libvirt.Connect; + +public interface ConnectionCloseListener extends EventListener { + +void onClose(Connect connection, ConnectionCloseReason reason); + +} diff --git a/src/main/java/org/libvirt/event/ConnectionCloseReason.java b/src/main/java/org/libvirt/event/ConnectionCloseReason.java new file mode 100644 index 000..0e94452 --- /dev/null +++ b/src/main/java/org/libvirt/event/ConnectionCloseReason.java @@ -0,0 +1,8 @@ +package org.libvirt.event; + +public enum ConnectionCloseReason { +VIR_CONNECT_CLOSE_REASON_ERROR, +VIR_CONNECT_CLOSE_REASON_EOF, +VIR_CONNECT_CLOSE_REASON_KEEPALIVE, +VIR_CONNECT_CLOSE_REASON_CLIENT; +} -- 1.8.4.5 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [libvirt-java] [PATCH 0/2] Ensure JNA callbacks cannot be GCed
Hi. This is a small patch set to fix a few issues I've discovered while testing Claudio's patch set. The first patch is trivial, it adds the ConnectionCloseListener interface and corresponding enum, which were missing. The second patch ensures that the JNA callbacks cannot be garbage collected whilst still registered with the libvirt C library. Durring testing, I was finding that events would stop working. Wireshark showed the remote daemon sending the event and some time spent tracing through the libvirt calls led me to discover that the JNA callback objects were being GCed. The JNA documentation states that a reference to the Callback object must be held whilst it is in use by the C layer. This patch updates the map of event listeners to also hold a reference to the callback object. Regards, Chris Chris Ellis (2): Add close listener types Ensure JNA callbacks cannot get GCed src/main/java/org/libvirt/Connect.java | 37 ++ .../org/libvirt/event/ConnectionCloseListener.java | 9 ++ .../org/libvirt/event/ConnectionCloseReason.java | 8 + 3 files changed, 41 insertions(+), 13 deletions(-) create mode 100644 src/main/java/org/libvirt/event/ConnectionCloseListener.java create mode 100644 src/main/java/org/libvirt/event/ConnectionCloseReason.java -- 1.8.4.5 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 2/2] Ensure JNA callbacks cannot get GCed
Currently nothing prevents the JNA callback objects used when registering for domain events from being garbage collected. JNA requires that callback objects are not GCed whilst they are in use by C code. To solve this we hold a reference to the callback alongside the callback id. This ensures that the JNA callback objects will retain in memory while it is registered with the C layer. We also use an IdentityHashMap rather than a HashMap to store the EventListener objects. --- src/main/java/org/libvirt/Connect.java | 37 ++ 1 file changed, 24 insertions(+), 13 deletions(-) diff --git a/src/main/java/org/libvirt/Connect.java b/src/main/java/org/libvirt/Connect.java index 43909f4..7a5904d 100644 --- a/src/main/java/org/libvirt/Connect.java +++ b/src/main/java/org/libvirt/Connect.java @@ -41,8 +41,21 @@ import com.sun.jna.ptr.LongByReference; public class Connect { // registered event listeners by DomainEventID -private Map[] eventListeners = makeHashMapArray(DomainEventID.LAST); - +private Map[] eventListeners = makeHashMapArray(DomainEventID.LAST); + +private class RegisteredEventListener { + +public final int callbackId; + +// We need to keep a reference to the callback to prevent it from being GCed +@SuppressWarnings("unused") +public final Libvirt.VirDomainEventCallback callback; + +public RegisteredEventListener(Libvirt.VirDomainEventCallback callback, int callbackId) { +this.callback = callback; +this.callbackId = callbackId; +} +} @SuppressWarnings("unchecked") private static HashMap[] makeHashMapArray(int size) { return new HashMap[size]; @@ -517,35 +530,33 @@ public class Connect { if (l == null) return; -Map handlers = eventListeners[eventID]; +Map handlers = eventListeners[eventID]; if (handlers == null) return; -Integer listenerID = handlers.remove(l); +RegisteredEventListener listenerID = handlers.remove(l); if (listenerID != null) -processError(libvirt.virConnectDomainEventDeregisterAny(VCP, listenerID)); +processError(libvirt.virConnectDomainEventDeregisterAny(VCP, listenerID.callbackId)); } private void domainEventRegister(Domain domain, int eventID, Libvirt.VirDomainEventCallback cb, EventListener l) throws LibvirtException { -Map handlers = eventListeners[eventID]; +Map handlers = eventListeners[eventID]; if (handlers == null) { -handlers = new HashMap(); +handlers = new HashMap(); eventListeners[eventID] = handlers; } else if (handlers.containsKey(l)) { return; } DomainPointer ptr = domain == null ? null : domain.VDP; - -int ret = processError(libvirt.virConnectDomainEventRegisterAny(VCP, ptr, - eventID, cb, -null, null)); - -handlers.put(l, ret); +int ret = processError(libvirt.virConnectDomainEventRegisterAny(VCP, ptr, eventID, cb, null, null)); +// track the handler +// Note: it is important that the callback does not get GCed +handlers.put(l, new RegisteredEventListener(cb, ret)); } void domainEventRegister(Domain domain, final IOErrorListener cb) throws LibvirtException { -- 1.8.4.5 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH v2] Fix apparmor profile to make vfio pci passthrough work
Quoting Cedric Bosdonnat (cbosdon...@suse.com): > On Tue, 2014-03-25 at 10:40 -0500, Serge Hallyn wrote: > > Quoting Cédric Bosdonnat (cbosdon...@suse.com): > > > See lp#1276719 for the bug description. As virt-aa-helper doesn't know > > > the VFIO groups to use for the guest, allow access to all > > > /dev/vfio/[0-9]* and /dev/vfio/vfio files if there is a potential need > > > for vfio > > > --- > > > > Thanks, Cédric! Looks good to me. Still needs a signed-off-by from you > > (I assume), but > > > > Acked-by: Serge E. Hallyn > > I wasn't aware I needed to sign-off my patches, but I can resubmit with > it ;) Actually it looks like I'm wrong, libvirt doesn't require them: http://libvirt.org/hacking.html (point 3) I've pushed this patch to ppa:ubuntu-virt/candidate, which is meant to go into trusty when qemu 2.0 is released. thanks, -serge -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 0/3] Resolve recent/new Coverity warnings
On 03/25/2014 02:00 PM, John Ferlan wrote: > For virlog.c and commandtest.c - it seems recent changes within the > modules have allowed Coverity to dig deeper and find different issues. > Not sure why Coverity has that "ability"... Since I was making changes, > figured I'd clean up the lxc_controller fd leak as well - these should > clean the Jenkins build environment. > > John Ferlan (3): > Coverity: Resolve a CHECKED_RETURN message > Coverity: Resolve a FORWARD_NULL > Coverity: Resolve a RESOURCE_LEAK > > src/lxc/lxc_controller.c | 14 ++ > src/util/virlog.c| 2 +- > tests/commandtest.c | 1 + > 3 files changed, 12 insertions(+), 5 deletions(-) > Pushed I did change 3/3 to use (ret < 0), my brain was just copying what it saw in virFileLoopDeviceAssociate() Tks, John -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH v2] Fix apparmor profile to make vfio pci passthrough work
On Tue, 2014-03-25 at 10:40 -0500, Serge Hallyn wrote: > Quoting Cédric Bosdonnat (cbosdon...@suse.com): > > See lp#1276719 for the bug description. As virt-aa-helper doesn't know > > the VFIO groups to use for the guest, allow access to all > > /dev/vfio/[0-9]* and /dev/vfio/vfio files if there is a potential need > > for vfio > > --- > > Thanks, Cédric! Looks good to me. Still needs a signed-off-by from you > (I assume), but > > Acked-by: Serge E. Hallyn I wasn't aware I needed to sign-off my patches, but I can resubmit with it ;) -- Cedric -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH python 0/4] setup.py: Don't unconditionally run pkg-config
On 03/25/2014 04:54 PM, Eric Blake wrote: > On 03/25/2014 11:39 AM, Cole Robinson wrote: >> This series reorganizes setup.py to not unconditionally call >> pkg-config. This will allow 'setup.py clean' and 'setup.py --help' >> to work correctly even if pkg-config or libvirt-devel aren't installed. >> >> https://bugzilla.redhat.com/show_bug.cgi?id=1074170 > > ACK series. Thanks, pushed now. - Cole -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 3/3] Coverity: Resolve a RESOURCE_LEAK
On 03/25/2014 12:00 PM, John Ferlan wrote: > On error the lofd would have been leaked. > > Signed-off-by: John Ferlan > --- > src/lxc/lxc_controller.c | 14 ++ > 1 file changed, 10 insertions(+), 4 deletions(-) > > + > + cleanup: > VIR_FREE(loname); > +if (ret == -1) I might have written 'if (ret < 0)' as that is slightly faster on many machines, but what you have works. 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: remove redundant virQEMUDriverGetConfig
On 03/25/2014 02:37 PM, Tomoki Sekiyama wrote: > qemuDomainSetSchedulerParametersFlags() calls virQEMUDriverGetConfig() twice > and makes the reference counter leak. This removes redundant call. > --- > src/qemu/qemu_driver.c |1 - > 1 file changed, 1 deletion(-) ACK and pushed. Problem introduced in commit 45ad1ad (thankfully unreleased). -- 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/3] Coverity: Resolve a FORWARD_NULL
On 03/25/2014 12:00 PM, John Ferlan wrote: > Recent changes in the module seemed to have caused Coverity to reanalyze > certain parts of the code. Previously the code was modified via commit > id '11a11812' to resolve a different error (perhaps DEADCODE). Up through > commit id '7b3f1f8c' there were no issues. > > The new error indicats the 'outbuf' was checked for NULL and then complains > because of the dereference. Adding checks for non-NULL prior to the deref > resulted in a DEADCODE message. > > So, resolve using an sa_assert() to keep Coverity quiet especially since > it doesn't understand that outbuf will change as a result of a successful > virCommandRun() call. > > Signed-off-by: John Ferlan > --- > tests/commandtest.c | 1 + > 1 file changed, 1 insertion(+) ACK > > diff --git a/tests/commandtest.c b/tests/commandtest.c > index c5c3a9a..7d2161c 100644 > --- a/tests/commandtest.c > +++ b/tests/commandtest.c > @@ -690,6 +690,7 @@ static int test17(const void *unused ATTRIBUTE_UNUSED) > goto cleanup; > } > > +sa_assert(outbuf); > if (*outbuf) { > puts("output buffer is not an allocated empty string"); > goto cleanup; > -- 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 1/3] Coverity: Resolve a CHECKED_RETURN message
On 03/25/2014 12:00 PM, John Ferlan wrote: > Recent changes to the module seemed to have caused Coverity to find a new > issue regarding the failure to check the return from a sendmsg. The code > doesn't seem to care about the return status, so just added an ignore_value > to keep Coverity quiet. > > Signed-off-by: John Ferlan > --- > src/util/virlog.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) ACK - logging is one of the few places where we don't care if the sendmsg succeeded (what are we going to do if it failed - log a failure message through the failed interface? :) > > diff --git a/src/util/virlog.c b/src/util/virlog.c > index d0afd10..056950e 100644 > --- a/src/util/virlog.c > +++ b/src/util/virlog.c > @@ -1003,7 +1003,7 @@ virLogOutputToJournald(virLogSourcePtr source, > > mh.msg_controllen = cmsg->cmsg_len; > > -sendmsg(journalfd, &mh, MSG_NOSIGNAL); > +ignore_value(sendmsg(journalfd, &mh, MSG_NOSIGNAL)); > > cleanup: > VIR_LOG_CLOSE(buffd); > -- 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 python 0/4] setup.py: Don't unconditionally run pkg-config
On 03/25/2014 11:39 AM, Cole Robinson wrote: > This series reorganizes setup.py to not unconditionally call > pkg-config. This will allow 'setup.py clean' and 'setup.py --help' > to work correctly even if pkg-config or libvirt-devel aren't installed. > > https://bugzilla.redhat.com/show_bug.cgi?id=1074170 ACK series. > > Cole Robinson (4): > setup.py: Remove unused import > setup.py: Move module list building to its own function > setup.py: Make have_libvirt_lxc a function > setup.py: Allow running --help or clean without pkg-config > > setup.py | 144 > +-- > 1 file changed, 85 insertions(+), 59 deletions(-) > -- 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] libvirt-tck: 052-domain-hook.t - reload after hook cleanup
I just realized this was never reviewed/commented on. Without this patch, libvirtd is left in a state where future tests expect hooks to exist, but the hooks themselves are removed in $hook->cleanup. The subsequent 'hook files not found' errors cause the tests to fail. -Mike On Thursday, March 06, 2014 03:41:01 PM Mike Latimer wrote: > Reload libvirtd after hook testing has completed. Otherwise, libvirtd > is still expecting hook test scripts to exist. > > --- > scripts/hooks/052-domain-hook.t | 4 > 1 file changed, 4 insertions(+) > > diff --git a/scripts/hooks/052-domain-hook.t > b/scripts/hooks/052-domain-hook.t index 90b8a48..d1070b5 100644 > --- a/scripts/hooks/052-domain-hook.t > +++ b/scripts/hooks/052-domain-hook.t > @@ -180,4 +180,8 @@ SKIP: { > Sys::Virt::Error::ERR_NO_DOMAIN); > > $hook->cleanup(); > + > +diag "reload libvirtd after hook cleanup"; > +$hook->action('reload'); > +$hook->service_libvirtd(); > }; -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH] qemu: remove redundant virQEMUDriverGetConfig
qemuDomainSetSchedulerParametersFlags() calls virQEMUDriverGetConfig() twice and makes the reference counter leak. This removes redundant call. --- src/qemu/qemu_driver.c |1 - 1 file changed, 1 deletion(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 76f789e..ca971f3 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -9050,7 +9050,6 @@ qemuDomainSetSchedulerParametersFlags(virDomainPtr dom, if (virDomainSetSchedulerParametersFlagsEnsureACL(dom->conn, vm->def, flags) < 0) goto cleanup; -cfg = virQEMUDriverGetConfig(driver); if (!cfg->privileged) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("CPU tuning is not available in session mode")); -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH] maint: ensure src/ directory includes are clean
In 'make syntax-check', we have a rule that prevents layering violations between the various files in src. However, we forgot to treat conf/ and the more recently-added access/ as lower-level directories, and were not detecting cases where they might have used a driver file. Also, it's not nice that qemu can use storage/ but none of the other drivers could do so. * cfg.mk (sc_prohibit_cross_inclusion): Tighten rules for conf/ and access/, let all other drivers use storage/. Signed-off-by: Eric Blake --- I noticed this because of my work on domain_conf.h: I want to share a struct between util/virstoragefile and conf/domain_conf, and ran into a syntax check when I tried to make util/ depend on conf/. I fixed things to obey layering with conf/ depending on util/, but in the process noticed that some layering violations went undetected. cfg.mk | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/cfg.mk b/cfg.mk index a4ae978..19537cf 100644 --- a/cfg.mk +++ b/cfg.mk @@ -760,17 +760,17 @@ sc_prohibit_gettext_markup: # lower-level code must not include higher-level headers. cross_dirs=$(patsubst $(srcdir)/src/%.,%,$(wildcard $(srcdir)/src/*/.)) cross_dirs_re=($(subst / ,/|,$(cross_dirs))) +mid_dirs=access|conf|cpu|locking|network|node_device|rpc|security|storage sc_prohibit_cross_inclusion: @for dir in $(cross_dirs); do \ case $$dir in \ util/) safe="util";;\ - locking/) \ - safe="($$dir|util|conf|rpc)";;\ - cpu/ | locking/ | network/ | rpc/ | security/) \ + access/ | conf/) safe="($$dir|conf|util)";; \ + locking/) safe="($$dir|util|conf|rpc)";;\ + cpu/| network/| node_device/| rpc/| security/| storage/)\ safe="($$dir|util|conf)";;\ xenapi/ | xenxs/ ) safe="($$dir|util|conf|xen)";; \ - qemu/ ) safe="($$dir|util|conf|cpu|network|locking|rpc|security|storage)";; \ - *) safe="($$dir|util|conf|cpu|network|locking|rpc|security)";; \ + *) safe="($$dir|$(mid_dirs)|util)";;\ esac; \ in_vc_files="^src/$$dir" \ prohibit='^# *include .$(cross_dirs_re)' \ -- 1.8.5.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 3/3] Coverity: Resolve a RESOURCE_LEAK
On error the lofd would have been leaked. Signed-off-by: John Ferlan --- src/lxc/lxc_controller.c | 14 ++ 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/lxc/lxc_controller.c b/src/lxc/lxc_controller.c index 800a306..928a43d 100644 --- a/src/lxc/lxc_controller.c +++ b/src/lxc/lxc_controller.c @@ -383,6 +383,7 @@ static int virLXCControllerSetupLoopDeviceDisk(virDomainDiskDefPtr disk) int lofd; char *loname = NULL; const char *src = virDomainDiskGetSource(disk); +int ret = -1; if ((lofd = virFileLoopDeviceAssociate(src, &loname)) < 0) return -1; @@ -395,13 +396,18 @@ static int virLXCControllerSetupLoopDeviceDisk(virDomainDiskDefPtr disk) * the rest of container setup 'just works' */ virDomainDiskSetType(disk, VIR_DOMAIN_DISK_TYPE_BLOCK); -if (virDomainDiskSetSource(disk, loname) < 0) { -VIR_FREE(loname); -return -1; -} +if (virDomainDiskSetSource(disk, loname) < 0) +goto cleanup; + +ret = 0; + + cleanup: VIR_FREE(loname); +if (ret == -1) + VIR_FORCE_CLOSE(lofd); return lofd; + } -- 1.8.5.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 0/3] Resolve recent/new Coverity warnings
For virlog.c and commandtest.c - it seems recent changes within the modules have allowed Coverity to dig deeper and find different issues. Not sure why Coverity has that "ability"... Since I was making changes, figured I'd clean up the lxc_controller fd leak as well - these should clean the Jenkins build environment. John Ferlan (3): Coverity: Resolve a CHECKED_RETURN message Coverity: Resolve a FORWARD_NULL Coverity: Resolve a RESOURCE_LEAK src/lxc/lxc_controller.c | 14 ++ src/util/virlog.c| 2 +- tests/commandtest.c | 1 + 3 files changed, 12 insertions(+), 5 deletions(-) -- 1.8.5.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 1/3] Coverity: Resolve a CHECKED_RETURN message
Recent changes to the module seemed to have caused Coverity to find a new issue regarding the failure to check the return from a sendmsg. The code doesn't seem to care about the return status, so just added an ignore_value to keep Coverity quiet. Signed-off-by: John Ferlan --- src/util/virlog.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/virlog.c b/src/util/virlog.c index d0afd10..056950e 100644 --- a/src/util/virlog.c +++ b/src/util/virlog.c @@ -1003,7 +1003,7 @@ virLogOutputToJournald(virLogSourcePtr source, mh.msg_controllen = cmsg->cmsg_len; -sendmsg(journalfd, &mh, MSG_NOSIGNAL); +ignore_value(sendmsg(journalfd, &mh, MSG_NOSIGNAL)); cleanup: VIR_LOG_CLOSE(buffd); -- 1.8.5.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 2/3] Coverity: Resolve a FORWARD_NULL
Recent changes in the module seemed to have caused Coverity to reanalyze certain parts of the code. Previously the code was modified via commit id '11a11812' to resolve a different error (perhaps DEADCODE). Up through commit id '7b3f1f8c' there were no issues. The new error indicats the 'outbuf' was checked for NULL and then complains because of the dereference. Adding checks for non-NULL prior to the deref resulted in a DEADCODE message. So, resolve using an sa_assert() to keep Coverity quiet especially since it doesn't understand that outbuf will change as a result of a successful virCommandRun() call. Signed-off-by: John Ferlan --- tests/commandtest.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/commandtest.c b/tests/commandtest.c index c5c3a9a..7d2161c 100644 --- a/tests/commandtest.c +++ b/tests/commandtest.c @@ -690,6 +690,7 @@ static int test17(const void *unused ATTRIBUTE_UNUSED) goto cleanup; } +sa_assert(outbuf); if (*outbuf) { puts("output buffer is not an allocated empty string"); goto cleanup; -- 1.8.5.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH] libxl: Use id from virDomainObj inside the driver
There is a domain id in the virDomain structure as well as in the virDomainObj structure. While the former can become stale the latter is kept up to date. So it is safer to always (virDomainObjPtr)->def->id internally. This will fix issues seen when managing Xen guests through libvirt from virt-manager (not being able to get domain info after define or reboot). This was caused both though libxlDomainGetInfo() only but there were a lot of places that might potentially cause issues, too. Signed-off-by: Stefan Bader --- src/libxl/libxl_driver.c | 75 +++--- 1 file changed, 38 insertions(+), 37 deletions(-) diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c index fc97db4..b5061df 100644 --- a/src/libxl/libxl_driver.c +++ b/src/libxl/libxl_driver.c @@ -770,10 +770,10 @@ libxlDomainSuspend(virDomainPtr dom) priv = vm->privateData; if (virDomainObjGetState(vm, NULL) != VIR_DOMAIN_PAUSED) { -if (libxl_domain_pause(priv->ctx, dom->id) != 0) { +if (libxl_domain_pause(priv->ctx, vm->def->id) != 0) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Failed to suspend domain '%d' with libxenlight"), - dom->id); + vm->def->id); goto endjob; } @@ -829,10 +829,10 @@ libxlDomainResume(virDomainPtr dom) priv = vm->privateData; if (virDomainObjGetState(vm, NULL) == VIR_DOMAIN_PAUSED) { -if (libxl_domain_unpause(priv->ctx, dom->id) != 0) { +if (libxl_domain_unpause(priv->ctx, vm->def->id) != 0) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Failed to resume domain '%d' with libxenlight"), - dom->id); + vm->def->id); goto endjob; } @@ -883,10 +883,10 @@ libxlDomainShutdownFlags(virDomainPtr dom, unsigned int flags) } priv = vm->privateData; -if (libxl_domain_shutdown(priv->ctx, dom->id) != 0) { +if (libxl_domain_shutdown(priv->ctx, vm->def->id) != 0) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Failed to shutdown domain '%d' with libxenlight"), - dom->id); + vm->def->id); goto cleanup; } @@ -930,10 +930,10 @@ libxlDomainReboot(virDomainPtr dom, unsigned int flags) } priv = vm->privateData; -if (libxl_domain_reboot(priv->ctx, dom->id) != 0) { +if (libxl_domain_reboot(priv->ctx, vm->def->id) != 0) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Failed to reboot domain '%d' with libxenlight"), - dom->id); + vm->def->id); goto cleanup; } ret = 0; @@ -974,7 +974,7 @@ libxlDomainDestroyFlags(virDomainPtr dom, priv = vm->privateData; if (libxl_domain_destroy(priv->ctx, vm->def->id, NULL) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("Failed to destroy domain '%d'"), dom->id); + _("Failed to destroy domain '%d'"), vm->def->id); goto cleanup; } @@ -1105,10 +1105,10 @@ libxlDomainSetMemoryFlags(virDomainPtr dom, unsigned long newmem, if (flags & VIR_DOMAIN_MEM_LIVE) { priv = vm->privateData; -if (libxl_domain_setmaxmem(priv->ctx, dom->id, newmem) < 0) { +if (libxl_domain_setmaxmem(priv->ctx, vm->def->id, newmem) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Failed to set maximum memory for domain '%d'" - " with libxenlight"), dom->id); + " with libxenlight"), vm->def->id); goto endjob; } } @@ -1138,13 +1138,13 @@ libxlDomainSetMemoryFlags(virDomainPtr dom, unsigned long newmem, priv = vm->privateData; /* Unlock virDomainObj while ballooning memory */ virObjectUnlock(vm); -res = libxl_set_memory_target(priv->ctx, dom->id, newmem, 0, +res = libxl_set_memory_target(priv->ctx, vm->def->id, newmem, 0, /* force */ 1); virObjectLock(vm); if (res < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Failed to set memory for domain '%d'" - " with libxenlight"), dom->id); + " with libxenlight"), vm->def->id); goto endjob; } } @@ -1202,9 +1202,10 @@ libxlDomainGetInfo(virDomainPtr dom, virDomainInfoPtr info) info->memory = vm->def->mem.cur_balloon; info->maxMem = vm->def->mem.max_balloon; } else { -if (libxl_domain_info(priv->ctx, &d_info, dom->id) != 0) { +if (libxl_domain_info(priv->ctx, &d_info,
[libvirt] [PATCH python 4/4] setup.py: Allow running --help or clean without pkg-config
If pkg-config isn't installed, or a too old libvirt, we can't even do 'python setup.py --help' without throwing an exception. Have the pkg-config checks and validation only throw an exception if being called from the 'build' step. https://bugzilla.redhat.com/show_bug.cgi?id=1074170 --- setup.py | 31 --- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/setup.py b/setup.py index f137b22..592c30b 100755 --- a/setup.py +++ b/setup.py @@ -24,19 +24,24 @@ MIN_LIBVIRT_LXC = "1.0.2" if not os.path.exists("build"): os.mkdir("build") -pkgcfg = distutils.spawn.find_executable("pkg-config") - -if pkgcfg is None: -raise Exception("pkg-config binary is required to compile libvirt-python") - -spawn([pkgcfg, - "--print-errors", - "--atleast-version=%s" % MIN_LIBVIRT, - "libvirt"]) +_pkgcfg = -1 +def get_pkgcfg(do_fail=True): +global _pkgcfg +if _pkgcfg == -1: +_pkgcfg = distutils.spawn.find_executable("pkg-config") +if _pkgcfg is None and do_fail: +raise Exception("pkg-config binary is required to compile libvirt-python") +return _pkgcfg + +def check_minimum_libvirt_version(): +spawn([get_pkgcfg(), + "--print-errors", + "--atleast-version=%s" % MIN_LIBVIRT, + "libvirt"]) def have_libvirt_lxc(): try: -spawn([pkgcfg, +spawn([get_pkgcfg(), "--atleast-version=%s" % MIN_LIBVIRT_LXC, "libvirt"]) return True @@ -45,7 +50,7 @@ def have_libvirt_lxc(): def get_pkgconfig_data(args, mod, required=True): """Run pkg-config to and return content associated with it""" -f = os.popen("%s %s %s" % (pkgcfg, " ".join(args), mod)) +f = os.popen("%s %s %s" % (get_pkgcfg(), " ".join(args), mod)) line = f.readline() if line is not None: @@ -78,6 +83,9 @@ def get_module_lists(): Determine which modules we are actually building, and all their required config """ +if get_pkgcfg(do_fail=False) is None: +return [], [] + c_modules = [] py_modules = [] ldflags = get_pkgconfig_data(["--libs-only-L"], "libvirt", False) @@ -130,6 +138,7 @@ def get_module_lists(): class my_build(build): def run(self): +check_minimum_libvirt_version() apis = get_api_xml_files() self.spawn([sys.executable, "generator.py", "libvirt", apis[0]]) -- 1.8.5.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH python 2/4] setup.py: Move module list building to its own function
Makes it a bit more clear what all that code is used for, rather than intermixing it with function definitions. Besides the comment additions, this is a no-op and just reindents the block, into a function. --- setup.py | 97 ++-- 1 file changed, 57 insertions(+), 40 deletions(-) diff --git a/setup.py b/setup.py index 554d10d..a8fdeb4 100755 --- a/setup.py +++ b/setup.py @@ -72,49 +72,59 @@ def get_api_xml_files(): return (libvirt_api, libvirt_qemu_api, libvirt_lxc_api) -ldflags = get_pkgconfig_data(["--libs-only-L"], "libvirt", False) -cflags = get_pkgconfig_data(["--cflags"], "libvirt", False) - -c_modules = [] -py_modules = [] - -module = Extension('libvirtmod', - sources = ['libvirt-override.c', 'build/libvirt.c', 'typewrappers.c', 'libvirt-utils.c'], - libraries = [ "virt" ], - include_dirs = [ "." ]) -if cflags != "": -module.extra_compile_args.append(cflags) -if ldflags != "": -module.extra_link_args.append(ldflags) - -c_modules.append(module) -py_modules.append("libvirt") - -moduleqemu = Extension('libvirtmod_qemu', - sources = ['libvirt-qemu-override.c', 'build/libvirt-qemu.c', 'typewrappers.c', 'libvirt-utils.c'], - libraries = [ "virt-qemu" ], +def get_module_lists(): +""" +Determine which modules we are actually building, and all their +required config +""" +c_modules = [] +py_modules = [] +ldflags = get_pkgconfig_data(["--libs-only-L"], "libvirt", False) +cflags = get_pkgconfig_data(["--cflags"], "libvirt", False) + +module = Extension('libvirtmod', + sources = ['libvirt-override.c', 'build/libvirt.c', 'typewrappers.c', 'libvirt-utils.c'], + libraries = [ "virt" ], include_dirs = [ "." ]) -if cflags != "": -moduleqemu.extra_compile_args.append(cflags) -if ldflags != "": -moduleqemu.extra_link_args.append(ldflags) - -c_modules.append(moduleqemu) -py_modules.append("libvirt_qemu") - -if have_libvirt_lxc: -modulelxc = Extension('libvirtmod_lxc', - sources = ['libvirt-lxc-override.c', 'build/libvirt-lxc.c', 'typewrappers.c', 'libvirt-utils.c'], - libraries = [ "virt-lxc" ], - include_dirs = [ "." ]) if cflags != "": -modulelxc.extra_compile_args.append(cflags) +module.extra_compile_args.append(cflags) if ldflags != "": -modulelxc.extra_link_args.append(ldflags) +module.extra_link_args.append(ldflags) -c_modules.append(modulelxc) -py_modules.append("libvirt_lxc") +c_modules.append(module) +py_modules.append("libvirt") +moduleqemu = Extension('libvirtmod_qemu', + sources = ['libvirt-qemu-override.c', 'build/libvirt-qemu.c', 'typewrappers.c', 'libvirt-utils.c'], + libraries = [ "virt-qemu" ], + include_dirs = [ "." ]) +if cflags != "": +moduleqemu.extra_compile_args.append(cflags) +if ldflags != "": +moduleqemu.extra_link_args.append(ldflags) + +c_modules.append(moduleqemu) +py_modules.append("libvirt_qemu") + +if have_libvirt_lxc: +modulelxc = Extension('libvirtmod_lxc', + sources = ['libvirt-lxc-override.c', 'build/libvirt-lxc.c', 'typewrappers.c', 'libvirt-utils.c'], + libraries = [ "virt-lxc" ], + include_dirs = [ "." ]) +if cflags != "": +modulelxc.extra_compile_args.append(cflags) +if ldflags != "": +modulelxc.extra_link_args.append(ldflags) + +c_modules.append(modulelxc) +py_modules.append("libvirt_lxc") + +return c_modules, py_modules + + +### +# Custom commands # +### class my_build(build): @@ -281,14 +291,21 @@ class my_clean(clean): if os.path.exists("build"): remove_tree("build") + +## +# Invoke setup() # +## + +_c_modules, _py_modules = get_module_lists() + setup(name = 'libvirt-python', version = '1.2.3', url = 'http://www.libvirt.org', maintainer = 'Libvirt Maintainers', maintainer_email = 'libvir-list@redhat.com', description = 'The libvirt virtualization API', - ext_modules = c_modules, - py_modules = py_modules, + ext_modules = _c_modules, + py_modules = _py_modules, package_dir = { '': 'build' }, -- 1.8.5.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH python 3/4] setup.py: Make have_libvirt_lxc a function
This means we call it twice for a build operation, but I don't think that's a big deal. --- setup.py | 19 ++- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/setup.py b/setup.py index a8fdeb4..f137b22 100755 --- a/setup.py +++ b/setup.py @@ -34,13 +34,14 @@ spawn([pkgcfg, "--atleast-version=%s" % MIN_LIBVIRT, "libvirt"]) -have_libvirt_lxc=True -try: -spawn([pkgcfg, - "--atleast-version=%s" % MIN_LIBVIRT_LXC, - "libvirt"]) -except DistutilsExecError: -have_libvirt_lxc=False +def have_libvirt_lxc(): +try: +spawn([pkgcfg, + "--atleast-version=%s" % MIN_LIBVIRT_LXC, + "libvirt"]) +return True +except DistutilsExecError: +return False def get_pkgconfig_data(args, mod, required=True): """Run pkg-config to and return content associated with it""" @@ -106,7 +107,7 @@ def get_module_lists(): c_modules.append(moduleqemu) py_modules.append("libvirt_qemu") -if have_libvirt_lxc: +if have_libvirt_lxc(): modulelxc = Extension('libvirtmod_lxc', sources = ['libvirt-lxc-override.c', 'build/libvirt-lxc.c', 'typewrappers.c', 'libvirt-utils.c'], libraries = [ "virt-lxc" ], @@ -133,7 +134,7 @@ class my_build(build): self.spawn([sys.executable, "generator.py", "libvirt", apis[0]]) self.spawn([sys.executable, "generator.py", "libvirt-qemu", apis[1]]) -if have_libvirt_lxc: +if have_libvirt_lxc(): self.spawn([sys.executable, "generator.py", "libvirt-lxc", apis[2]]) build.run(self) -- 1.8.5.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH python 0/4] setup.py: Don't unconditionally run pkg-config
This series reorganizes setup.py to not unconditionally call pkg-config. This will allow 'setup.py clean' and 'setup.py --help' to work correctly even if pkg-config or libvirt-devel aren't installed. https://bugzilla.redhat.com/show_bug.cgi?id=1074170 Cole Robinson (4): setup.py: Remove unused import setup.py: Move module list building to its own function setup.py: Make have_libvirt_lxc a function setup.py: Allow running --help or clean without pkg-config setup.py | 144 +-- 1 file changed, 85 insertions(+), 59 deletions(-) -- 1.8.5.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH python 1/4] setup.py: Remove unused import
--- setup.py | 1 - 1 file changed, 1 deletion(-) diff --git a/setup.py b/setup.py index cfbbe2c..554d10d 100755 --- a/setup.py +++ b/setup.py @@ -11,7 +11,6 @@ from distutils.errors import DistutilsExecError import distutils import sys -import datetime import os import os.path import re -- 1.8.5.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] bhyve: don't fail on busy tap devices
Ján Tomko wrote: > This would leak devpath. > > ACK with VIR_FREE(devpath) added either before 'continue', or the virAsprintf > allocating it. Pushed, thanks! Roman Bogorodskiy pgpevKP6sj_6k.pgp Description: PGP signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCHv2 2/2] Show the real cpu shares value in live xml
On 14.03.2014 16:03, Ján Tomko wrote: --- src/lxc/lxc_cgroup.c | 13 ++--- src/lxc/lxc_driver.c | 6 +- src/qemu/qemu_cgroup.c | 12 +--- src/qemu/qemu_driver.c | 7 ++- 4 files changed, 30 insertions(+), 8 deletions(-) I'd expect some explanation in the commit message why are we bothering with this. ACK with the commit message extended. Michal -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCHv2 1/2] Treat zero cpu shares as a valid value
On 14.03.2014 16:03, Ján Tomko wrote: Currently, 0 is treated as if it were not specified. Treat is as a valid value if it was explicitly specified and write it to the cgroups. --- src/conf/domain_conf.c | 12 src/conf/domain_conf.h | 1 + src/lxc/lxc_cgroup.c | 2 +- src/lxc/lxc_driver.c | 2 ++ src/lxc/lxc_native.c | 8 +++-- src/parallels/parallels_driver.c | 1 + src/qemu/qemu_cgroup.c | 4 +-- src/qemu/qemu_command.c| 2 +- src/qemu/qemu_driver.c | 6 +++- src/vmx/vmx.c | 3 +- .../qemuxml2argv-cputune-zero-shares.args | 5 .../qemuxml2argv-cputune-zero-shares.xml | 35 ++ tests/qemuxml2argvtest.c | 1 + tests/qemuxml2xmltest.c| 1 + 14 files changed, 69 insertions(+), 14 deletions(-) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-cputune-zero-shares.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-cputune-zero-shares.xml ACK Michal -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] libxl: Create log directory earlier
On 03/25/2014 09:28 AM, Stefan Bader wrote: > Commit d9f19c30d054c86b15a304f4118baa4fa75af9d2 moved a lot of the > configuration setup into libxlDriverConfigNew(). > However that tries to create the libxl/libxl-driver.log before the > libxl directory gets created in libxlStateInitialize(). > > This causes the daemon to fail on systems that have not had the directory > created before. > > Move the code to create the libxl directory into libxlDriverConfigNew(). > > Signed-off-by: Stefan Bader > --- > src/libxl/libxl_conf.c |8 > src/libxl/libxl_driver.c |7 --- > 2 files changed, 8 insertions(+), 7 deletions(-) ACK and pushed. -- 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] libxl: Issues with virt-manager when used to manager Xen domains
On 25.03.2014 16:46, Daniel P. Berrange wrote: > On Tue, Mar 25, 2014 at 04:42:25PM +0100, Stefan Bader wrote: >> On 25.03.2014 16:36, Daniel P. Berrange wrote: >>> On Tue, Mar 25, 2014 at 04:22:54PM +0100, Stefan Bader wrote: This started off with some regression testing after going forward to Xen-4.4. We currently would pair that with a libvirt version 1.2.2 and right now operations through virsh seem to be working (mostly) well. But when using virt-manager (not the most up-to-date versions but some combinations that quite likely will occur (0.9.1 and 0.9.5)) there are some issues. Two symptoms seem to be caused by the same underlying problem which is caused by the way virt-manager interacts with libvirt. That seems to be that virt-manager acquires a reference to virDomainPtr only once and then uses that for subsequent call. This is a problem because both virDomainPtr object and virDomainObjPtr objects contains a domid but only the latter gets updated. So both, creating a new guest (which must be a define step and then use the handle to start the guest) as well as rebooting a guest cause problems for virt-manager. Mainly because of libxlDomainGetInfo() which retrieves the virDomainObjPtr for a given virDommainPtr. Then checks the domain object to be active or not but uses the domid from the domain to call into libxl: if (!(vm = libxlDomObjFromDomain(dom))) goto cleanup; ... if (!virDomainObjIsActive(vm)) { info->cpuTime = 0; info->memory = vm->def->mem.cur_balloon; info->maxMem = vm->def->mem.max_balloon; } else { if (libxl_domain_info(priv->ctx, &d_info, dom->id) != 0) { This fails either with dom->id being -1 (still) or using the old id from before the reboot. A dirty hack seems to avoid this: >>> >>> Yep, this is a pretty commonly hit problem. The solution is to *never* >>> access dom->id in the driver code at all. eg In this code snippet above >>> you could use vm->def->id instead which should be up to date. >> >> OK, it just seems for something that should not be done, it is done plenty of >> times in the libxl_driver codebase right now. At least pause and unpause >> seem to >> do the same... > > I expect those pretty much all need to be fixed All-right, thanks for confirming. :) Will work on that. -Stefan > > Regards, > Daniel > signature.asc Description: OpenPGP digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] libxl: Issues with virt-manager when used to manager Xen domains
On Tue, Mar 25, 2014 at 04:42:25PM +0100, Stefan Bader wrote: > On 25.03.2014 16:36, Daniel P. Berrange wrote: > > On Tue, Mar 25, 2014 at 04:22:54PM +0100, Stefan Bader wrote: > >> This started off with some regression testing after going forward to > >> Xen-4.4. We > >> currently would pair that with a libvirt version 1.2.2 and right now > >> operations > >> through virsh seem to be working (mostly) well. But when using > >> virt-manager (not > >> the most up-to-date versions but some combinations that quite likely will > >> occur > >> (0.9.1 and 0.9.5)) there are some issues. > >> > >> Two symptoms seem to be caused by the same underlying problem which is > >> caused by > >> the way virt-manager interacts with libvirt. That seems to be that > >> virt-manager > >> acquires a reference to virDomainPtr only once and then uses that for > >> subsequent > >> call. This is a problem because both virDomainPtr object and > >> virDomainObjPtr > >> objects contains a domid but only the latter gets updated. > >> > >> So both, creating a new guest (which must be a define step and then use the > >> handle to start the guest) as well as rebooting a guest cause problems for > >> virt-manager. Mainly because of libxlDomainGetInfo() which retrieves the > >> virDomainObjPtr for a given virDommainPtr. Then checks the domain object > >> to be > >> active or not but uses the domid from the domain to call into libxl: > >> > >> if (!(vm = libxlDomObjFromDomain(dom))) > >> goto cleanup; > >> ... > >> if (!virDomainObjIsActive(vm)) { > >> info->cpuTime = 0; > >> info->memory = vm->def->mem.cur_balloon; > >> info->maxMem = vm->def->mem.max_balloon; > >> } else { > >> if (libxl_domain_info(priv->ctx, &d_info, dom->id) != 0) { > >> > >> This fails either with dom->id being -1 (still) or using the old id from > >> before > >> the reboot. A dirty hack seems to avoid this: > > > > Yep, this is a pretty commonly hit problem. The solution is to *never* > > access dom->id in the driver code at all. eg In this code snippet above > > you could use vm->def->id instead which should be up to date. > > OK, it just seems for something that should not be done, it is done plenty of > times in the libxl_driver codebase right now. At least pause and unpause seem > to > do the same... I expect those pretty much all need to be fixed 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] libxl: Issues with virt-manager when used to manager Xen domains
On 25.03.2014 16:36, Daniel P. Berrange wrote: > On Tue, Mar 25, 2014 at 04:22:54PM +0100, Stefan Bader wrote: >> This started off with some regression testing after going forward to >> Xen-4.4. We >> currently would pair that with a libvirt version 1.2.2 and right now >> operations >> through virsh seem to be working (mostly) well. But when using virt-manager >> (not >> the most up-to-date versions but some combinations that quite likely will >> occur >> (0.9.1 and 0.9.5)) there are some issues. >> >> Two symptoms seem to be caused by the same underlying problem which is >> caused by >> the way virt-manager interacts with libvirt. That seems to be that >> virt-manager >> acquires a reference to virDomainPtr only once and then uses that for >> subsequent >> call. This is a problem because both virDomainPtr object and virDomainObjPtr >> objects contains a domid but only the latter gets updated. >> >> So both, creating a new guest (which must be a define step and then use the >> handle to start the guest) as well as rebooting a guest cause problems for >> virt-manager. Mainly because of libxlDomainGetInfo() which retrieves the >> virDomainObjPtr for a given virDommainPtr. Then checks the domain object to >> be >> active or not but uses the domid from the domain to call into libxl: >> >> if (!(vm = libxlDomObjFromDomain(dom))) >> goto cleanup; >> ... >> if (!virDomainObjIsActive(vm)) { >> info->cpuTime = 0; >> info->memory = vm->def->mem.cur_balloon; >> info->maxMem = vm->def->mem.max_balloon; >> } else { >> if (libxl_domain_info(priv->ctx, &d_info, dom->id) != 0) { >> >> This fails either with dom->id being -1 (still) or using the old id from >> before >> the reboot. A dirty hack seems to avoid this: > > Yep, this is a pretty commonly hit problem. The solution is to *never* > access dom->id in the driver code at all. eg In this code snippet above > you could use vm->def->id instead which should be up to date. OK, it just seems for something that should not be done, it is done plenty of times in the libxl_driver codebase right now. At least pause and unpause seem to do the same... -Stefan > > Regards, > Daniel > signature.asc Description: OpenPGP digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] libxl: Issues with virt-manager when used to manager Xen domains
On Tue, Mar 25, 2014 at 04:22:54PM +0100, Stefan Bader wrote: > This started off with some regression testing after going forward to Xen-4.4. > We > currently would pair that with a libvirt version 1.2.2 and right now > operations > through virsh seem to be working (mostly) well. But when using virt-manager > (not > the most up-to-date versions but some combinations that quite likely will > occur > (0.9.1 and 0.9.5)) there are some issues. > > Two symptoms seem to be caused by the same underlying problem which is caused > by > the way virt-manager interacts with libvirt. That seems to be that > virt-manager > acquires a reference to virDomainPtr only once and then uses that for > subsequent > call. This is a problem because both virDomainPtr object and virDomainObjPtr > objects contains a domid but only the latter gets updated. > > So both, creating a new guest (which must be a define step and then use the > handle to start the guest) as well as rebooting a guest cause problems for > virt-manager. Mainly because of libxlDomainGetInfo() which retrieves the > virDomainObjPtr for a given virDommainPtr. Then checks the domain object to be > active or not but uses the domid from the domain to call into libxl: > > if (!(vm = libxlDomObjFromDomain(dom))) > goto cleanup; > ... > if (!virDomainObjIsActive(vm)) { > info->cpuTime = 0; > info->memory = vm->def->mem.cur_balloon; > info->maxMem = vm->def->mem.max_balloon; > } else { > if (libxl_domain_info(priv->ctx, &d_info, dom->id) != 0) { > > This fails either with dom->id being -1 (still) or using the old id from > before > the reboot. A dirty hack seems to avoid this: Yep, this is a pretty commonly hit problem. The solution is to *never* access dom->id in the driver code at all. eg In this code snippet above you could use vm->def->id instead which should be up to date. 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] [PATCH v2] Fix apparmor profile to make vfio pci passthrough work
Quoting Cédric Bosdonnat (cbosdon...@suse.com): > See lp#1276719 for the bug description. As virt-aa-helper doesn't know > the VFIO groups to use for the guest, allow access to all > /dev/vfio/[0-9]* and /dev/vfio/vfio files if there is a potential need > for vfio > --- Thanks, Cédric! Looks good to me. Still needs a signed-off-by from you (I assume), but Acked-by: Serge E. Hallyn > examples/apparmor/libvirt-qemu | 1 + > examples/apparmor/usr.sbin.libvirtd | 3 +++ > src/security/virt-aa-helper.c | 12 > 3 files changed, 16 insertions(+) > > diff --git a/examples/apparmor/libvirt-qemu b/examples/apparmor/libvirt-qemu > index e1980b7..83814ec 100644 > --- a/examples/apparmor/libvirt-qemu > +++ b/examples/apparmor/libvirt-qemu > @@ -110,6 +110,7 @@ >/usr/bin/qemu-sparc32plus rmix, >/usr/bin/qemu-sparc64 rmix, >/usr/bin/qemu-x86_64 rmix, > + /usr/lib/qemu/block-curl.so mr, > ># for save and resume >/bin/dash rmix, > diff --git a/examples/apparmor/usr.sbin.libvirtd > b/examples/apparmor/usr.sbin.libvirtd > index fd6def1..3011eff 100644 > --- a/examples/apparmor/usr.sbin.libvirtd > +++ b/examples/apparmor/usr.sbin.libvirtd > @@ -25,6 +25,9 @@ >capability fsetid, >capability audit_write, > > + # Needed for vfio > + capability sys_resource, > + >network inet stream, >network inet dgram, >network inet6 stream, > diff --git a/src/security/virt-aa-helper.c b/src/security/virt-aa-helper.c > index 59de517..998dc53 100644 > --- a/src/security/virt-aa-helper.c > +++ b/src/security/virt-aa-helper.c > @@ -927,6 +927,7 @@ get_files(vahControl * ctl) > size_t i; > char *uuid; > char uuidstr[VIR_UUID_STRING_BUFLEN]; > +bool needsVfio = false; > > /* verify uuid is same as what we were given on the command line */ > virUUIDFormat(ctl->def->uuid, uuidstr); > @@ -1068,6 +1069,12 @@ get_files(vahControl * ctl) > dev->source.subsys.u.pci.addr.slot, > dev->source.subsys.u.pci.addr.function); > > +virDomainHostdevSubsysPciBackendType backend = > dev->source.subsys.u.pci.backend; > +if (backend == VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VFIO || > +backend == VIR_DOMAIN_HOSTDEV_PCI_BACKEND_DEFAULT) { > +needsVfio = true; > +} > + > if (pci == NULL) > continue; > > @@ -1096,6 +1103,11 @@ get_files(vahControl * ctl) > } > } > > +if (needsVfio) { > +virBufferAsprintf(&buf, " /dev/vfio/vfio rw,\n"); > +virBufferAsprintf(&buf, " /dev/vfio/[0-9]* rw,\n"); > +} > + > if (ctl->newfile) > if (vah_add_file(&buf, ctl->newfile, "rw") != 0) > goto cleanup; > -- > 1.9.0 > > -- > 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] libxl: Create log directory earlier
Commit d9f19c30d054c86b15a304f4118baa4fa75af9d2 moved a lot of the configuration setup into libxlDriverConfigNew(). However that tries to create the libxl/libxl-driver.log before the libxl directory gets created in libxlStateInitialize(). This causes the daemon to fail on systems that have not had the directory created before. Move the code to create the libxl directory into libxlDriverConfigNew(). Signed-off-by: Stefan Bader --- src/libxl/libxl_conf.c |8 src/libxl/libxl_driver.c |7 --- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c index a6bf1cf..56bb84a 100644 --- a/src/libxl/libxl_conf.c +++ b/src/libxl/libxl_conf.c @@ -1108,6 +1108,14 @@ libxlDriverConfigNew(void) if (virAsprintf(&log_file, "%s/libxl-driver.log", cfg->logDir) < 0) goto error; +if (virFileMakePath(cfg->logDir) < 0) { +virReportError(VIR_ERR_INTERNAL_ERROR, + _("failed to create log dir '%s': %s"), + cfg->logDir, + virStrerror(errno, ebuf, sizeof(ebuf))); +goto error; +} + if ((cfg->logger_file = fopen(log_file, "a")) == NULL) { VIR_ERROR(_("Failed to create log file '%s': %s"), log_file, virStrerror(errno, ebuf, sizeof(ebuf))); diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c index 0c6672b..e6316a7 100644 --- a/src/libxl/libxl_driver.c +++ b/src/libxl/libxl_driver.c @@ -306,13 +306,6 @@ libxlStateInitialize(bool privileged, goto error; libxl_driver->config = cfg; -if (virFileMakePath(cfg->logDir) < 0) { -virReportError(VIR_ERR_INTERNAL_ERROR, - _("failed to create log dir '%s': %s"), - cfg->logDir, - virStrerror(errno, ebuf, sizeof(ebuf))); -goto error; -} if (virFileMakePath(cfg->stateDir) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, _("failed to create state dir '%s': %s"), -- 1.7.9.5 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] libxl: Issues with virt-manager when used to manager Xen domains
This started off with some regression testing after going forward to Xen-4.4. We currently would pair that with a libvirt version 1.2.2 and right now operations through virsh seem to be working (mostly) well. But when using virt-manager (not the most up-to-date versions but some combinations that quite likely will occur (0.9.1 and 0.9.5)) there are some issues. Two symptoms seem to be caused by the same underlying problem which is caused by the way virt-manager interacts with libvirt. That seems to be that virt-manager acquires a reference to virDomainPtr only once and then uses that for subsequent call. This is a problem because both virDomainPtr object and virDomainObjPtr objects contains a domid but only the latter gets updated. So both, creating a new guest (which must be a define step and then use the handle to start the guest) as well as rebooting a guest cause problems for virt-manager. Mainly because of libxlDomainGetInfo() which retrieves the virDomainObjPtr for a given virDommainPtr. Then checks the domain object to be active or not but uses the domid from the domain to call into libxl: if (!(vm = libxlDomObjFromDomain(dom))) goto cleanup; ... if (!virDomainObjIsActive(vm)) { info->cpuTime = 0; info->memory = vm->def->mem.cur_balloon; info->maxMem = vm->def->mem.max_balloon; } else { if (libxl_domain_info(priv->ctx, &d_info, dom->id) != 0) { This fails either with dom->id being -1 (still) or using the old id from before the reboot. A dirty hack seems to avoid this: static virDomainObjPtr libxlDomObjFromDomain(virDomainPtr dom) { virDomainObjPtr vm; libxlDriverPrivatePtr driver = dom->conn->privateData; char uuidstr[VIR_UUID_STRING_BUFLEN]; vm = virDomainObjListFindByUUID(driver->domains, dom->uuid); if (!vm) { virUUIDFormat(dom->uuid, uuidstr); virReportError(VIR_ERR_NO_DOMAIN, _("no domain with matching uuid '%s' (%s)"), uuidstr, dom->name); return NULL; - } + } else { + if (dom->id != vm->def->id) { + VIR_WARN("libxlDomObjFromDomain: domid changed (%d->%d)", +dom->id, vm->def->id); + dom->id = vm->def->id; + } + } return vm; } Not really sure this is the right way to go. Also because that warning above happens a lot more (repeatedly) than I would have expected. This may or may not be related to the next question. Not a problem but more a confusion on my side: virGetDomain() has commentary that says it will return either a pointer to an existing object or one to a new one. Its just, I cannot see that done in the code. Is that a future plan or was that way but was removed? I must admit I have not looked deeper into that but one explanation of the repeated domid mismatch would be if the virDomainPtr that virt-manager uses to communicate with libvirt would be cloned before doing things inside libvirt. And holding that handle for so long and not obtaining a fresh one through the various lookup interfaces each time could be a mistake of virt-manager. Unfortunately one that needs to be handled in some way. -Stefan signature.asc Description: OpenPGP digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCHv2] network: fix problems with SRV records
On Wed, Mar 19, 2014 at 11:48:14AM -0600, Laine Stump wrote: > A patch submitted by Steven Malin last week pointed out a problem with > libvirt's DNS SRV record configuration: > > https://www.redhat.com/archives/libvir-list/2014-March/msg00536.html > > When searching for that message later, I found another series that had > been posted by Guannan Ren back in 2012 that somehow slipped between > the cracks: > > https://www.redhat.com/archives/libvir-list/2012-July/msg00236.html > > That patch was very much out of date, but also pointed out some real > problems. > > This patch fixes all the noted problems by refactoring > virNetworkDNSSrvDefParseXML() and networkDnsmasqConfContents(), then > verifies those fixes by added several new records to the test case. > > Problems fixed: > > * both service and protocol now have an underscore ("_") prepended on > the commandline, as required by RFC2782. > > target='tests.example.com' port='5060' priority='10' >weight='150'/> > > before: srv-host=sip.udp.example.com,tests.example.com,5060,10,150 > after: srv-host=_sip._udp.example.com,tests.example.com,5060,10,150 > > * if "domain" wasn't specified in the element, the extra > trailing "." will no longer be added to the dnsmasq commandline. > > port='5060' priority='10' weight='150'/> > > before: srv-host=sip.udp.,tests.example.com,5060,10,150 > after: srv-host=_sip._udp,tests.example.com,5060,10,150 > > * when optional attributes aren't specified, the separating comma is > also now not placed on the dnsmasq commandline. If optional > attributes in the middle of the line are not specified, they are > replaced with a default value in the commandline (1 for port, 0 for > priority and weight). > > port='5060'/> > > before: srv-host=sip.udp.,tests.example.com,5060,, > after: srv-host=_sip._udp,tests.example.com,5060 > > (actually the would have generated an error, because "optional" > attributes weren't really optional.) > > * The allowed characters for both service and protocol are now limited > to alphanumerics, plus a few special characters that are found in > existing names in /etc/services and /etc/protocols. (One exception > is that both of these files contain names with an embedded ".", but > "." can't be used in these fields of an SRV record because it is > used as a field separator and there is no method to escape a "." > into a field.) (Previously only the strings "tcp" and "udp" were > allowed for protocol, but this restriction has been removed, since > RFC2782 specifically says that it isn't limited to those, and that > anyway it is case insensitive.) > > * the "domain" attribute is no longer required in order to recognize > the port, priority, and weight attributes during parsing. Only > "target" is required for this. > > * if "target" isn't specified, port, priority, and weight are not > allowed (since they are meaningless - an empty target means "this > service is *not available* for this domain"). > > * port, priority, and weight are now truly optional, as the comments > originally suggested, but which was not actually true. > --- > Changes from V1: > > https://www.redhat.com/archives/libvir-list/2014-March/msg01172.html > > src/conf/network_conf.c| 129 > ++--- > src/network/bridge_driver.c| 80 - > .../nat-network-dns-srv-record-minimal.conf| 2 +- > .../nat-network-dns-srv-record.conf| 8 +- > .../nat-network-dns-srv-record.xml | 8 +- > 5 files changed, 149 insertions(+), 78 deletions(-) > > diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c > index 9be06d3..f1e6243 100644 > --- a/src/conf/network_conf.c > +++ b/src/conf/network_conf.c > @@ -924,6 +924,21 @@ error: > return -1; > } > > +/* This includes all characters used in the names of current > + * /etc/services and /etc/protocols files (on Fedora 20), except ".", > + * which we can't allow because it would conflict with the use of "." > + * as a field separator in the SRV record, there appears to be no way > + * to escape it in, and the protocols/services that use "." in the > + * name are obscure and unlikely to be used anyway. > + */ > +#define PROTOCOL_CHARS \ > +"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" \ > +"-+/" > + > +#define SERVICE_CHARS \ > +"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" \ > +"_-+/*" > + We are using this [a-zA-Z0-9] string on few places, maybe we could put those together, but that's just a thought, definitely not related to this patch. > static int > virNetworkDNSSrvDefParseXML(const char *networkName, > xmlNodePtr node, > @@ -931,80 +946,108 @@ virNetworkDNSSrvDefParseXML(const char *networkName, > virNetworkDNSSrvDefPtr def, >
Re: [libvirt] [python PATCHv2 0/2] arbitrary qemu events
On 03/25/2014 04:37 AM, Pavel Hrdina wrote: > On 24.3.2014 20:14, Eric Blake wrote: >> Changes since v1: rebase to latest code base, address review comments >> regarding a leak of dom, add prereq patch to fix bugs that I had >> been copying and pasting >> >> Eric Blake (2): >>event: fix domain reference bugs >>qemu: support arbitrary monitor events >> >> generator.py | 20 +-- >> libvirt-override.c | 319 >> +-- >> libvirt-qemu-override.c | 223 - >> libvirt-qemu-override.py | 35 ++ >> 4 files changed, 469 insertions(+), 128 deletions(-) >> create mode 100644 libvirt-qemu-override.py >> > > Tested and the code seems to by OK too. ACK Thanks; pushed. -- 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 00/24] Indent top-level labels by one space
On 03/25/2014 09:41 AM, Martin Kletzander wrote: > On Tue, Mar 25, 2014 at 08:03:44AM +0100, Ján Tomko wrote: >> Change the existing code and introduce a syntax-check rule. >> >> Ján Tomko (24): >> Indent top-level labels by one space in daemon/ >> Indent top-level labels by one space in examples/ >> Indent top-level labels by one space in src/conf/ >> Indent top-level labels by one space in src/cpu/ >> Indent top-level labels by one space in src/esx/ >> Indent top-level labels by one space in src/libxl/ >> Indent top-level labels by one space in libvirt.c >> Indent top-level labels by one space in src/locking/ >> Indent top-level labels by one space in src/lxc/ >> Indent top-level labels by one space in src/network/ >> Indent top-level labels by one space in src/nwfilter/ >> Indent top-level labels by one space in src/parallels/ >> Indent top-level labels by one space in src/qemu/ >> Indent top-level labels by one space in src/remote/ >> Indent top-level labels by one space in src/rpc/ >> Indent top-level labels by one space in src/storage/ >> Indent top-level labels by one space in src/test/ >> Indent top-level labels by one space in src/util/ >> Indent top-level labels by one space in src/vbox/ >> Indent top-level labels by one space in src/xen/ >> Indent top-level labels by one space in the rest of src/ >> Indent top-level labels by one space in tests/ >> Indent top-level labels by one space in tools/ >> Add a rule for indenting labels >> > > Few patched haven't make it through to my inbox yet, but I reviewed > those on the archives. ACK series with one exception in [24/24]. > Yeah I think something is going on with RH mail servers, I'm missing a bunch of messages across mailing lists, but they are in the archives. - Cole -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 24/24] Add a rule for indenting labels
On 03/25/2014 02:40 PM, Martin Kletzander wrote: > On Tue, Mar 25, 2014 at 08:04:08AM +0100, Ján Tomko wrote: >> diff --git a/cfg.mk b/cfg.mk >> index 559f719..cbcf40b 100644 >> --- a/cfg.mk >> +++ b/cfg.mk >> @@ -898,6 +898,12 @@ sc_prohibit_virConnectOpen_in_virsh: >> halt='Use vshConnect() in virsh instead of virConnectOpen*'\ >>$(_sc_search_regexp) >> >> +sc_require_space_before_label: >> +@prohibit='^[_a-zA-Z0-9]+:$$' \ > > Couldn't we at least prohibit 2 and 3 spaces as well? I mean doing: > > prohibit='^( ?)?[_a-zA-Z0-9]+:$$' > > ACK with that amended. > I've changed the regexp and pushed the series. Thanks for the reviews! Jan 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] bhyve: don't fail on busy tap devices
On 03/23/2014 11:28 AM, Roman Bogorodskiy wrote: > We use virBhyveTapGetRealDeviceName() to map network interface name > to a real device path, trying to open possible devices and getting > names by ioctl. > > Make it skip devices that fail to open with EBUSY because they're > most likely already used by other VMs. > --- > src/bhyve/bhyve_command.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/src/bhyve/bhyve_command.c b/src/bhyve/bhyve_command.c > index 6d64c27..e569aab 100644 > --- a/src/bhyve/bhyve_command.c > +++ b/src/bhyve/bhyve_command.c > @@ -69,6 +69,8 @@ virBhyveTapGetRealDeviceName(char *name) > goto cleanup; > } > if ((fd = open(devpath, O_RDWR)) < 0) { > +if (errno == EBUSY) > +continue; > virReportSystemError(errno, _("Unable to open '%s'"), > devpath); > goto cleanup; > } > This would leak devpath. ACK with VIR_FREE(devpath) added either before 'continue', or the virAsprintf allocating it. Jan 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 00/24] Indent top-level labels by one space
On Tue, Mar 25, 2014 at 08:03:44AM +0100, Ján Tomko wrote: > Change the existing code and introduce a syntax-check rule. > > Ján Tomko (24): > Indent top-level labels by one space in daemon/ > Indent top-level labels by one space in examples/ > Indent top-level labels by one space in src/conf/ > Indent top-level labels by one space in src/cpu/ > Indent top-level labels by one space in src/esx/ > Indent top-level labels by one space in src/libxl/ > Indent top-level labels by one space in libvirt.c > Indent top-level labels by one space in src/locking/ > Indent top-level labels by one space in src/lxc/ > Indent top-level labels by one space in src/network/ > Indent top-level labels by one space in src/nwfilter/ > Indent top-level labels by one space in src/parallels/ > Indent top-level labels by one space in src/qemu/ > Indent top-level labels by one space in src/remote/ > Indent top-level labels by one space in src/rpc/ > Indent top-level labels by one space in src/storage/ > Indent top-level labels by one space in src/test/ > Indent top-level labels by one space in src/util/ > Indent top-level labels by one space in src/vbox/ > Indent top-level labels by one space in src/xen/ > Indent top-level labels by one space in the rest of src/ > Indent top-level labels by one space in tests/ > Indent top-level labels by one space in tools/ > Add a rule for indenting labels > Few patched haven't make it through to my inbox yet, but I reviewed those on the archives. ACK series with one exception in [24/24]. Martin signature.asc Description: Digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 24/24] Add a rule for indenting labels
On Tue, Mar 25, 2014 at 08:04:08AM +0100, Ján Tomko wrote: > diff --git a/cfg.mk b/cfg.mk > index 559f719..cbcf40b 100644 > --- a/cfg.mk > +++ b/cfg.mk > @@ -898,6 +898,12 @@ sc_prohibit_virConnectOpen_in_virsh: > halt='Use vshConnect() in virsh instead of virConnectOpen*'\ > $(_sc_search_regexp) > > +sc_require_space_before_label: > + @prohibit='^[_a-zA-Z0-9]+:$$' \ Couldn't we at least prohibit 2 and 3 spaces as well? I mean doing: prohibit='^( ?)?[_a-zA-Z0-9]+:$$' ACK with that amended. Martin signature.asc Description: Digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [RFC PATCH] Behaviour of topology, vcpus and maxcpus
I have observed the following with libvirt xml: 6 So according to the topology maximum supported is 8 vcpus, while the libvirt sets that to 6 - specified in tag. Shouldn't libvirt error this out as the mismatch between the topology definition and the vcpu count? There is an upper bound check already in place where if we have maxcpu > topology-supported cpus, that errors out. For eg. 12 The below patch make sures that libvirt does the lower bound check as well. Regards Nikunj diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index f96110b..aa25940 100644 [ 0001-Behaviour-of-topology-vcpus-and-maxcpus.patch: inline patch (as text/x-diff) ] --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -12933,6 +12933,14 @@ virDomainDefParseXML(xmlDocPtr xml, goto error; } +if (def->cpu->sockets && +def->maxvcpus < +def->cpu->sockets * def->cpu->cores * def->cpu->threads) { +virReportError(VIR_ERR_XML_DETAIL, "%s", + _("CPUs provided is less than topology")); +goto error; +} + if (def->cpu->cells_cpus > def->maxvcpus) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Number of CPUs in exceeds the" -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [RFC PATCH] Behaviour of topology, vcpus and maxcpus
I have observed the following with libvirt xml: 6 So according to the topology maximum supported is 8 vcpus, while the libvirt sets that to 6 - specified in tag. Shouldn't libvirt error this out as the mismatch between the topology definition and the vcpu count? There is an upper bound check already in place where if we have maxcpu > topology-supported cpus, that errors out. For eg. 12 The below patch make sures that libvirt does the lower bound check as well. Regards Nikunj diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index f96110b..aa25940 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -12933,6 +12933,14 @@ virDomainDefParseXML(xmlDocPtr xml, goto error; } +if (def->cpu->sockets && +def->maxvcpus < +def->cpu->sockets * def->cpu->cores * def->cpu->threads) { +virReportError(VIR_ERR_XML_DETAIL, "%s", + _("CPUs provided is less than topology")); +goto error; +} + if (def->cpu->cells_cpus > def->maxvcpus) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Number of CPUs in exceeds the" -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH v2] Fix apparmor profile to make vfio pci passthrough work
See lp#1276719 for the bug description. As virt-aa-helper doesn't know the VFIO groups to use for the guest, allow access to all /dev/vfio/[0-9]* and /dev/vfio/vfio files if there is a potential need for vfio --- examples/apparmor/libvirt-qemu | 1 + examples/apparmor/usr.sbin.libvirtd | 3 +++ src/security/virt-aa-helper.c | 12 3 files changed, 16 insertions(+) diff --git a/examples/apparmor/libvirt-qemu b/examples/apparmor/libvirt-qemu index e1980b7..83814ec 100644 --- a/examples/apparmor/libvirt-qemu +++ b/examples/apparmor/libvirt-qemu @@ -110,6 +110,7 @@ /usr/bin/qemu-sparc32plus rmix, /usr/bin/qemu-sparc64 rmix, /usr/bin/qemu-x86_64 rmix, + /usr/lib/qemu/block-curl.so mr, # for save and resume /bin/dash rmix, diff --git a/examples/apparmor/usr.sbin.libvirtd b/examples/apparmor/usr.sbin.libvirtd index fd6def1..3011eff 100644 --- a/examples/apparmor/usr.sbin.libvirtd +++ b/examples/apparmor/usr.sbin.libvirtd @@ -25,6 +25,9 @@ capability fsetid, capability audit_write, + # Needed for vfio + capability sys_resource, + network inet stream, network inet dgram, network inet6 stream, diff --git a/src/security/virt-aa-helper.c b/src/security/virt-aa-helper.c index 59de517..998dc53 100644 --- a/src/security/virt-aa-helper.c +++ b/src/security/virt-aa-helper.c @@ -927,6 +927,7 @@ get_files(vahControl * ctl) size_t i; char *uuid; char uuidstr[VIR_UUID_STRING_BUFLEN]; +bool needsVfio = false; /* verify uuid is same as what we were given on the command line */ virUUIDFormat(ctl->def->uuid, uuidstr); @@ -1068,6 +1069,12 @@ get_files(vahControl * ctl) dev->source.subsys.u.pci.addr.slot, dev->source.subsys.u.pci.addr.function); +virDomainHostdevSubsysPciBackendType backend = dev->source.subsys.u.pci.backend; +if (backend == VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VFIO || +backend == VIR_DOMAIN_HOSTDEV_PCI_BACKEND_DEFAULT) { +needsVfio = true; +} + if (pci == NULL) continue; @@ -1096,6 +1103,11 @@ get_files(vahControl * ctl) } } +if (needsVfio) { +virBufferAsprintf(&buf, " /dev/vfio/vfio rw,\n"); +virBufferAsprintf(&buf, " /dev/vfio/[0-9]* rw,\n"); +} + if (ctl->newfile) if (vah_add_file(&buf, ctl->newfile, "rw") != 0) goto cleanup; -- 1.9.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCHv2 0/6] Utility functions for storing uninstalled location
When libvirtd is run from a build directory without being installed, it should not depend on files from a libvirt package installed in the system. Currently, APIs defined in src/ don't know whether libvirtd is being run from the build dir or the installed dir. The following additions provide the functionality to do so: virSetUninstalledDir virGetUninstalledDir Example usage (utility = lxc|iohelper): char *path_tmp = virGetUninstalledDir(); if (path_tmp) /* do stuff with ("%s/../../src/libvirt_", path_tmp) */ else /* do stuff with (LIBEXECDIR "/libvirt_") */ v1: Refer: https://www.redhat.com/archives/libvir-list/2014-March/msg01427.html Nehal J Wani (6): Add utility functions for storing uninstalled location Use virGetUninstalledDir() in src/util/virfile.c Use virGetUninstalledDir() in src/lxc/lxc_conf.c Use virGetUninstalledDir() in src/storage/storage_backend_disk.c Use virGetUninstalledDir() in src/fdstream.c Remove obsolete function virFDStreamSetIOHelper() -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] migration: Fix possible bug for migrate cancel
> -Original Message- > From: Eric Blake [mailto:ebl...@redhat.com] > Sent: Tuesday, March 25, 2014 12:01 AM > To: Paolo Bonzini; Gonglei (Arei); qemu-de...@nongnu.org > Cc: quint...@redhat.com; owass...@redhat.com; Yanqiangjun; Zhaoyanbin > (A); Zengjunliang; libvir-list@redhat.com > Subject: Re: [PATCH] migration: Fix possible bug for migrate cancel > > [adding libvirt] > > On 03/24/2014 09:47 AM, Paolo Bonzini wrote: > > Il 24/03/2014 14:04, arei.gong...@huawei.com ha scritto: > >> From: zengjunliang > >> > >> Return error for migrate cancel, when migration status is not > >> MIG_STATE_SETUP or MIG_STATE_ACTIVE. Thus, libvirt can can > >> perceive the operation fails. > >> > >> Signed-off-by: zengjunliang > >> Signed-off-by: Gonglei > > > > I think this is done on purpose, because canceling migration is racy. > > Instead, libvirt should do "query-migrate" and check if the migration > > was completed or canceled. > > Can you please give more details at how you are triggering the problem > with libvirt? I think Paolo is probably right - the bug is more likely > to be in libvirt not expecting the race and not recovering correctly > when the race occurs, than it is to be in changing qemu's state algorithm. > When the migration progress reaches 100%, and the migration status becomes MIG_STATE_COMPLETED in Qemu. It will take some time which from MIG_STATE_COMPLETED to the migration thread resources are recovered. If we cancel the migration at this moment, the migrate_fd_cancel function will break directly without reporting error code. Then, libvirt considers the cancle operation a success, contrary facts. Best regards, -Gonglei -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [libvirt-python PATCH] generator: Add virConnectDomainQemuMonitorEventCallback to skipped_types
Signed-off-by: Martin Kletzander --- Notes: pushed as a build-breaker generator.py | 1 + 1 file changed, 1 insertion(+) diff --git a/generator.py b/generator.py index 0e9600f..e409921 100755 --- a/generator.py +++ b/generator.py @@ -273,6 +273,7 @@ skipped_types = { 'virConnectDomainEventWatchdogCallback': "No function types in python", 'virConnectDomainEventIOErrorCallback': "No function types in python", 'virConnectDomainEventGraphicsCallback': "No function types in python", + 'virConnectDomainQemuMonitorEventCallback': "No function types in python", 'virStreamEventCallback': "No function types in python", 'virEventHandleCallback': "No function types in python", 'virEventTimeoutCallback': "No function types in python", -- 1.9.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] Crash when using python-libvirt setSchedulerParameters
On 24.03.2014 21:45, Brian Rak wrote: I'm seeing a very weird (and somewhat reproducable) crash in setSchedulerParameters. The backtrace looks like this: *** glibc detected *** python2.7: free(): invalid pointer: 0x0152bc48 *** === Backtrace: = /lib64/libc.so.6(+0x76166)[0x7faa9e991166] /usr/lib64/python2.7/site-packages/libvirtmod.so(virFree+0x29)[0x7faa9887bfe9] /lib/libvirt.so.0(virTypedParamsClear+0x54)[0x7faa98342fe4] /lib/libvirt.so.0(virTypedParamsFree+0x1e)[0x7faa9834302e] /usr/lib64/python2.7/site-packages/libvirtmod.so(+0x1b4dc)[0x7faa9886c4dc] /usr/lib64/libpython2.7.so.1.0(PyEval_EvalFrameEx+0x5629)[0x7faa9f63a129] /usr/lib64/libpython2.7.so.1.0(PyEval_EvalFrameEx+0x68e8)[0x7faa9f63b3e8] /usr/lib64/libpython2.7.so.1.0(PyEval_EvalCodeEx+0x8ae)[0x7faa9f63bd5e] /usr/lib64/libpython2.7.so.1.0(PyEval_EvalCode+0x32)[0x7faa9f63be72] /usr/lib64/libpython2.7.so.1.0(+0xff25c)[0x7faa9f65625c] /usr/lib64/libpython2.7.so.1.0(PyRun_FileExFlags+0x90)[0x7faa9f656330] /usr/lib64/libpython2.7.so.1.0(PyRun_SimpleFileExFlags+0xef)[0x7faa9f6578cf] /usr/lib64/libpython2.7.so.1.0(Py_Main+0xc56)[0x7faa9f6693f6] /lib64/libc.so.6(__libc_start_main+0xfd)[0x7faa9e939d1d] python2.7[0x400649] I am using: Python2.7 Python-Libvirt 1.2.2 with the "[PATCH libvirt-python 1/2] setPyVirTypedParameter: Copy full field name" patch. Libvirt 1.2.1 Is the following patch applied as well? commit 69c4600d61fa74c4977d2471a29fb73f0fe5edb0 Author: Michal Privoznik AuthorDate: Tue Mar 18 09:20:00 2014 +0100 Commit: Michal Privoznik CommitDate: Tue Mar 18 14:43:10 2014 +0100 setPyVirTypedParameter: free whole return variable on error The @ret value is built in a loop. However, if in one iteration there's an error, we should free all the fields built so far. For instance, if there's an error and the previous item was type of VIR_TYPED_PARAM_STRING we definitely must free it. Signed-off-by: Michal Privoznik Can you install debuginfo so we see the full stack trace? Michal -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [python PATCHv2 0/2] arbitrary qemu events
On 24.3.2014 20:14, Eric Blake wrote: Changes since v1: rebase to latest code base, address review comments regarding a leak of dom, add prereq patch to fix bugs that I had been copying and pasting Eric Blake (2): event: fix domain reference bugs qemu: support arbitrary monitor events generator.py | 20 +-- libvirt-override.c | 319 +-- libvirt-qemu-override.c | 223 - libvirt-qemu-override.py | 35 ++ 4 files changed, 469 insertions(+), 128 deletions(-) create mode 100644 libvirt-qemu-override.py Tested and the code seems to by OK too. ACK Pavel -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCHv2 1/6] Add utility functions for storing uninstalled location
On Tue, Mar 25, 2014 at 10:11:14AM +, Daniel P. Berrange wrote: > On Tue, Mar 25, 2014 at 01:53:11PM +0530, Nehal J Wani wrote: > > src/libvirt_private.syms > >*Add symbols > > > > daemon/libvirtd.c > >*Set uninstallDir when libvirtd is running uninstalled > > from a build tree > > > > src/util/virutil.c > >*Introduce virSetUninstalledDir > >*Introduce virGetUninstalledDir > > > > --- > > daemon/libvirtd.c|1 + > > src/libvirt_private.syms |2 ++ > > src/util/virutil.c | 27 +++ > > src/util/virutil.h |3 +++ > > 4 files changed, 33 insertions(+), 0 deletions(-) > > > > diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c > > index 4179147..dc3da2a 100644 > > --- a/daemon/libvirtd.c > > +++ b/daemon/libvirtd.c > > @@ -1165,6 +1165,7 @@ int main(int argc, char **argv) { > > exit(EXIT_FAILURE); > > } > > *tmp = '\0'; > > +virSetUninstalledDir(argv[0]); > > argv[0] is not a directory - it is the path to the libvirtd > file. Either this is a mistake, or this is a very misleading > function name. Eww, gross, I see we're modifying argv[0] in place, ignore my comment above. 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] [PATCHv2 1/6] Add utility functions for storing uninstalled location
On Tue, Mar 25, 2014 at 01:53:11PM +0530, Nehal J Wani wrote: > src/libvirt_private.syms >*Add symbols > > daemon/libvirtd.c >*Set uninstallDir when libvirtd is running uninstalled > from a build tree > > src/util/virutil.c >*Introduce virSetUninstalledDir >*Introduce virGetUninstalledDir > > --- > daemon/libvirtd.c|1 + > src/libvirt_private.syms |2 ++ > src/util/virutil.c | 27 +++ > src/util/virutil.h |3 +++ > 4 files changed, 33 insertions(+), 0 deletions(-) > > diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c > index 4179147..dc3da2a 100644 > --- a/daemon/libvirtd.c > +++ b/daemon/libvirtd.c > @@ -1165,6 +1165,7 @@ int main(int argc, char **argv) { > exit(EXIT_FAILURE); > } > *tmp = '\0'; > +virSetUninstalledDir(argv[0]); argv[0] is not a directory - it is the path to the libvirtd file. Either this is a mistake, or this is a very misleading function name. 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
[libvirt] [PATCHv2 5/6] Use virGetUninstalledDir() in src/fdstream.c
src/storage/storage_backend_disk.c: *Check if libvirtd is running uninstalled from a build tree and change parthelper_path accordingly --- src/fdstream.c | 16 1 files changed, 16 insertions(+), 0 deletions(-) diff --git a/src/fdstream.c b/src/fdstream.c index d0435c7..031d9f5 100644 --- a/src/fdstream.c +++ b/src/fdstream.c @@ -593,6 +593,8 @@ virFDStreamOpenFileInternal(virStreamPtr st, struct stat sb; virCommandPtr cmd = NULL; int errfd = -1; +char *uninstalledDir = NULL; +char *iohelper_path = NULL; VIR_DEBUG("st=%p path=%s oflags=%x offset=%llu length=%llu mode=%o", st, path, oflags, offset, length, mode); @@ -648,9 +650,22 @@ virFDStreamOpenFileInternal(virStreamPtr st, goto error; } +uninstalledDir = virGetUninstalledDir(); + +if (uninstalledDir && virAsprintf(&iohelper_path, + "%s/../../src/libvirt_iohelper", + uninstalledDir) < 0) +goto error; +else if (virAsprintf(&iohelper_path, + LIBEXECDIR "/libvirt_iohelper") < 0) +goto error; + cmd = virCommandNewArgList(iohelper_path, path, NULL); + +VIR_FREE(iohelper_path); + virCommandAddArgFormat(cmd, "%llu", length); virCommandPassFD(cmd, fd, VIR_COMMAND_PASS_FD_CLOSE_PARENT); @@ -683,6 +698,7 @@ error: VIR_FORCE_CLOSE(fd); VIR_FORCE_CLOSE(childfd); VIR_FORCE_CLOSE(errfd); +VIR_FREE(iohelper_path); if (oflags & O_CREAT) unlink(path); return -1; -- 1.7.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 2/2] Fix apparmor profile to make vfio pci passthrough work
Hello Serge, On Mon, 2014-03-24 at 22:21 -0500, Serge Hallyn wrote: > Quoting Cédric Bosdonnat (cbosdon...@suse.com): > > See lp#1276719 for the bug description. As virt-aa-helper doesn't know > > Great, thanks for addressing this. > > > the VFIO groups to use for the guest, > > Is there really no way for it to know that (based on xml)? If not then > I guess this is the way to go - though even in that case could we at > least have virt-aa-helper only allow access to all vfio* only when vfio > pci is required? Sadly the vfio group is handled on the qemu side, there is nothing on the xml side. But I surely can change the patch to add the vfio rule to the *.files part of the profile and only when vfio is needed by the guest: that would restrain the access a bit. -- Cedric -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCHv2 4/6] Use virGetUninstalledDir() in src/storage/storage_backend_disk.c
src/storage/storage_backend_disk.c: *Check if libvirtd is running uninstalled from a build tree and change parthelper_path accordingly --- src/storage/storage_backend_disk.c | 28 ++-- 1 files changed, 26 insertions(+), 2 deletions(-) diff --git a/src/storage/storage_backend_disk.c b/src/storage/storage_backend_disk.c index 81201fd..bb29d39 100644 --- a/src/storage/storage_backend_disk.c +++ b/src/storage/storage_backend_disk.c @@ -261,7 +261,18 @@ virStorageBackendDiskReadPartitions(virStoragePoolObjPtr pool, * - normal metadata 100027630080 100030242304 2612736 * */ -virCommandPtr cmd = virCommandNewArgList(PARTHELPER, + +char *uninstalledDir = virGetUninstalledDir(); +char *parthelper_path = NULL; + +if (uninstalledDir && virAsprintf(&parthelper_path, + "%s/../../src/libvirt_parthelper", + uninstalledDir) < 0) +return -1; +else if (virAsprintf(&parthelper_path, PARTHELPER) < 0) +return -1; + +virCommandPtr cmd = virCommandNewArgList(parthelper_path, pool->def->source.devices[0].path, NULL); struct virStorageBackendDiskPoolVolData cbdata = { @@ -277,6 +288,7 @@ virStorageBackendDiskReadPartitions(virStoragePoolObjPtr pool, virStorageBackendDiskMakeVol, &cbdata); virCommandFree(cmd); +VIR_FREE(parthelper_path); return ret; } @@ -301,7 +313,18 @@ virStorageBackendDiskMakePoolGeometry(size_t ntok ATTRIBUTE_UNUSED, static int virStorageBackendDiskReadGeometry(virStoragePoolObjPtr pool) { -virCommandPtr cmd = virCommandNewArgList(PARTHELPER, +char *uninstalledDir = virGetUninstalledDir(); +char *parthelper_path = NULL; + +if (uninstalledDir && virAsprintf(&parthelper_path, + "%s/../../src/libvirt_parthelper", + uninstalledDir) < 0) +return -1; +else if (virAsprintf(&parthelper_path, PARTHELPER) < 0) +return -1; + + +virCommandPtr cmd = virCommandNewArgList(parthelper_path, pool->def->source.devices[0].path, "-g", NULL); @@ -312,6 +335,7 @@ virStorageBackendDiskReadGeometry(virStoragePoolObjPtr pool) virStorageBackendDiskMakePoolGeometry, pool); virCommandFree(cmd); +VIR_FREE(parthelper_path); return ret; } -- 1.7.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCHv2 1/6] Add utility functions for storing uninstalled location
src/libvirt_private.syms *Add symbols daemon/libvirtd.c *Set uninstallDir when libvirtd is running uninstalled from a build tree src/util/virutil.c *Introduce virSetUninstalledDir *Introduce virGetUninstalledDir --- daemon/libvirtd.c|1 + src/libvirt_private.syms |2 ++ src/util/virutil.c | 27 +++ src/util/virutil.h |3 +++ 4 files changed, 33 insertions(+), 0 deletions(-) diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c index 4179147..dc3da2a 100644 --- a/daemon/libvirtd.c +++ b/daemon/libvirtd.c @@ -1165,6 +1165,7 @@ int main(int argc, char **argv) { exit(EXIT_FAILURE); } *tmp = '\0'; +virSetUninstalledDir(argv[0]); char *driverdir; if (virAsprintfQuiet(&driverdir, "%s/../../src/.libs", argv[0]) < 0 || virAsprintfQuiet(&cpumap, "%s/../../src/cpu/cpu_map.xml", diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 2357f95..3549868 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -1997,6 +1997,7 @@ virGetGroupList; virGetGroupName; virGetHostname; virGetSelfLastChanged; +virGetUninstalledDir; virGetUnprivSGIOSysfsPath; virGetUserCacheDirectory; virGetUserConfigDirectory; @@ -2025,6 +2026,7 @@ virSetInherit; virSetNonBlock; virSetUIDGID; virSetUIDGIDWithCaps; +virSetUninstalledDir; virStrIsPrint; virUpdateSelfLastChanged; virValidateWWN; diff --git a/src/util/virutil.c b/src/util/virutil.c index 733cdff..47afbc4 100644 --- a/src/util/virutil.c +++ b/src/util/virutil.c @@ -2204,3 +2204,30 @@ void virUpdateSelfLastChanged(const char *path) selfLastChanged = sb.st_ctime; } } + +static char *uninstalledDir = NULL; +/** + * virSetUninstalledDir: + * @path: directory containing an uninstalled binary, for use in locating + * other uninstalled files + * + * Set a pointer to the path which can be accessed by all other APIs using + * virGetUninstalledDir(). + */ +void virSetUninstalledDir(char *path) +{ +ignore_value(VIR_STRDUP(uninstalledDir, path)); +} + +/** + * virGetUninstalledDir: + * + * If libvirtd (or other binary) is running uninstalled from a build tree, + * return the directory containing the binary. A NULL return implies that + * the binary has been installed and paths are relying on + * locations. + */ +char *virGetUninstalledDir(void) +{ +return uninstalledDir; +} diff --git a/src/util/virutil.h b/src/util/virutil.h index 1f2efd5..3e6ba47 100644 --- a/src/util/virutil.h +++ b/src/util/virutil.h @@ -202,4 +202,7 @@ bool virIsSUID(void); time_t virGetSelfLastChanged(void); void virUpdateSelfLastChanged(const char *path); +void virSetUninstalledDir(char *path); +char *virGetUninstalledDir(void); + #endif /* __VIR_UTIL_H__ */ -- 1.7.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCHv2 3/6] Use virGetUninstalledDir() in src/lxc/lxc_conf.c
src/lxc/lxc_conf.c: *Check if libvirtd is running uninstalled from a build tree and change lxc_path accordingly --- src/lxc/lxc_conf.c | 19 +-- 1 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/lxc/lxc_conf.c b/src/lxc/lxc_conf.c index d4432cf..ad8f78a 100644 --- a/src/lxc/lxc_conf.c +++ b/src/lxc/lxc_conf.c @@ -66,6 +66,8 @@ virCapsPtr virLXCDriverCapsInit(virLXCDriverPtr driver) virCapsPtr caps; virCapsGuestPtr guest; virArch altArch; +char *uninstalledDir = NULL; +char *lxc_path = NULL; if ((caps = virCapabilitiesNew(virArchFromHost(), 0, 0)) == NULL) @@ -89,10 +91,20 @@ virCapsPtr virLXCDriverCapsInit(virLXCDriverPtr driver) goto error; } +uninstalledDir = virGetUninstalledDir(); + +if (uninstalledDir && virAsprintf(&lxc_path, + "%s/../../src/libvirt_lxc", + uninstalledDir) < 0) +goto error; +else if (virAsprintf(&lxc_path, + LIBEXECDIR "/libvirt_lxc") < 0) +goto error; + if ((guest = virCapabilitiesAddGuest(caps, "exe", caps->host.arch, - LIBEXECDIR "/libvirt_lxc", + lxc_path, NULL, 0, NULL)) == NULL) @@ -111,7 +123,7 @@ virCapsPtr virLXCDriverCapsInit(virLXCDriverPtr driver) if ((guest = virCapabilitiesAddGuest(caps, "exe", altArch, - LIBEXECDIR "/libvirt_lxc", + lxc_path, NULL, 0, NULL)) == NULL) @@ -126,6 +138,8 @@ virCapsPtr virLXCDriverCapsInit(virLXCDriverPtr driver) goto error; } +VIR_FREE(lxc_path); + if (driver) { /* Security driver data */ const char *doi, *model, *label, *type; @@ -158,6 +172,7 @@ virCapsPtr virLXCDriverCapsInit(virLXCDriverPtr driver) return caps; error: +VIR_FREE(lxc_path); virObjectUnref(caps); return NULL; } -- 1.7.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCHv2 6/6] Remove obsolete function virFDStreamSetIOHelper()
Now that we have virSetUninstalledDir() and virGetUninstalledDir(), we no longer need virFDStreamSetIOHelper(). --- src/fdstream.c | 11 --- src/fdstream.h |2 -- src/libvirt_private.syms |1 - tests/fdstreamtest.c |3 --- 4 files changed, 0 insertions(+), 17 deletions(-) diff --git a/src/fdstream.c b/src/fdstream.c index 031d9f5..dbe2781 100644 --- a/src/fdstream.c +++ b/src/fdstream.c @@ -78,17 +78,6 @@ struct virFDStreamData { }; -static const char *iohelper_path = LIBEXECDIR "/libvirt_iohelper"; - -void virFDStreamSetIOHelper(const char *path) -{ -if (path == NULL) -iohelper_path = LIBEXECDIR "/libvirt_iohelper"; -else -iohelper_path = path; -} - - static int virFDStreamRemoveCallback(virStreamPtr stream) { struct virFDStreamData *fdst = stream->privateData; diff --git a/src/fdstream.h b/src/fdstream.h index 9c7295d..6292cd5 100644 --- a/src/fdstream.h +++ b/src/fdstream.h @@ -34,8 +34,6 @@ typedef void (*virFDStreamInternalCloseCbFreeOpaque)(void *opaque); /* Only for use by test suite */ -void virFDStreamSetIOHelper(const char *path); - int virFDStreamOpen(virStreamPtr st, int fd); diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 3549868..6ac54ea 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -809,7 +809,6 @@ virFDStreamCreateFile; virFDStreamOpen; virFDStreamOpenFile; virFDStreamOpenPTY; -virFDStreamSetIOHelper; # libvirt_internal.h diff --git a/tests/fdstreamtest.c b/tests/fdstreamtest.c index 92e7add..f1ef42a 100644 --- a/tests/fdstreamtest.c +++ b/tests/fdstreamtest.c @@ -321,9 +321,6 @@ mymain(void) { char scratchdir[] = SCRATCHDIRTEMPLATE; int ret = 0; -const char *iohelper = abs_builddir "/../src/libvirt_iohelper"; - -virFDStreamSetIOHelper(iohelper); if (!mkdtemp(scratchdir)) { virFilePrintf(stderr, "Cannot create fakesysfsdir"); -- 1.7.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 0/2] sanlock: Forbid unsupported lock failure actions
On Mon, Mar 24, 2014 at 14:41:52 -0600, Eric Blake wrote: > On 03/24/2014 07:50 AM, Jiri Denemark wrote: > > Some lock failure actions do not make any sense in combination with > > sanlock driver. Let's just report an error if someone tries to use them > > instead of causing unexpected and possibly quite bad thing to happen. > > ACK series. However, are we missing some documentation patches to match? I think the documentation is fine as it is: The on_lockfailure element (since 1.0.0) may be used to configure what action should be taken when a lock manager loses resource locks. The following actions are recognized by libvirt, although not all of them need to be supported by individual lock managers. ... I mean it would be nice to explicitly state what actions are supported by individual lock managers but doing it manually seems to fragile. Not to mention we don't document such things elsewhere either :-) I pushed the patches, thanks for the review. Jirka -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCHv2 2/6] Use virGetUninstalledDir() in src/util/virfile.c
src/util/virfile.c *Check if libvirtd is running uninstalled from a build tree and change iohelper_path accordingly --- src/util/virfile.c | 19 +-- 1 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/util/virfile.c b/src/util/virfile.c index fefc3fb..813ad86 100644 --- a/src/util/virfile.c +++ b/src/util/virfile.c @@ -193,6 +193,8 @@ virFileWrapperFdNew(int *fd, const char *name, unsigned int flags) bool output = false; int pipefd[2] = { -1, -1 }; int mode = -1; +char *uninstalledDir = NULL; +char *iohelper_path = NULL; if (!flags) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", @@ -236,8 +238,20 @@ virFileWrapperFdNew(int *fd, const char *name, unsigned int flags) goto error; } -ret->cmd = virCommandNewArgList(LIBEXECDIR "/libvirt_iohelper", -name, "0", NULL); +uninstalledDir = virGetUninstalledDir(); + +if (uninstalledDir && virAsprintf(&iohelper_path, + "%s/../../src/libvirt_iohelper", + uninstalledDir) < 0) +goto error; +else if (virAsprintf(&iohelper_path, + LIBEXECDIR "/libvirt_iohelper") < 0) +goto error; + +ret->cmd = virCommandNewArgList(iohelper_path, name, "0", NULL); + +VIR_FREE(iohelper_path); + if (output) { virCommandSetInputFD(ret->cmd, pipefd[0]); virCommandSetOutputFD(ret->cmd, fd); @@ -268,6 +282,7 @@ virFileWrapperFdNew(int *fd, const char *name, unsigned int flags) return ret; error: +VIR_FREE(iohelper_path); VIR_FORCE_CLOSE(pipefd[0]); VIR_FORCE_CLOSE(pipefd[1]); virFileWrapperFdFree(ret); -- 1.7.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 1/4] pie: add Position-Independent-Executable flag
Ok, it seems I isolated the problem. The linking error shows up only on FreeBSD with gcc toolchain installed, because it does not support pie. With clang everything is fine. There is an issue with detection mechanism. Currently, it is done in configure script with: gcc -std=gnu99 -o conftest -g -O2 -x c -fPIE -DPIE -D_THREAD_SAFE conftest.c -lintl It succeeds, so the scripts enables PIE. However, all further binaries are built with additional "-pie" flag. /bin/sh ../libtool --tag=CC --mode=link gcc -std=gnu99 -fPIE -DPIE -g -pie -o libvirt_iohelper util/libvirt_iohelper-iohelper.o libvirt_util.la../gnulib/lib/ libgnu.la -lintl This one fails with /usr/local/bin/ld: /usr/lib/crt1.o: relocation R_X86_64_32 against `_DYNAMIC' can not be used when making a shared object; recompile with -fPIC /usr/lib/crt1.o: error adding symbols: Bad value collect2: ld returned 1 exit status If I modify configuration line to gcc -std=gnu99 -o conftest -g -O2 -x c -fPIE -DPIE -pie -D_THREAD_SAFE conftest.c -lintl then it correctly detects lack of pie and build succeeds. configure:61033: checking whether C compiler handles -fPIE -DPIE configure:61052: gcc -std=gnu99 -o conftest -g -O2 -pie -fPIE -DPIE -D_THREAD_SAFE conftest.c -lintl >&5 /usr/local/bin/ld: /usr/lib/crt1.o: relocation R_X86_64_32 against `_DYNAMIC' can not be used when making a shared object; recompile with -fPIC /usr/lib/crt1.o: error adding symbols: Bad value collect2: ld returned 1 exit status configure:61052: $? = 1 Do you think it would be reasonable to add "-pie" to configure script? Regards, Wojtek 2014-03-20 15:51 GMT+01:00 Daniel P. Berrange : > On Thu, Mar 20, 2014 at 09:39:20AM +0100, Wojciech Macek wrote: > > Add possibility to choose whether the code is compiled with PIE > > or without. New configuration flags: > > --enable-pie (default) > > --disable-pie > > --- > > configure.ac | 14 +- > > 1 file changed, 13 insertions(+), 1 deletion(-) > > > > diff --git a/configure.ac b/configure.ac > > index 62b74c5..96a7038 100644 > > --- a/configure.ac > > +++ b/configure.ac > > @@ -215,7 +215,6 @@ fi > > # Check for compiler and library settings. > > > > LIBVIRT_COMPILE_WARNINGS > > -LIBVIRT_COMPILE_PIE > > LIBVIRT_LINKER_RELRO > > LIBVIRT_LINKER_NO_INDIRECT > > > > @@ -581,7 +580,20 @@ if test x"$enable_debug" = x"yes"; then > > AC_DEFINE([ENABLE_DEBUG], [], [whether debugging is enabled]) > > fi > > > > +dnl --enable-pie=(yes|no) > > +AC_ARG_ENABLE([pie], > > + [AS_HELP_STRING([--enable-pie=@<:@no|yes@:>@], > > + [enable Position-Independent-Executables > @<:@default=yes@:>@])], > > + [],[enable_pie=yes]) > > +AM_CONDITIONAL([ENABLE_PIE], test x"$enable_pie" = x"yes") > > +if test x"$enable_debug" = x"yes"; then > > + AC_DEFINE([ENABLE_PIE], [], [whether > Position-Independent-Executables are enabled]) > > +fi > > > > +# Check if Position-Independent-Executables should be supported > > +if test "$enable_pie" = "yes" ; then > > +LIBVIRT_COMPILE_PIE > > +fi > > IMHO the rationale behind this is pretty dubious. Can you elaborate > on exactly what errors you're getting with PIE builds, since presumably > they're working find for FreeBSD devs in general. If there are problems > that can't be avoided, then adding a configure flag is still the wrong > way to deal with them. We already probe to see if PIE mode works, so > if that's not detecting a problem we must improve that detection. > > > 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] [PATCHv2] gluster: Fix "key" attribute for gluster volumes
On 03/25/14 08:53, Peter Krempa wrote: > According to our documentation the "key" value has the following .. OOPS, git-send-email looked frozen when I was killing it. Apparently it managed to send the mail anyways. Ignore this one please. Peter signature.asc Description: OpenPGP digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCHv2] gluster: Fix "key" attribute for gluster volumes
According to our documentation the "key" value has the following meaning: "Providing an identifier for the volume which identifies a single volume." The currently used keys for gluster volumes consist of the gluster volume name and file path. This can't be considered unique as a different storage server can serve a volume with the same name. Unfortunately I wasn't able to figure out a way to retrieve the gluster volume UUID which would avoid the possibility of having two distinct keys identifying a single volume. Use the full URI as the key for the volume to avoid the more critical ambiguity problem and document the possible change to UUID. --- docs/storage.html.in | 6 -- src/storage/storage_backend_gluster.c | 10 -- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/docs/storage.html.in b/docs/storage.html.in index 2706bc5..f75996a 100644 --- a/docs/storage.html.in +++ b/docs/storage.html.in @@ -711,8 +711,10 @@ correspond to the files that can be found when mounting the gluster volume. The name is the path relative to the effective mount specified for the pool; and - the key is a path including the gluster volume - name and any subdirectory specified by the pool. + the key is a string that identifies a single volume + uniquely. Currently the key attribute consists of the + URI of the volume but it may be changed to an UUID of the volume + in the future.myfile diff --git a/src/storage/storage_backend_gluster.c b/src/storage/storage_backend_gluster.c index a22b23a..06292fa 100644 --- a/src/storage/storage_backend_gluster.c +++ b/src/storage/storage_backend_gluster.c @@ -187,6 +187,7 @@ virStorageBackendGlusterSetMetadata(virStorageBackendGlusterStatePtr state, const char *name) { int ret = -1; +char *path = NULL; char *tmp; VIR_FREE(vol->key); @@ -201,12 +202,12 @@ virStorageBackendGlusterSetMetadata(virStorageBackendGlusterStatePtr state, goto cleanup; } -if (virAsprintf(&vol->key, "%s%s%s", state->volname, state->dir, +if (virAsprintf(&path, "%s%s%s", state->volname, state->dir, vol->name) < 0) goto cleanup; tmp = state->uri->path; -if (virAsprintf(&state->uri->path, "/%s", vol->key) < 0) { +if (virAsprintf(&state->uri->path, "/%s", path) < 0) { state->uri->path = tmp; goto cleanup; } @@ -218,9 +219,14 @@ virStorageBackendGlusterSetMetadata(virStorageBackendGlusterStatePtr state, VIR_FREE(state->uri->path); state->uri->path = tmp; +/* the path is unique enough to serve as a volume key */ +if (VIR_STRDUP(vol->key, vol->target.path) < 0) +goto cleanup; + ret = 0; cleanup: +VIR_FREE(path); return ret; } -- 1.9.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] util: Sanitize ATTRIBUTE_NONNULL use in viriscsi.h
On 03/25/14 08:32, Ján Tomko wrote: > On 03/25/2014 08:23 AM, Peter Krempa wrote: >> Some of the function attributes marked as nonnull actually explicitly >> handle the arguments for NULL. All changed functions handle missing >> "initiatoriqn" argument well and virISCSIScanTargets also handles well >> if the return pointers are missing. Remove some of the liberaly used >> ATTRIBUTE_NONNULLs as coverity and possibly other compilers that honor >> the attribute fail to compile the code. >> >> Flaw introduced in commit 5e1d5dde >> --- >> src/util/viriscsi.h | 7 +++ >> 1 file changed, 3 insertions(+), 4 deletions(-) > > ACK > Pushed; Thanks. Peter 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] util: Sanitize ATTRIBUTE_NONNULL use in viriscsi.h
On 03/25/2014 08:23 AM, Peter Krempa wrote: > Some of the function attributes marked as nonnull actually explicitly > handle the arguments for NULL. All changed functions handle missing > "initiatoriqn" argument well and virISCSIScanTargets also handles well > if the return pointers are missing. Remove some of the liberaly used > ATTRIBUTE_NONNULLs as coverity and possibly other compilers that honor > the attribute fail to compile the code. > > Flaw introduced in commit 5e1d5dde > --- > src/util/viriscsi.h | 7 +++ > 1 file changed, 3 insertions(+), 4 deletions(-) ACK signature.asc Description: OpenPGP digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH] util: Sanitize ATTRIBUTE_NONNULL use in viriscsi.h
Some of the function attributes marked as nonnull actually explicitly handle the arguments for NULL. All changed functions handle missing "initiatoriqn" argument well and virISCSIScanTargets also handles well if the return pointers are missing. Remove some of the liberaly used ATTRIBUTE_NONNULLs as coverity and possibly other compilers that honor the attribute fail to compile the code. Flaw introduced in commit 5e1d5dde --- src/util/viriscsi.h | 7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/util/viriscsi.h b/src/util/viriscsi.h index b2dd3f1..f4093f7 100644 --- a/src/util/viriscsi.h +++ b/src/util/viriscsi.h @@ -33,14 +33,14 @@ int virISCSIConnectionLogin(const char *portal, const char *initiatoriqn, const char *target) -ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3) +ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(3) ATTRIBUTE_RETURN_CHECK; int virISCSIConnectionLogout(const char *portal, const char *initiatoriqn, const char *target) -ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3) +ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(3) ATTRIBUTE_RETURN_CHECK; int @@ -52,8 +52,7 @@ virISCSIScanTargets(const char *portal, const char *initiatoriqn, size_t *ntargetsret, char ***targetsret) -ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3) -ATTRIBUTE_NONNULL(4) ATTRIBUTE_RETURN_CHECK; +ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK; int virISCSINodeUpdate(const char *portal, -- 1.9.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 3/5] Free groups in case of a partial match
If there are more than two regexes, but only one of them matches, the matched groups would be leaked. --- src/util/vircommand.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/util/vircommand.c b/src/util/vircommand.c index c17792b..fab3aba 100644 --- a/src/util/vircommand.c +++ b/src/util/vircommand.c @@ -2858,10 +2858,10 @@ virCommandRunRegex(virCommandPtr cmd, if (i == nregex) { if (((*func)(groups, data)) < 0) goto cleanup; - -for (j = 0; j < totgroups; j++) -VIR_FREE(groups[j]); } + +for (j = 0; j < ngroup; j++) +VIR_FREE(groups[j]); } ret = 0; -- 1.8.3.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 5/5] Shift the for loop over matched vars by one
Instead of adding one to the iterator on every use. --- src/util/vircommand.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/util/vircommand.c b/src/util/vircommand.c index 7d13828..a21a88b 100644 --- a/src/util/vircommand.c +++ b/src/util/vircommand.c @@ -2845,10 +2845,10 @@ virCommandRunRegex(virCommandPtr cmd, if (regexec(®[i], p, nvars[i]+1, vars, 0) != 0) break; -for (j = 0; j < nvars[i]; j++) { -/* NB vars[0] is the full pattern, so we offset j by 1 */ -if (VIR_STRNDUP(groups[ngroup++], p + vars[j+1].rm_so, -vars[j+1].rm_eo - vars[j+1].rm_so) < 0) +/* NB vars[0] is the full pattern, so we offset j by 1 */ +for (j = 1; j <= nvars[i]; j++) { +if (VIR_STRNDUP(groups[ngroup++], p + vars[j].rm_so, +vars[j].rm_eo - vars[j].rm_so) < 0) goto cleanup; } -- 1.8.3.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 4/5] Use VIR_STRNDUP instead of modifying the matched string
--- src/util/vircommand.c | 7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/util/vircommand.c b/src/util/vircommand.c index fab3aba..7d13828 100644 --- a/src/util/vircommand.c +++ b/src/util/vircommand.c @@ -2832,7 +2832,7 @@ virCommandRunRegex(virCommandPtr cmd, goto cleanup; for (k = 0; lines[k]; k++) { -char *p = NULL; +const char *p = NULL; /* ignore any command prefix */ if (prefix) @@ -2845,11 +2845,10 @@ virCommandRunRegex(virCommandPtr cmd, if (regexec(®[i], p, nvars[i]+1, vars, 0) != 0) break; -/* NULL terminate each captured group in the line */ 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) +if (VIR_STRNDUP(groups[ngroup++], p + vars[j+1].rm_so, +vars[j+1].rm_eo - vars[j+1].rm_so) < 0) goto cleanup; } -- 1.8.3.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 2/5] Simplify the loop in virCommandRunRegex
Do not check for border iterator values inside the loop, move the code before/after the loop instead. --- src/util/vircommand.c | 20 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/src/util/vircommand.c b/src/util/vircommand.c index f1adb1e..c17792b 100644 --- a/src/util/vircommand.c +++ b/src/util/vircommand.c @@ -2840,13 +2840,11 @@ virCommandRunRegex(virCommandPtr cmd, if (!p) p = lines[k]; +ngroup = 0; for (i = 0; i < nregex; i++) { if (regexec(®[i], p, nvars[i]+1, vars, 0) != 0) break; -if (i == 0) -ngroup = 0; - /* NULL terminate each captured group in the line */ for (j = 0; j < nvars[i]; j++) { /* NB vars[0] is the full pattern, so we offset j by 1 */ @@ -2855,16 +2853,14 @@ virCommandRunRegex(virCommandPtr cmd, goto cleanup; } -/* We're matching on the last regex, so callback time */ -if (i == (nregex-1)) { -if (((*func)(groups, data)) < 0) -goto cleanup; +} +/* We've matched on the last regex, so callback time */ +if (i == nregex) { +if (((*func)(groups, data)) < 0) +goto cleanup; -/* Release matches & restart to matching the first regex */ -for (j = 0; j < totgroups; j++) -VIR_FREE(groups[j]); -ngroup = 0; -} +for (j = 0; j < totgroups; j++) +VIR_FREE(groups[j]); } } -- 1.8.3.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 0/5] virCommandRunRegex cleanups
Simplify the code. This should have no functional change (except for the impossible leak fix in 3/5). Most of this functionality is tested in viriscsitest. Ján Tomko (5): Remove useless 'maxReg' variable Simplify the loop in virCommandRunRegex Free groups in case of a partial match Use VIR_STRNDUP instead of modifying the matched string Shift the for loop over matched vars by one src/util/vircommand.c | 46 +++--- 1 file changed, 19 insertions(+), 27 deletions(-) -- 1.8.3.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 1/5] Remove useless 'maxReg' variable
It is used to break out of the loop early if one regex does not match. Use the 'break' statement instead. --- src/util/vircommand.c | 43 --- 1 file changed, 20 insertions(+), 23 deletions(-) diff --git a/src/util/vircommand.c b/src/util/vircommand.c index 8250634..f1adb1e 100644 --- a/src/util/vircommand.c +++ b/src/util/vircommand.c @@ -2782,7 +2782,6 @@ virCommandRunRegex(virCommandPtr cmd, int err; regex_t *reg; regmatch_t *vars = NULL; -int maxReg = 0; size_t i, j, k; int totgroups = 0, ngroup = 0, maxvars = 0; char **groups; @@ -2841,32 +2840,30 @@ virCommandRunRegex(virCommandPtr cmd, if (!p) p = lines[k]; -for (i = 0; i <= maxReg && i < nregex; i++) { -if (regexec(®[i], p, nvars[i]+1, vars, 0) == 0) { -maxReg++; +for (i = 0; i < nregex; i++) { +if (regexec(®[i], p, nvars[i]+1, vars, 0) != 0) +break; -if (i == 0) -ngroup = 0; +if (i == 0) +ngroup = 0; -/* NULL terminate each captured group in the line */ -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) -goto cleanup; -} +/* NULL terminate each captured group in the line */ +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) +goto cleanup; +} -/* We're matching on the last regex, so callback time */ -if (i == (nregex-1)) { -if (((*func)(groups, data)) < 0) -goto cleanup; +/* We're matching on the last regex, so callback time */ +if (i == (nregex-1)) { +if (((*func)(groups, data)) < 0) +goto cleanup; -/* Release matches & restart to matching the first regex */ -for (j = 0; j < totgroups; j++) -VIR_FREE(groups[j]); -maxReg = 0; -ngroup = 0; -} +/* Release matches & restart to matching the first regex */ +for (j = 0; j < totgroups; j++) +VIR_FREE(groups[j]); +ngroup = 0; } } } -- 1.8.3.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 24/24] Add a rule for indenting labels
Indent top-level labels by one space. Add the rule to HACKING and enforce it by syntax-check. --- HACKING | 31 ++- cfg.mk | 6 ++ docs/hacking.html.in | 37 ++--- 3 files changed, 38 insertions(+), 36 deletions(-) diff --git a/HACKING b/HACKING index 5d9cdca..586b960 100644 --- a/HACKING +++ b/HACKING @@ -232,22 +232,9 @@ but we do prefer that contributed code be formatted similarly. In short, use spaces-not-TABs for indentation, use 4 spaces for each indentation level, and other than that, follow the K&R style. -If you use Emacs, add the following to one of one of your start-up files -(e.g., ~/.emacs), to help ensure that you get indentation right: - - ;;; When editing C sources in libvirt, use this style. - (defun libvirt-c-mode () -"C mode with adjusted defaults for use with libvirt." -(interactive) -(c-set-style "K&R") -(setq indent-tabs-mode nil) ; indent using spaces, not TABs -(setq c-indent-level 4) -(setq c-basic-offset 4)) - (add-hook 'c-mode-hook -'(lambda () (if (string-match "/libvirt" (buffer-file-name)) -(libvirt-c-mode - -If you use vim, append the following to your ~/.vimrc file: +If you use Emacs, the project includes a file .dir-locals.el that sets up the +preferred indentation. If you use vim, append the following to your ~/.vimrc +file: set nocompatible filetype on @@ -257,7 +244,7 @@ If you use vim, append the following to your ~/.vimrc file: set tabstop=8 set shiftwidth=4 set expandtab - set cinoptions=(0,:0,l1,t0 + set cinoptions=(0,:0,l1,t0,L3 filetype plugin indent on au FileType make setlocal noexpandtab au BufRead,BufNewFile *.am setlocal noexpandtab @@ -928,6 +915,16 @@ When using goto, please use one of these standard labels if it makes sense: no_memory: A path only taken upon return with an OOM error code retry: If needing to jump upwards (e.g., retry on EINTR) +Top-level labels should be indented by one space (putting them on the +beginning of the line confuses function context detection in git): + +int foo() +{ +/* ... do stuff ... */ + cleanup: +/* ... do other stuff ... */ +} + Libvirt committer guidelines diff --git a/cfg.mk b/cfg.mk index 559f719..cbcf40b 100644 --- a/cfg.mk +++ b/cfg.mk @@ -898,6 +898,12 @@ sc_prohibit_virConnectOpen_in_virsh: halt='Use vshConnect() in virsh instead of virConnectOpen*'\ $(_sc_search_regexp) +sc_require_space_before_label: + @prohibit='^[_a-zA-Z0-9]+:$$' \ + in_vc_files='\.[ch]$$' \ + halt="Top-level labels should be indented by one space"\ + $(_sc_search_regexp) + sc_curly_braces_style: @files=$$($(VC_LIST_EXCEPT) | grep '\.[ch]$$');\ $(GREP) -nHP \ diff --git a/docs/hacking.html.in b/docs/hacking.html.in index 0febee2..b2ef85a 100644 --- a/docs/hacking.html.in +++ b/docs/hacking.html.in @@ -273,26 +273,11 @@ In short, use spaces-not-TABs for indentation, use 4 spaces for each indentation level, and other than that, follow the K&R style. - - If you use Emacs, add the following to one of one of your start-up files - (e.g., ~/.emacs), to help ensure that you get indentation right: - - - ;;; When editing C sources in libvirt, use this style. - (defun libvirt-c-mode () -"C mode with adjusted defaults for use with libvirt." -(interactive) -(c-set-style "K&R") -(setq indent-tabs-mode nil) ; indent using spaces, not TABs -(setq c-indent-level 4) -(setq c-basic-offset 4)) - (add-hook 'c-mode-hook -'(lambda () (if (string-match "/libvirt" (buffer-file-name)) -(libvirt-c-mode - - If you use vim, append the following to your ~/.vimrc file: + If you use Emacs, the project includes a file .dir-locals.el + that sets up the preferred indentation. If you use vim, + append the following to your ~/.vimrc file: set nocompatible @@ -303,7 +288,7 @@ set tabstop=8 set shiftwidth=4 set expandtab - set cinoptions=(0,:0,l1,t0 + set cinoptions=(0,:0,l1,t0,L3 filetype plugin indent on au FileType make setlocal noexpandtab au BufRead,BufNewFile *.am setlocal noexpandtab @@ -1139,6 +1124,20 @@ retry: If needing to jump upwards (e.g., retry on EINTR) + +Top-level labels should be indented by one space (putting them on +the beginning of the line confuses function context detection in git): + + + +int foo() +{ +/* ... do stuff ... */ + cleanup: +/* ... do other stuff ... */ +} + + Libvirt committer guidelines -- 1.8.3.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailm
[libvirt] [PATCH 23/24] Indent top-level labels by one space in tools/
--- tools/virsh-console.c| 4 +- tools/virsh-domain-monitor.c | 34 +++--- tools/virsh-domain.c | 196 +-- tools/virsh-edit.c | 6 +- tools/virsh-host.c | 14 +-- tools/virsh-interface.c | 8 +- tools/virsh-network.c| 14 +-- tools/virsh-nodedev.c| 14 +-- tools/virsh-nwfilter.c | 8 +- tools/virsh-pool.c | 14 +-- tools/virsh-secret.c | 18 ++-- tools/virsh-snapshot.c | 34 +++--- tools/virsh-volume.c | 24 ++--- tools/virsh.c| 12 +-- tools/virt-login-shell.c | 6 +- tools/wireshark/src/packet-libvirt.c | 2 +- 16 files changed, 204 insertions(+), 204 deletions(-) diff --git a/tools/virsh-console.c b/tools/virsh-console.c index 34a0578..9838a56 100644 --- a/tools/virsh-console.c +++ b/tools/virsh-console.c @@ -389,7 +389,7 @@ vshRunConsole(vshControl *ctl, ret = 0; -cleanup: + cleanup: virConsoleFree(con); /* Restore original signal handlers */ @@ -399,7 +399,7 @@ cleanup: sigaction(SIGHUP, &old_sighup, NULL); sigaction(SIGPIPE, &old_sigpipe, NULL); -resettty: + resettty: /* Put STDIN back into the (sane?) state we found it in before starting */ vshTTYRestore(ctl); diff --git a/tools/virsh-domain-monitor.c b/tools/virsh-domain-monitor.c index f474422..b0d79b9 100644 --- a/tools/virsh-domain-monitor.c +++ b/tools/virsh-domain-monitor.c @@ -105,7 +105,7 @@ vshGetDomainDescription(vshControl *ctl, virDomainPtr dom, bool title, if (!desc) desc = vshStrdup(ctl, ""); -cleanup: + cleanup: VIR_FREE(domxml); xmlXPathFreeContext(ctxt); xmlFreeDoc(doc); @@ -370,7 +370,7 @@ cmdDomMemStat(vshControl *ctl, const vshCmd *cmd) } ret = true; -cleanup: + cleanup: virDomainFree(dom); return ret; } @@ -425,7 +425,7 @@ cmdDomblkinfo(vshControl *ctl, const vshCmd *cmd) ret = true; -cleanup: + cleanup: virDomainFree(dom); return ret; } @@ -547,7 +547,7 @@ cmdDomblklist(vshControl *ctl, const vshCmd *cmd) ret = true; -cleanup: + cleanup: VIR_FREE(disks); virDomainFree(dom); VIR_FREE(xml); @@ -648,7 +648,7 @@ cmdDomiflist(vshControl *ctl, const vshCmd *cmd) ret = true; -cleanup: + cleanup: VIR_FREE(interfaces); virDomainFree(dom); VIR_FREE(xml); @@ -760,7 +760,7 @@ cmdDomIfGetLink(vshControl *ctl, const vshCmd *cmd) ret = true; -cleanup: + cleanup: VIR_FREE(desc); VIR_FREE(state); VIR_FREE(interfaces); @@ -819,7 +819,7 @@ cmdDomControl(vshControl *ctl, const vshCmd *cmd) vshDomainControlStateToString(info.state)); } -cleanup: + cleanup: virDomainFree(dom); return ret; } @@ -1008,7 +1008,7 @@ cmdDomblkstat(vshControl *ctl, const vshCmd *cmd) ret = true; -cleanup: + cleanup: VIR_FREE(params); virDomainFree(dom); return ret; @@ -1087,7 +1087,7 @@ cmdDomIfstat(vshControl *ctl, const vshCmd *cmd) ret = true; -cleanup: + cleanup: virDomainFree(dom); return ret; } @@ -1151,7 +1151,7 @@ cmdDomBlkError(vshControl *ctl, const vshCmd *cmd) ret = true; -cleanup: + cleanup: VIR_FREE(disks); virDomainFree(dom); return ret; @@ -1350,7 +1350,7 @@ cmdDomstate(vshControl *ctl, const vshCmd *cmd) vshDomainStateToString(state)); } -cleanup: + cleanup: virDomainFree(dom); return ret; } @@ -1474,7 +1474,7 @@ vshDomainListCollect(vshControl *ctl, unsigned int flags) goto cleanup; -fallback: + fallback: /* fall back to old method (0.9.12 and older) */ vshResetLibvirtError(); @@ -1534,7 +1534,7 @@ fallback: /* truncate domains that weren't found */ deleted = (nids + nnames) - list->ndomains; -filter: + filter: /* filter list the list if the list was acquired by fallback means */ for (i = 0; i < list->ndomains; i++) { dom = list->domains[i]; @@ -1610,14 +1610,14 @@ filter: /* the domain matched all filters, it may stay */ continue; -remove_entry: + remove_entry: /* the domain has to be removed as it failed one of the filters */ virDomainFree(list->domains[i]); list->domains[i] = NULL; deleted++; } -finished: + finished: /* sort the list */ if (list->domains && list->ndomains) qsort(list->domains, list->ndomains, sizeof(*list->domains), @@ -1629,7 +1629,7 @@ finished: success = true; -cleanup: + cleanup: for (i = 0; nnames != -1 && i < nnames; i++) VIR_FREE(names[i]); @@ -1838,7 +1838,7 @@ cmdList(vshControl *ctl, const vshCmd *cmd) } ret = true; -cleanup: + cleanup: vshDomainListFree(list); return ret; } diff --git a/tools/virsh-domain.c b/tools/virsh-domain
[libvirt] [PATCH 17/24] Indent top-level labels by one space in src/test/
--- src/test/test_driver.c | 272 - 1 file changed, 136 insertions(+), 136 deletions(-) diff --git a/src/test/test_driver.c b/src/test/test_driver.c index 5694680..ef88d4b 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -294,7 +294,7 @@ testDomainDefNamespaceParse(xmlDocPtr xml ATTRIBUTE_UNUSED, *data = nsdata; return 0; -error: + error: VIR_FREE(nodes); testDomainDefNamespaceFree(nsdata); return -1; @@ -385,7 +385,7 @@ testBuildCapabilities(virConnectPtr conn) return caps; -error: + error: virObjectUnref(caps); return NULL; } @@ -642,7 +642,7 @@ testDomainUpdateVCPUs(testConnPtr privconn, dom->def->vcpus = nvcpus; ret = 0; -cleanup: + cleanup: return ret; } @@ -685,7 +685,7 @@ testDomainStartState(testConnPtr privconn, dom->hasManagedSave = false; ret = 0; -cleanup: + cleanup: if (ret < 0) testDomainShutdownState(NULL, dom, VIR_DOMAIN_SHUTOFF_FAILED); return ret; @@ -835,7 +835,7 @@ testOpenDefault(virConnectPtr conn) return VIR_DRV_OPEN_SUCCESS; -error: + error: virObjectUnref(privconn->domains); virNetworkObjListFree(&privconn->networks); virInterfaceObjListFree(&privconn->ifaces); @@ -915,7 +915,7 @@ testParseXMLDocFromFile(xmlNodePtr node, const char *file, const char *type) ret = node; } -error: + error: xmlFreeDoc(doc); VIR_FREE(absFile); return ret; @@ -1006,7 +1006,7 @@ testParseNodeInfo(virNodeInfoPtr nodeInfo, xmlXPathContextPtr ctxt) } return 0; -error: + error: return -1; } @@ -1063,7 +1063,7 @@ testParseDomainSnapshots(testConnPtr privconn, } ret = 0; -error: + error: return ret; } @@ -1129,7 +1129,7 @@ testParseDomains(testConnPtr privconn, } ret = 0; -error: + error: VIR_FREE(nodes); return ret; } @@ -1170,7 +1170,7 @@ testParseNetworks(testConnPtr privconn, } ret = 0; -error: + error: VIR_FREE(nodes); return ret; } @@ -1211,7 +1211,7 @@ testParseInterfaces(testConnPtr privconn, } ret = 0; -error: + error: VIR_FREE(nodes); return ret; } @@ -1267,7 +1267,7 @@ testOpenVolumesForPool(const char *file, } ret = 0; -error: + error: virStorageVolDefFree(def); VIR_FREE(nodes); return ret; @@ -1321,7 +1321,7 @@ testParseStorage(testConnPtr privconn, } ret = 0; -error: + error: VIR_FREE(nodes); return ret; } @@ -1361,7 +1361,7 @@ testParseNodedevs(testConnPtr privconn, } ret = 0; -error: + error: VIR_FREE(nodes); return ret; } @@ -1401,7 +1401,7 @@ testParseAuthUsers(testConnPtr privconn, } ret = 0; -error: + error: VIR_FREE(nodes); return ret; } @@ -1520,7 +1520,7 @@ testConnectAuthenticate(virConnectPtr conn, } i = -1; -found_user: + found_user: /* Even if we didn't find the user, we still ask for a password. */ if (i == -1 || privconn->auths[i].password != NULL) { password = virAuthGetPassword(conn, auth, "test", @@ -1540,7 +1540,7 @@ found_user: } ret = 0; -cleanup: + cleanup: VIR_FREE(username); VIR_FREE(password); return ret; @@ -1726,7 +1726,7 @@ static int testDomainIsActive(virDomainPtr dom) } ret = virDomainObjIsActive(obj); -cleanup: + cleanup: if (obj) virObjectUnlock(obj); return ret; @@ -1747,7 +1747,7 @@ static int testDomainIsPersistent(virDomainPtr dom) } ret = obj->persistent; -cleanup: + cleanup: if (obj) virObjectUnlock(obj); return ret; @@ -1797,7 +1797,7 @@ testDomainCreateXML(virConnectPtr conn, const char *xml, if (ret) ret->id = dom->def->id; -cleanup: + cleanup: if (dom) virObjectUnlock(dom); if (event) @@ -1828,7 +1828,7 @@ static virDomainPtr testDomainLookupByID(virConnectPtr conn, if (ret) ret->id = dom->def->id; -cleanup: + cleanup: if (dom) virObjectUnlock(dom); return ret; @@ -1854,7 +1854,7 @@ static virDomainPtr testDomainLookupByUUID(virConnectPtr conn, if (ret) ret->id = dom->def->id; -cleanup: + cleanup: if (dom) virObjectUnlock(dom); return ret; @@ -1880,7 +1880,7 @@ static virDomainPtr testDomainLookupByName(virConnectPtr conn, if (ret) ret->id = dom->def->id; -cleanup: + cleanup: if (dom) virObjectUnlock(dom); return ret; @@ -1928,7 +1928,7 @@ static int testDomainDestroy(virDomainPtr domain) } ret = 0; -cleanup: + cleanup: if (privdom) virObjectUnlock(privdom); if (event) @@ -1967,7 +1967,7 @@ static int testDomainResume(virDomainPtr domain) VIR_DOMAIN_EVENT_RESUMED_UNPAUSED); ret = 0; -cleanup: + cleanup: if (privdom) virObjectUnlock(privdom); if (event) { @@ -2009,7 +2009,7 @@ static
[libvirt] [PATCH 15/24] Indent top-level labels by one space in src/rpc/
--- src/rpc/virkeepalive.c| 6 +++--- src/rpc/virnetclient.c| 22 +++--- src/rpc/virnetclientprogram.c | 6 +++--- src/rpc/virnetclientstream.c | 14 +++--- src/rpc/virnetmessage.c | 18 +- src/rpc/virnetsaslcontext.c | 28 ++-- src/rpc/virnetserver.c| 30 +++--- src/rpc/virnetserverclient.c | 18 +- src/rpc/virnetserverprogram.c | 8 src/rpc/virnetserverservice.c | 12 ++-- src/rpc/virnetsocket.c| 36 ++-- src/rpc/virnetsshsession.c| 26 +- src/rpc/virnettlscontext.c| 28 ++-- 13 files changed, 126 insertions(+), 126 deletions(-) diff --git a/src/rpc/virkeepalive.c b/src/rpc/virkeepalive.c index f5c48b7..c882313 100644 --- a/src/rpc/virkeepalive.c +++ b/src/rpc/virkeepalive.c @@ -108,7 +108,7 @@ virKeepAliveMessage(virKeepAlivePtr ka, int proc) return msg; -error: + error: VIR_WARN("Failed to generate keepalive %s", procstr); return NULL; } @@ -181,7 +181,7 @@ virKeepAliveTimer(int timer ATTRIBUTE_UNUSED, void *opaque) virObjectLock(ka); virObjectUnref(ka); -cleanup: + cleanup: virObjectUnlock(ka); } @@ -294,7 +294,7 @@ virKeepAliveStart(virKeepAlivePtr ka, virObjectRef(ka); ret = 0; -cleanup: + cleanup: virObjectUnlock(ka); return ret; } diff --git a/src/rpc/virnetclient.c b/src/rpc/virnetclient.c index 255997b..a156fe1 100644 --- a/src/rpc/virnetclient.c +++ b/src/rpc/virnetclient.c @@ -329,7 +329,7 @@ static virNetClientPtr virNetClientNew(virNetSocketPtr sock, client, client->sock); return client; -error: + error: VIR_FORCE_CLOSE(wakeupFD[0]); VIR_FORCE_CLOSE(wakeupFD[1]); virObjectUnref(client); @@ -484,7 +484,7 @@ virNetClientPtr virNetClientNewLibSSH2(const char *host, goto cleanup; sock = NULL; -cleanup: + cleanup: VIR_FREE(command); VIR_FREE(privkey); VIR_FREE(knownhosts); @@ -494,7 +494,7 @@ cleanup: virObjectUnref(sock); return ret; -no_memory: + no_memory: virReportOOMError(); goto cleanup; } @@ -834,7 +834,7 @@ int virNetClientSetTLSSession(virNetClientPtr client, virObjectUnlock(client); return 0; -error: + error: virObjectUnref(client->tls); client->tls = NULL; virObjectUnlock(client); @@ -886,7 +886,7 @@ int virNetClientAddProgram(virNetClientPtr client, virObjectUnlock(client); return 0; -error: + error: virObjectUnlock(client); return -1; } @@ -905,7 +905,7 @@ int virNetClientAddStream(virNetClientPtr client, virObjectUnlock(client); return 0; -error: + error: virObjectUnlock(client); return -1; } @@ -926,7 +926,7 @@ void virNetClientRemoveStream(virNetClientPtr client, VIR_DELETE_ELEMENT(client->streams, i, client->nstreams); virObjectUnref(st); -cleanup: + cleanup: virObjectUnlock(client); } @@ -1597,7 +1597,7 @@ static int virNetClientIOEventLoop(virNetClientPtr client, } } -error: + error: virNetClientCallRemove(&client->waitDispatch, thiscall); virNetClientIOEventLoopPassTheBuck(client, thiscall); return -1; @@ -1792,7 +1792,7 @@ static int virNetClientIO(virNetClientPtr client, virGetLastError()) rv = -1; -cleanup: + cleanup: VIR_DEBUG("All done with our call head=%p call=%p rv=%d", client->waitDispatch, thiscall, rv); return rv; @@ -1843,7 +1843,7 @@ void virNetClientIncomingEvent(virNetSocketPtr sock, NULL); virNetClientIOUpdateCallback(client, true); -done: + done: if (client->wantClose && !client->haveTheBuck) { virNetClientCloseLocked(client); virNetClientCallRemovePredicate(&client->waitDispatch, @@ -1900,7 +1900,7 @@ virNetClientCallNew(virNetMessagePtr msg, return call; -error: + error: VIR_FREE(call); return NULL; } diff --git a/src/rpc/virnetclientprogram.c b/src/rpc/virnetclientprogram.c index 3ff27d3..e620dec 100644 --- a/src/rpc/virnetclientprogram.c +++ b/src/rpc/virnetclientprogram.c @@ -188,7 +188,7 @@ virNetClientProgramDispatchError(virNetClientProgramPtr prog ATTRIBUTE_UNUSED, ret = 0; -cleanup: + cleanup: xdr_free((xdrproc_t)xdr_virNetMessageError, (void*)&err); return ret; } @@ -262,7 +262,7 @@ int virNetClientProgramDispatch(virNetClientProgramPtr prog, xdr_free(event->msg_filter, evdata); -cleanup: + cleanup: VIR_FREE(evdata); return 0; } @@ -394,7 +394,7 @@ int virNetClientProgramCall(virNetClientProgramPtr prog, return 0; -error: + error: virNetMessageFree(msg); if (infds && ninfds) { for (i = 0; i < *ninfds; i++) diff --git a/src/rpc/virnetclientstream.c b/src/rpc/virnetclientstream.c index 521bdda..b428f4b 100644 --- a/src/rpc/virnetclien
[libvirt] [PATCH 20/24] Indent top-level labels by one space in src/xen/
--- src/xen/xen_driver.c | 112 +++ src/xen/xen_hypervisor.c | 4 +- src/xen/xen_inotify.c| 4 +- src/xen/xend_internal.c | 46 +-- src/xen/xm_internal.c| 28 ++-- src/xen/xs_internal.c| 12 ++--- 6 files changed, 103 insertions(+), 103 deletions(-) diff --git a/src/xen/xen_driver.c b/src/xen/xen_driver.c index 2199cb0..0fca7be 100644 --- a/src/xen/xen_driver.c +++ b/src/xen/xen_driver.c @@ -248,7 +248,7 @@ xenDomainUsedCpus(virDomainPtr dom, virDomainDefPtr def) res = virBitmapFormat(cpulist); } -done: + done: virBitmapFree(cpulist); VIR_FREE(cpumap); VIR_FREE(cpuinfo); @@ -523,7 +523,7 @@ xenUnifiedConnectOpen(virConnectPtr conn, virConnectAuthPtr auth, unsigned int f return VIR_DRV_OPEN_SUCCESS; -error: + error: VIR_DEBUG("Failed to activate a mandatory sub-driver"); #if WITH_XEN_INOTIFY if (priv->opened[XEN_UNIFIED_INOTIFY_OFFSET]) @@ -764,7 +764,7 @@ xenUnifiedDomainCreateXML(virConnectPtr conn, if (ret) ret->id = def->id; -cleanup: + cleanup: virDomainDefFree(def); return ret; } @@ -786,7 +786,7 @@ xenUnifiedDomainLookupByID(virConnectPtr conn, int id) ret->id = def->id; -cleanup: + cleanup: virDomainDefFree(def); return ret; } @@ -809,7 +809,7 @@ xenUnifiedDomainLookupByUUID(virConnectPtr conn, ret->id = def->id; -cleanup: + cleanup: virDomainDefFree(def); return ret; } @@ -832,7 +832,7 @@ xenUnifiedDomainLookupByName(virConnectPtr conn, ret->id = def->id; -cleanup: + cleanup: virDomainDefFree(def); return ret; } @@ -849,7 +849,7 @@ xenUnifiedDomainIsActive(virDomainPtr dom) ret = def->id == -1 ? 0 : 1; -cleanup: + cleanup: virDomainDefFree(def); return ret; } @@ -893,7 +893,7 @@ xenUnifiedDomainIsPersistent(virDomainPtr dom) } } -cleanup: + cleanup: virDomainDefFree(def); return ret; @@ -919,7 +919,7 @@ xenUnifiedDomainSuspend(virDomainPtr dom) ret = xenDaemonDomainSuspend(dom->conn, def); -cleanup: + cleanup: virDomainDefFree(def); return ret; } @@ -938,7 +938,7 @@ xenUnifiedDomainResume(virDomainPtr dom) ret = xenDaemonDomainResume(dom->conn, def); -cleanup: + cleanup: virDomainDefFree(def); return ret; } @@ -960,7 +960,7 @@ xenUnifiedDomainShutdownFlags(virDomainPtr dom, ret = xenDaemonDomainShutdown(dom->conn, def); -cleanup: + cleanup: virDomainDefFree(def); return ret; } @@ -987,7 +987,7 @@ xenUnifiedDomainReboot(virDomainPtr dom, unsigned int flags) ret = xenDaemonDomainReboot(dom->conn, def); -cleanup: + cleanup: virDomainDefFree(def); return ret; } @@ -1009,7 +1009,7 @@ xenUnifiedDomainDestroyFlags(virDomainPtr dom, ret = xenDaemonDomainDestroy(dom->conn, def); -cleanup: + cleanup: virDomainDefFree(def); return ret; } @@ -1045,7 +1045,7 @@ xenUnifiedDomainGetOSType(virDomainPtr dom) ret = xenHypervisorDomainGetOSType(dom->conn, def); } -cleanup: + cleanup: virDomainDefFree(def); return ret; } @@ -1073,7 +1073,7 @@ xenUnifiedDomainGetMaxMemory(virDomainPtr dom) ret = xenHypervisorGetMaxMemory(dom->conn, def); } -cleanup: + cleanup: virDomainDefFree(def); return ret; } @@ -1100,7 +1100,7 @@ xenUnifiedDomainSetMaxMemory(virDomainPtr dom, unsigned long memory) ret = xenHypervisorSetMaxMemory(dom->conn, def, memory); } -cleanup: + cleanup: virDomainDefFree(def); return ret; } @@ -1123,7 +1123,7 @@ xenUnifiedDomainSetMemory(virDomainPtr dom, unsigned long memory) else ret = xenDaemonDomainSetMemory(dom->conn, def, memory); -cleanup: + cleanup: virDomainDefFree(def); return ret; } @@ -1150,7 +1150,7 @@ xenUnifiedDomainGetInfo(virDomainPtr dom, virDomainInfoPtr info) ret = xenHypervisorGetDomainInfo(dom->conn, def, info); } -cleanup: + cleanup: virDomainDefFree(def); return ret; } @@ -1182,7 +1182,7 @@ xenUnifiedDomainGetState(virDomainPtr dom, ret = xenHypervisorGetDomainState(dom->conn, def, state, reason); } -cleanup: + cleanup: virDomainDefFree(def); return ret; } @@ -1210,7 +1210,7 @@ xenUnifiedDomainSaveFlags(virDomainPtr dom, const char *to, const char *dxml, ret = xenDaemonDomainSave(dom->conn, def, to); -cleanup: + cleanup: virDomainDefFree(def); return ret; } @@ -1255,7 +1255,7 @@ xenUnifiedDomainManagedSave(virDomainPtr dom, unsigned int flags) ret = xenDaemonDomainSave(dom->conn, def, name); -cleanup: + cleanup: VIR_FREE(name); virDomainDefFree(def); return ret; @@ -1282,7 +1282,7 @@ xenUnifiedDomainHasManagedSaveImage(virDomainPtr dom, unsigned int flags) ret = virFileExists(name); -cleanup: + cleanup: VIR_FREE(name); virDomainDefFree(def); return ret; @@ -1309,7 +1309,7 @@ xenUn
[libvirt] [PATCH 14/24] Indent top-level labels by one space in src/remote/
--- src/remote/remote_driver.c | 268 ++--- 1 file changed, 134 insertions(+), 134 deletions(-) diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c index 72545df..ed7dde6 100644 --- a/src/remote/remote_driver.c +++ b/src/remote/remote_driver.c @@ -1336,7 +1336,7 @@ remoteConnectGetType(virConnectPtr conn) /* Stash. */ rv = priv->type = ret.type; -done: + done: remoteDriverUnlock(priv); return rv; } @@ -1364,7 +1364,7 @@ static int remoteConnectIsSecure(virConnectPtr conn) */ rv = priv->is_secure && ret.secure ? 1 : 0; -done: + done: remoteDriverUnlock(priv); return rv; } @@ -1395,7 +1395,7 @@ static int remoteConnectIsEncrypted(virConnectPtr conn) */ rv = encrypted && ret.secure ? 1 : 0; -done: + done: remoteDriverUnlock(priv); return rv; } @@ -1458,9 +1458,9 @@ remoteNodeGetCPUStats(virConnectPtr conn, rv = 0; -cleanup: + cleanup: xdr_free((xdrproc_t) xdr_remote_node_get_cpu_stats_ret, (char *) &ret); -done: + done: remoteDriverUnlock(priv); return rv; } @@ -1522,9 +1522,9 @@ remoteNodeGetMemoryStats(virConnectPtr conn, rv = 0; -cleanup: + cleanup: xdr_free((xdrproc_t) xdr_remote_node_get_memory_stats_ret, (char *) &ret); -done: + done: remoteDriverUnlock(priv); return rv; } @@ -1566,7 +1566,7 @@ remoteNodeGetCellsFreeMemory(virConnectPtr conn, rv = ret.cells.cells_len; -done: + done: remoteDriverUnlock(priv); return rv; } @@ -1608,10 +1608,10 @@ remoteConnectListDomains(virConnectPtr conn, int *ids, int maxids) rv = ret.ids.ids_len; -cleanup: + cleanup: xdr_free((xdrproc_t) xdr_remote_connect_list_domains_ret, (char *) &ret); -done: + done: remoteDriverUnlock(priv); return rv; } @@ -1667,7 +1667,7 @@ remoteConnectListAllDomains(virConnectPtr conn, rv = ret.ret; -cleanup: + cleanup: if (doms) { for (i = 0; i < ret.domains.domains_len; i++) if (doms[i]) @@ -1677,7 +1677,7 @@ cleanup: xdr_free((xdrproc_t) xdr_remote_connect_list_all_domains_ret, (char *) &ret); -done: + done: remoteDriverUnlock(priv); return rv; } @@ -1756,7 +1756,7 @@ remoteSerializeTypedParameters(virTypedParameterPtr params, val = NULL; rv = 0; -cleanup: + cleanup: remoteFreeTypedParameters(val, nparams); return rv; } @@ -1839,7 +1839,7 @@ remoteDeserializeTypedParameters(remote_typed_param *ret_params_val, rv = 0; -cleanup: + cleanup: if (rv < 0) { if (userAllocated) { virTypedParamsClear(*params, i); @@ -1875,7 +1875,7 @@ remoteDeserializeDomainDiskErrors(remote_domain_disk_error *ret_errors_val, return 0; -error: + error: for (j = 0; j < i; j++) VIR_FREE(errors[i].disk); @@ -1937,10 +1937,10 @@ remoteDomainBlockStatsFlags(virDomainPtr domain, rv = 0; -cleanup: + cleanup: xdr_free((xdrproc_t) xdr_remote_domain_block_stats_flags_ret, (char *) &ret); -done: + done: remoteDriverUnlock(priv); return rv; } @@ -1985,10 +1985,10 @@ remoteDomainGetMemoryParameters(virDomainPtr domain, rv = 0; -cleanup: + cleanup: xdr_free((xdrproc_t) xdr_remote_domain_get_memory_parameters_ret, (char *) &ret); -done: + done: remoteDriverUnlock(priv); return rv; } @@ -2033,10 +2033,10 @@ remoteDomainGetNumaParameters(virDomainPtr domain, rv = 0; -cleanup: + cleanup: xdr_free((xdrproc_t) xdr_remote_domain_get_numa_parameters_ret, (char *) &ret); -done: + done: remoteDriverUnlock(priv); return rv; } @@ -2081,10 +2081,10 @@ remoteDomainGetBlkioParameters(virDomainPtr domain, rv = 0; -cleanup: + cleanup: xdr_free((xdrproc_t) xdr_remote_domain_get_blkio_parameters_ret, (char *) &ret); -done: + done: remoteDriverUnlock(priv); return rv; } @@ -2154,10 +2154,10 @@ remoteDomainGetVcpuPinInfo(virDomainPtr domain, rv = ret.num; -cleanup: + cleanup: xdr_free((xdrproc_t) xdr_remote_domain_get_vcpu_pin_info_ret, (char *) &ret); -done: + done: remoteDriverUnlock(priv); return rv; } @@ -2195,7 +2195,7 @@ remoteDomainPinEmulator(virDomainPtr dom, rv = 0; -done: + done: remoteDriverUnlock(priv); return rv; } @@ -2250,11 +2250,11 @@ remoteDomainGetEmulatorPinInfo(virDomainPtr domain, rv = ret.ret; -cleanup: + cleanup: xdr_free((xdrproc_t) xdr_remote_domain_get_emulator_pin_info_ret, (char *) &ret); -done: + done: remoteDriverUnlock(priv); return rv; } @@ -2326,10 +2326,10 @@ remoteDomainGetVcpus(virDomainPtr domain, rv = ret.info.info_len; -cleanup: + cleanup: xdr_free((xdrproc_t) xdr_remote_domain_get_vcpus_ret, (char *) &ret); -done: + done: remoteDriverUnlock(priv); return rv; } @@ -2366,10 +2366,10 @@ remoteDomainGetSecurityLabel(virDomainPtr d
[libvirt] [PATCH 19/24] Indent top-level labels by one space in src/vbox/
--- src/vbox/vbox_MSCOMGlue.c | 6 +-- src/vbox/vbox_XPCOMCGlue.c | 2 +- src/vbox/vbox_tmpl.c | 106 ++--- 3 files changed, 57 insertions(+), 57 deletions(-) diff --git a/src/vbox/vbox_MSCOMGlue.c b/src/vbox/vbox_MSCOMGlue.c index 0a0b4d1..c1d3ec3 100644 --- a/src/vbox/vbox_MSCOMGlue.c +++ b/src/vbox/vbox_MSCOMGlue.c @@ -389,7 +389,7 @@ vboxLookupRegistryValue(HKEY key, const char *keyName, const char *valueName) value[length] = '\0'; } - cleanup: + cleanup: return value; } @@ -441,7 +441,7 @@ vboxLookupVersionInRegistry(void) result = 0; - cleanup: + cleanup: VIR_FREE(value); RegCloseKey(key); @@ -580,7 +580,7 @@ vboxComInitialize_v2(const char *pszVirtualBoxIID, IVirtualBox **ppVirtualBox, result = 0; - cleanup: + cleanup: if (result < 0) { if (vboxVirtualBox != NULL) { vboxVirtualBox->vtbl->nsisupports.Release((nsISupports *)vboxVirtualBox); diff --git a/src/vbox/vbox_XPCOMCGlue.c b/src/vbox/vbox_XPCOMCGlue.c index 7775079..d0c4a15 100644 --- a/src/vbox/vbox_XPCOMCGlue.c +++ b/src/vbox/vbox_XPCOMCGlue.c @@ -164,7 +164,7 @@ tryLoadOne(const char *dir, bool setAppHome, bool ignoreMissing, VIR_DEBUG("Found %s in dynamic linker search path", DYNLIB_NAME); } -cleanup: + cleanup: if (hVBoxXPCOMC != NULL && result < 0) { dlclose(hVBoxXPCOMC); hVBoxXPCOMC = NULL; diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c index 06b24b3..5839184 100644 --- a/src/vbox/vbox_tmpl.c +++ b/src/vbox/vbox_tmpl.c @@ -856,7 +856,7 @@ vboxSocketParseAddrUtf16(vboxGlobalData *data, const PRUnichar *utf16, result = 0; -cleanup: + cleanup: VBOX_UTF8_FREE(utf8); return result; @@ -907,7 +907,7 @@ static virCapsPtr vboxCapsInit(void) return caps; -no_memory: + no_memory: virObjectUnref(caps); return NULL; } @@ -960,7 +960,7 @@ vboxInitialize(vboxGlobalData *data) return 0; -cleanup: + cleanup: return -1; } @@ -1202,7 +1202,7 @@ static int vboxConnectListDomains(virConnectPtr conn, int *ids, int nids) } } -cleanup: + cleanup: vboxArrayRelease(&machines); return ret; } @@ -1238,7 +1238,7 @@ static int vboxConnectNumOfDomains(virConnectPtr conn) } } -cleanup: + cleanup: vboxArrayRelease(&machines); return ret; } @@ -1569,7 +1569,7 @@ static int vboxDomainIsPersistent(virDomainPtr dom ATTRIBUTE_UNUSED) ret = 1; -cleanup: + cleanup: VBOX_RELEASE(machine); vboxIIDUnalloc(&iid); return ret; @@ -1595,7 +1595,7 @@ static int vboxDomainIsUpdated(virDomainPtr dom ATTRIBUTE_UNUSED) ret = 0; -cleanup: + cleanup: VBOX_RELEASE(machine); vboxIIDUnalloc(&iid); return ret; @@ -1647,7 +1647,7 @@ static int vboxDomainSuspend(virDomainPtr dom) } } -cleanup: + cleanup: VBOX_RELEASE(machine); vboxIIDUnalloc(&iid); return ret; @@ -1700,7 +1700,7 @@ static int vboxDomainResume(virDomainPtr dom) } } -cleanup: + cleanup: VBOX_RELEASE(machine); vboxIIDUnalloc(&iid); return ret; @@ -1754,7 +1754,7 @@ static int vboxDomainShutdownFlags(virDomainPtr dom, VBOX_SESSION_CLOSE(); } -cleanup: + cleanup: VBOX_RELEASE(machine); vboxIIDUnalloc(&iid); return ret; @@ -1809,7 +1809,7 @@ static int vboxDomainReboot(virDomainPtr dom, unsigned int flags) } } -cleanup: + cleanup: VBOX_RELEASE(machine); vboxIIDUnalloc(&iid); return ret; @@ -1871,7 +1871,7 @@ vboxDomainDestroyFlags(virDomainPtr dom, VBOX_SESSION_CLOSE(); } -cleanup: + cleanup: VBOX_RELEASE(machine); vboxIIDUnalloc(&iid); return ret; @@ -1946,7 +1946,7 @@ static int vboxDomainSetMemory(virDomainPtr dom, unsigned long memory) } } -cleanup: + cleanup: VBOX_RELEASE(machine); vboxIIDUnalloc(&iid); return ret; @@ -2050,7 +2050,7 @@ static int vboxDomainGetInfo(virDomainPtr dom, virDomainInfoPtr info) vboxArrayRelease(&machines); -cleanup: + cleanup: return ret; } @@ -2085,7 +2085,7 @@ vboxDomainGetState(virDomainPtr dom, ret = 0; -cleanup: + cleanup: vboxIIDUnalloc(&domiid); return ret; } @@ -2356,10 +2356,10 @@ static void vboxHostDeviceGetXMLDesc(vboxGlobalData *data, virDomainDefPtr def, USBFilterCount++; } -release_filters: + release_filters: vboxArrayRelease(&deviceFilters); #if VBOX_API_VERSION < 4003000 -release_controller: + release_controller: VBOX_RELEASE(USBController); #else VBOX_RELEASE(USBDeviceFilters); @@ -2367,7 +2367,7 @@ release_controller: return; -release_hostdevs: + release_hostdevs: for (i = 0; i < def->nhostdevs; i++) virDomainHostdevDefFree(def->hostdevs[i]); VIR_FREE(def->hostdevs); @@ -3047,7 +3047,7 @@ static char *vboxDomainGetXMLDesc(virDomainPtr dom, unsigned int
[libvirt] [PATCH 11/24] Indent top-level labels by one space in src/nwfilter/
--- src/nwfilter/nwfilter_dhcpsnoop.c | 42 +++ src/nwfilter/nwfilter_driver.c| 22 src/nwfilter/nwfilter_ebiptables_driver.c | 36 +- src/nwfilter/nwfilter_gentech_driver.c| 12 - src/nwfilter/nwfilter_learnipaddr.c | 8 +++--- 5 files changed, 60 insertions(+), 60 deletions(-) diff --git a/src/nwfilter/nwfilter_dhcpsnoop.c b/src/nwfilter/nwfilter_dhcpsnoop.c index 3407604..df46a72 100644 --- a/src/nwfilter/nwfilter_dhcpsnoop.c +++ b/src/nwfilter/nwfilter_dhcpsnoop.c @@ -498,7 +498,7 @@ virNWFilterSnoopIPLeaseInstallRule(virNWFilterSnoopIPLeasePtr ipl, req->filtername, req->vars); -exit_snooprequnlock: + exit_snooprequnlock: virNWFilterSnoopReqUnlock(req); VIR_FREE(ipaddr); @@ -605,10 +605,10 @@ virNWFilterSnoopReqNew(const char *ifkey) return req; -err_destroy_mutex: + err_destroy_mutex: virMutexDestroy(&req->lock); -err_free_req: + err_free_req: VIR_FREE(req); return NULL; @@ -786,7 +786,7 @@ virNWFilterSnoopReqLeaseAdd(virNWFilterSnoopReqPtr req, virAtomicIntInc(&virNWFilterSnoopState.nLeases); -exit: + exit: if (update_leasefile) virNWFilterSnoopLeaseFileSave(pl); @@ -897,12 +897,12 @@ virNWFilterSnoopReqLeaseDel(virNWFilterSnoopReqPtr req, } -skip_instantiate: + skip_instantiate: VIR_FREE(ipl); virAtomicIntDecAndTest(&virNWFilterSnoopState.nLeases); -lease_not_found: + lease_not_found: VIR_FREE(ipstr); virNWFilterSnoopReqUnlock(req); @@ -960,7 +960,7 @@ virNWFilterSnoopDHCPGetOpt(virNWFilterSnoopDHCPHdrPtr pd, int len, oind += pd->d_opts[oind + 1] + 2; } return 0; -malformed: + malformed: VIR_WARN("got lost in the options!"); return -1; } @@ -1149,11 +1149,11 @@ virNWFilterSnoopDHCPOpen(const char *ifname, virMacAddr *mac, return handle; -cleanup_freecode: + cleanup_freecode: pcap_freecode(&fp); -cleanup: + cleanup: pcap_close(handle); -cleanup_nohandle: + cleanup_nohandle: VIR_FREE(ext_filter); return NULL; @@ -1562,7 +1562,7 @@ virNWFilterDHCPSnoopThread(void *req0) virNWFilterSnoopReqUnlock(req); virNWFilterSnoopUnlock(); -exit: + exit: virThreadPoolFree(worker); virNWFilterSnoopReqPut(req); @@ -1731,15 +1731,15 @@ virNWFilterDHCPSnoopReq(virNWFilterTechDriverPtr techdriver, return 0; -exit_snoop_cancel: + exit_snoop_cancel: virNWFilterSnoopCancel(&req->threadkey); -exit_snoopreq_unlock: + exit_snoopreq_unlock: virNWFilterSnoopReqUnlock(req); -exit_rem_ifnametokey: + exit_rem_ifnametokey: virHashRemoveEntry(virNWFilterSnoopState.ifnameToKey, ifname); -exit_snoopunlock: + exit_snoopunlock: virNWFilterSnoopUnlock(); -exit_snoopreqput: + exit_snoopreqput: if (!threadPuts) virNWFilterSnoopReqPut(req); @@ -1799,7 +1799,7 @@ virNWFilterSnoopLeaseFileWrite(int lfd, const char *ifkey, ignore_value(fsync(lfd)); -cleanup: + cleanup: VIR_FREE(lbuf); VIR_FREE(dhcpstr); VIR_FREE(ipstr); @@ -1831,7 +1831,7 @@ virNWFilterSnoopLeaseFileSave(virNWFilterSnoopIPLeasePtr ipl) virAtomicIntGet(&virNWFilterSnoopState.nLeases) * 20) virNWFilterSnoopLeaseFileLoad(); /* load & refresh lease file */ -err_exit: + err_exit: virNWFilterSnoopUnlock(); } @@ -1935,7 +1935,7 @@ virNWFilterSnoopLeaseFileRefresh(void) } virAtomicIntSet(&virNWFilterSnoopState.wLeases, 0); -skip_rename: + skip_rename: virNWFilterSnoopLeaseFileOpen(); } @@ -2107,7 +2107,7 @@ virNWFilterDHCPSnoopInit(void) return 0; -err_exit: + err_exit: virHashFree(virNWFilterSnoopState.ifnameToKey); virNWFilterSnoopState.ifnameToKey = NULL; @@ -2182,7 +2182,7 @@ virNWFilterDHCPSnoopEnd(const char *ifname) virNWFilterSnoopLeaseFileLoad(); } -cleanup: + cleanup: virNWFilterSnoopUnlock(); } diff --git a/src/nwfilter/nwfilter_driver.c b/src/nwfilter/nwfilter_driver.c index 4fab1f2..b41253d 100644 --- a/src/nwfilter/nwfilter_driver.c +++ b/src/nwfilter/nwfilter_driver.c @@ -245,23 +245,23 @@ nwfilterStateInitialize(bool privileged, return 0; -error: + error: VIR_FREE(base); nwfilterDriverUnlock(driverState); nwfilterStateCleanup(); return -1; -err_techdrivers_shutdown: + err_techdrivers_shutdown: virNWFilterTechDriversShutdown(); -err_dhcpsnoop_shutdown: + err_dhcpsnoop_shutdown: virNWFilterDHCPSnoopShutdown(); -err_exit_learnshutdown: + err_exit_learnshutdown: virNWFilterLearnShutdown(); -err_exit_ipaddrmapshutdown: + err_exit_ipaddrmapshutdown: virNWFilterIPAddrMapShutdown(); -err_free_driverstate: + err_free_driverstate: VIR_FREE(driverState); return -1; @@ -378,7 +378,7 @@ nwfilterLookupByUUID(virConnectPtr conn, ret = virGetNWFilter(conn, nwfil
[libvirt] [PATCH 12/24] Indent top-level labels by one space in src/parallels/
--- src/parallels/parallels_driver.c | 64 ++-- src/parallels/parallels_network.c | 22 ++--- src/parallels/parallels_storage.c | 68 +++ src/parallels/parallels_utils.c | 2 +- 4 files changed, 78 insertions(+), 78 deletions(-) diff --git a/src/parallels/parallels_driver.c b/src/parallels/parallels_driver.c index 0c985dd..9deb045 100644 --- a/src/parallels/parallels_driver.c +++ b/src/parallels/parallels_driver.c @@ -148,7 +148,7 @@ parallelsBuildCapabilities(void) return caps; - error: + error: virObjectUnref(caps); return NULL; } @@ -239,7 +239,7 @@ parallelsAddSerialInfo(virDomainChrDefPtr **serials, size_t *nserials, return 0; - cleanup: + cleanup: virDomainChrDefFree(chr); return -1; } @@ -284,7 +284,7 @@ parallelsAddVideoInfo(virDomainDefPtr def, virJSONValuePtr value) return 0; -error: + error: VIR_FREE(accel); virDomainVideoDefFree(video); return -1; @@ -390,7 +390,7 @@ parallelsAddHddInfo(virDomainDefPtr def, const char *key, virJSONValuePtr value) return 0; -error: + error: virDomainDiskDefFree(disk); return -1; } @@ -422,7 +422,7 @@ parallelsMacAddrParse(const char *str, virMacAddrPtr addr) } return 0; -error: + error: virReportError(VIR_ERR_INVALID_ARG, _("Invalid MAC address format '%s'"), str); return -1; @@ -488,7 +488,7 @@ parallelsGetNetInfo(virDomainNetDefPtr net, return 0; -error: + error: return -1; } @@ -510,7 +510,7 @@ parallelsAddNetInfo(virDomainDefPtr def, const char *key, virJSONValuePtr value) return 0; -error: + error: virDomainNetDefFree(net); return -1; } @@ -554,7 +554,7 @@ parallelsAddDomainHardware(virDomainDefPtr def, virJSONValuePtr jobj) return 0; - cleanup: + cleanup: return -1; } @@ -627,7 +627,7 @@ parallelsAddVNCInfo(virDomainDefPtr def, virJSONValuePtr jobj_root) return 0; - cleanup: + cleanup: virDomainGraphicsDefFree(gr); return ret; } @@ -818,7 +818,7 @@ parallelsLoadDomain(parallelsConnPtr privconn, virJSONValuePtr jobj) return dom; - cleanup: + cleanup: virDomainDefFree(def); parallelsDomObjFreePrivate(pdom); return NULL; @@ -867,7 +867,7 @@ parallelsLoadDomains(parallelsConnPtr privconn, const char *domain_name) ret = 0; - cleanup: + cleanup: virJSONValueFree(jobj); return ret; } @@ -908,7 +908,7 @@ parallelsOpenDefault(virConnectPtr conn) return VIR_DRV_OPEN_SUCCESS; - error: + error: virObjectUnref(privconn->domains); virObjectUnref(privconn->caps); virStoragePoolObjListFree(&privconn->pools); @@ -1008,7 +1008,7 @@ parallelsConnectGetVersion(virConnectPtr conn ATTRIBUTE_UNUSED, unsigned long *h ret = 0; -cleanup: + cleanup: VIR_FREE(output); return ret; } @@ -1114,7 +1114,7 @@ parallelsDomainLookupByID(virConnectPtr conn, int id) if (ret) ret->id = dom->def->id; - cleanup: + cleanup: if (dom) virObjectUnlock(dom); return ret; @@ -1143,7 +1143,7 @@ parallelsDomainLookupByUUID(virConnectPtr conn, const unsigned char *uuid) if (ret) ret->id = dom->def->id; - cleanup: + cleanup: if (dom) virObjectUnlock(dom); return ret; @@ -1170,7 +1170,7 @@ parallelsDomainLookupByName(virConnectPtr conn, const char *name) if (ret) ret->id = dom->def->id; - cleanup: + cleanup: if (dom) virObjectUnlock(dom); return ret; @@ -1199,7 +1199,7 @@ parallelsDomainGetInfo(virDomainPtr domain, virDomainInfoPtr info) info->cpuTime = 0; ret = 0; - cleanup: + cleanup: if (privdom) virObjectUnlock(privdom); return ret; @@ -1222,7 +1222,7 @@ parallelsDomainGetOSType(virDomainPtr domain) ignore_value(VIR_STRDUP(ret, privdom->def->os.type)); - cleanup: + cleanup: if (privdom) virObjectUnlock(privdom); parallelsDriverUnlock(privconn); @@ -1245,7 +1245,7 @@ parallelsDomainIsPersistent(virDomainPtr domain) ret = 1; - cleanup: + cleanup: if (privdom) virObjectUnlock(privdom); parallelsDriverUnlock(privconn); @@ -1273,7 +1273,7 @@ parallelsDomainGetState(virDomainPtr domain, *state = virDomainObjGetState(privdom, reason); ret = 0; - cleanup: + cleanup: if (privdom) virObjectUnlock(privdom); return ret; @@ -1303,7 +1303,7 @@ parallelsDomainGetXMLDesc(virDomainPtr domain, unsigned int flags) ret = virDomainDefFormat(def, flags); - cleanup: + cleanup: if (privdom) virObjectUnlock(privdom); return ret; @@ -1328,7 +1328,7 @@ parallelsDomainGetAutostart(virDomainPtr domain, int *autostart) *autostart = privdom->autostart; ret = 0; - cleanup: + cleanup: if (privdom) virObjectUnlock(privdom); return ret; @@ -1371,7 +1371,7 @@ parallelsDo
[libvirt] [PATCH 16/24] Indent top-level labels by one space in src/storage/
--- src/storage/storage_backend.c | 20 - src/storage/storage_backend_disk.c | 6 +-- src/storage/storage_backend_fs.c | 16 src/storage/storage_backend_gluster.c | 12 +++--- src/storage/storage_backend_iscsi.c| 12 +++--- src/storage/storage_backend_logical.c | 14 +++ src/storage/storage_backend_mpath.c| 12 +++--- src/storage/storage_backend_rbd.c | 14 +++ src/storage/storage_backend_scsi.c | 28 ++--- src/storage/storage_backend_sheepdog.c | 10 ++--- src/storage/storage_driver.c | 74 +- 11 files changed, 109 insertions(+), 109 deletions(-) diff --git a/src/storage/storage_backend.c b/src/storage/storage_backend.c index e759ad6..5b3b536 100644 --- a/src/storage/storage_backend.c +++ b/src/storage/storage_backend.c @@ -248,7 +248,7 @@ virStorageBackendCopyToFD(virStorageVolDefPtr vol, } inputfd = -1; -cleanup: + cleanup: VIR_FORCE_CLOSE(inputfd); VIR_FREE(zerobuf); @@ -326,7 +326,7 @@ virStorageBackendCreateBlockFrom(virConnectPtr conn ATTRIBUTE_UNUSED, fd = -1; ret = 0; -cleanup: + cleanup: VIR_FORCE_CLOSE(fd); return ret; @@ -403,7 +403,7 @@ createRawFile(int fd, virStorageVolDefPtr vol, goto cleanup; } -cleanup: + cleanup: return ret; } @@ -453,7 +453,7 @@ virStorageBackendCreateRaw(virConnectPtr conn ATTRIBUTE_UNUSED, /* createRawFile already reported the exact error. */ ret = -1; -cleanup: + cleanup: VIR_FORCE_CLOSE(fd); return ret; } @@ -553,7 +553,7 @@ virStorageGenerateQcowEncryption(virConnectPtr conn, ret = 0; -cleanup: + cleanup: if (secret != NULL) { if (ret != 0 && conn->secretDriver->secretUndefine != NULL) @@ -653,7 +653,7 @@ virStorageBackendQemuImgSupportsCompat(const char *qemuimg) if (strstr(output, "\ncompat ")) ret = true; -cleanup: + cleanup: virCommandFree(cmd); VIR_FREE(output); return ret; @@ -699,7 +699,7 @@ virStorageBackendQEMUImgBackingFormat(const char *qemuimg) ret = QEMU_IMG_BACKING_FORMAT_NONE; } -cleanup: + cleanup: virCommandFree(cmd); VIR_FREE(help); return ret; @@ -761,9 +761,9 @@ virStorageBackendCreateQemuImgOpts(char **opts, *opts = virBufferContentAndReset(&buf); return 0; -no_memory: + no_memory: virReportOOMError(); -error: + error: virBufferFreeAndReset(&buf); return -1; } @@ -1010,7 +1010,7 @@ virStorageBackendCreateQemuImg(virConnectPtr conn, ret = virStorageBackendCreateExecCommand(pool, vol, cmd); virCommandFree(cmd); -cleanup: + cleanup: VIR_FREE(create_tool); return ret; } diff --git a/src/storage/storage_backend_disk.c b/src/storage/storage_backend_disk.c index 81201fd..8276c96 100644 --- a/src/storage/storage_backend_disk.c +++ b/src/storage/storage_backend_disk.c @@ -426,7 +426,7 @@ virStorageBackendDiskBuildPool(virConnectPtr conn ATTRIBUTE_UNUSED, ret = virCommandRun(cmd, NULL); } -error: + error: virCommandFree(cmd); return ret; } @@ -674,7 +674,7 @@ virStorageBackendDiskCreateVol(virConnectPtr conn ATTRIBUTE_UNUSED, res = 0; -cleanup: + cleanup: VIR_FREE(partFormat); virCommandFree(cmd); return res; @@ -758,7 +758,7 @@ virStorageBackendDiskDeleteVol(virConnectPtr conn ATTRIBUTE_UNUSED, } rc = 0; -cleanup: + cleanup: VIR_FREE(devpath); virCommandFree(cmd); return rc; diff --git a/src/storage/storage_backend_fs.c b/src/storage/storage_backend_fs.c index a9271e2..0f8da06 100644 --- a/src/storage/storage_backend_fs.c +++ b/src/storage/storage_backend_fs.c @@ -180,10 +180,10 @@ virStorageBackendProbeTarget(virStorageVolTargetPtr target, goto cleanup; -error: + error: VIR_FORCE_CLOSE(fd); -cleanup: + cleanup: virStorageFileFreeMetadata(meta); VIR_FREE(header); return ret; @@ -237,7 +237,7 @@ virStorageBackendFileSystemNetFindPoolSourcesFunc(char **const groups, src->format = VIR_STORAGE_POOL_NETFS_NFS; ret = 0; -cleanup: + cleanup: return ret; } @@ -452,7 +452,7 @@ virStorageBackendFileSystemMount(virStoragePoolObjPtr pool) goto cleanup; ret = 0; -cleanup: + cleanup: virCommandFree(cmd); VIR_FREE(src); return ret; @@ -510,7 +510,7 @@ virStorageBackendFileSystemUnmount(virStoragePoolObjPtr pool) goto cleanup; ret = 0; -cleanup: + cleanup: virCommandFree(cmd); return ret; } @@ -621,7 +621,7 @@ virStorageBackendFileSystemProbe(const char *device, ret = FILESYSTEM_PROBE_ERROR; } -error: + error: VIR_FREE(libblkid_format); if (probe != NULL) { @@ -724,7 +724,7 @@ virStorageBackendMakeFileSystem(virStoragePoolObjPtr pool, ret = virStorageBackendExecuteMKFS(device, format); } -error: + error: return ret; } @@ -816,7 +816,7 @@ virStorageBackendFileSystem
[libvirt] [PATCH 10/24] Indent top-level labels by one space in src/network/
--- src/network/bridge_driver.c | 92 +++ src/network/bridge_driver_linux.c | 40 - 2 files changed, 66 insertions(+), 66 deletions(-) diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c index 20930f3..46c0cb0 100644 --- a/src/network/bridge_driver.c +++ b/src/network/bridge_driver.c @@ -188,7 +188,7 @@ networkRunHook(virNetworkObjPtr network, } ret = 0; -cleanup: + cleanup: virBufferFreeAndReset(&buf); VIR_FREE(xml); VIR_FREE(net_xml); @@ -293,7 +293,7 @@ networkRemoveInactive(virNetworkDriverStatePtr driver, ret = 0; -cleanup: + cleanup: VIR_FREE(leasefile); VIR_FREE(configfile); VIR_FREE(radvdconfigfile); @@ -534,12 +534,12 @@ networkStateInitialize(bool privileged, #endif ret = 0; -cleanup: + cleanup: VIR_FREE(configdir); VIR_FREE(rundir); return ret; -error: + error: if (driverState) networkDriverUnlock(driverState); networkStateCleanup(); @@ -680,7 +680,7 @@ networkKillDaemon(pid_t pid, const char *daemonName, const char *networkName) VIR_WARN("Timed out waiting after SIG%s to %s process %d " "(network '%s')", signame, daemonName, pid, networkName); -cleanup: + cleanup: return ret; } @@ -1084,7 +1084,7 @@ networkDnsmasqConfContents(virNetworkObjPtr network, ret = 0; -cleanup: + cleanup: virBufferFreeAndReset(&configbuf); VIR_FREE(record); VIR_FREE(recordPort); @@ -1128,7 +1128,7 @@ networkBuildDhcpDaemonCommandLine(virNetworkObjPtr network, virCommandAddArgFormat(cmd, "--conf-file=%s", configfile); *cmdout = cmd; ret = 0; -cleanup: + cleanup: VIR_FREE(configfile); VIR_FREE(configstr); return ret; @@ -1208,7 +1208,7 @@ networkStartDhcpDaemon(virNetworkDriverStatePtr driver, goto cleanup; ret = 0; -cleanup: + cleanup: VIR_FREE(pidfile); virCommandFree(cmd); dnsmasqContextFree(dctx); @@ -1278,7 +1278,7 @@ networkRefreshDhcpDaemon(virNetworkDriverStatePtr driver, goto cleanup; ret = kill(network->dnsmasqPid, SIGHUP); -cleanup: + cleanup: dnsmasqContextFree(dctx); return ret; } @@ -1390,7 +1390,7 @@ networkRadvdConfContents(virNetworkObjPtr network, char **configstr) } ret = 0; -cleanup: + cleanup: virBufferFreeAndReset(&configbuf); return ret; } @@ -1428,7 +1428,7 @@ networkRadvdConfWrite(virNetworkObjPtr network, char **configFile) } ret = 0; -cleanup: + cleanup: VIR_FREE(configStr); VIR_FREE(myConfigFile); return ret; @@ -1512,7 +1512,7 @@ networkStartRadvd(virNetworkDriverStatePtr driver ATTRIBUTE_UNUSED, goto cleanup; ret = 0; -cleanup: + cleanup: virCommandFree(cmd); VIR_FREE(configfile); VIR_FREE(radvdpidbase); @@ -1729,7 +1729,7 @@ networkSetIPv6Sysctls(virNetworkObjPtr network) } ret = 0; -cleanup: + cleanup: VIR_FREE(field); return ret; } @@ -2117,7 +2117,7 @@ networkStartNetwork(virNetworkDriverStatePtr driver, VIR_INFO("Network '%s' started up", network->def->name); ret = 0; -cleanup: + cleanup: if (ret < 0) { virNetworkObjUnsetDefTransient(network); virErrorPtr save_err = virSaveLastError(); @@ -2197,7 +2197,7 @@ static virNetworkPtr networkLookupByUUID(virConnectPtr conn, ret = virGetNetwork(conn, network->def->name, network->def->uuid); -cleanup: + cleanup: if (network) virNetworkObjUnlock(network); return ret; @@ -2224,7 +2224,7 @@ static virNetworkPtr networkLookupByName(virConnectPtr conn, ret = virGetNetwork(conn, network->def->name, network->def->uuid); -cleanup: + cleanup: if (network) virNetworkObjUnlock(network); return ret; @@ -2379,7 +2379,7 @@ networkConnectListAllNetworks(virConnectPtr conn, flags); networkDriverUnlock(driver); -cleanup: + cleanup: return ret; } @@ -2402,7 +2402,7 @@ networkConnectNetworkEventRegisterAny(virConnectPtr conn, opaque, freecb, &ret) < 0) ret = -1; -cleanup: + cleanup: return ret; } @@ -2423,7 +2423,7 @@ networkConnectNetworkEventDeregisterAny(virConnectPtr conn, ret = 0; -cleanup: + cleanup: return ret; } @@ -2440,7 +2440,7 @@ static int networkIsActive(virNetworkPtr net) ret = virNetworkObjIsActive(obj); -cleanup: + cleanup: if (obj) virNetworkObjUnlock(obj); return ret; @@ -2459,7 +2459,7 @@ static int networkIsPersistent(virNetworkPtr net) ret = obj->persistent; -cleanup: + cleanup: if (obj) virNetworkObjUnlock(obj); return ret; @@ -2673,7 +2673,7 @@ static virNetworkPtr networkCreateXML(virConnectPtr conn, const char *xml) VIR_INFO("Creating network '%s'", network->def->name); ret = virGetNetwork(conn, network->def->name, network->def->
[libvirt] [PATCH 06/24] Indent top-level labels by one space in src/libxl/
--- src/libxl/libxl_conf.c | 18 +++--- src/libxl/libxl_domain.c | 24 src/libxl/libxl_driver.c | 152 +++ 3 files changed, 97 insertions(+), 97 deletions(-) diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c index a6bf1cf..4c62e73 100644 --- a/src/libxl/libxl_conf.c +++ b/src/libxl/libxl_conf.c @@ -475,7 +475,7 @@ libxlMakeDomCreateInfo(libxl_ctx *ctx, return 0; -error: + error: libxl_domain_create_info_dispose(c_info); return -1; } @@ -708,7 +708,7 @@ libxlMakeDomBuildInfo(virDomainObjPtr vm, libxl_domain_config *d_config) return 0; -error: + error: libxl_domain_build_info_dispose(b_info); return -1; } @@ -857,7 +857,7 @@ libxlMakeDiskList(virDomainDefPtr def, libxl_domain_config *d_config) return 0; -error: + error: for (i = 0; i < ndisks; i++) libxl_device_disk_dispose(&x_disks[i]); VIR_FREE(x_disks); @@ -942,7 +942,7 @@ libxlMakeNicList(virDomainDefPtr def, libxl_domain_config *d_config) return 0; -error: + error: for (i = 0; i < nnics; i++) libxl_device_nic_dispose(&x_nics[i]); VIR_FREE(x_nics); @@ -1042,7 +1042,7 @@ libxlMakeVfbList(libxlDriverPrivatePtr driver, return 0; -error: + error: for (i = 0; i < nvfbs; i++) { libxl_device_vfb_dispose(&x_vfbs[i]); libxl_device_vkb_dispose(&x_vkbs[i]); @@ -1150,7 +1150,7 @@ libxlDriverConfigNew(void) return cfg; -error: + error: VIR_FREE(log_file); virObjectUnref(cfg); return NULL; @@ -1219,7 +1219,7 @@ libxlMakePciList(virDomainDefPtr def, libxl_domain_config *d_config) return 0; -error: + error: for (i = 0; i < npcidevs; i++) libxl_device_pci_dispose(&x_pcidevs[i]); @@ -1258,7 +1258,7 @@ libxlDriverNodeGetInfo(libxlDriverPrivatePtr driver, virNodeInfoPtr info) ret = 0; -cleanup: + cleanup: virObjectUnref(cfg); return ret; } @@ -1282,7 +1282,7 @@ libxlMakeCapabilities(libxl_ctx *ctx) return caps; -error: + error: virObjectUnref(caps); return NULL; } diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c index 6e9756e..80d5280 100644 --- a/src/libxl/libxl_domain.c +++ b/src/libxl/libxl_domain.c @@ -364,7 +364,7 @@ libxlDomainObjBeginJob(libxlDriverPrivatePtr driver ATTRIBUTE_UNUSED, return 0; -error: + error: VIR_WARN("Cannot start job (%s) for domain %s;" " current job is (%s) owned by (%d)", libxlDomainJobTypeToString(job), @@ -578,7 +578,7 @@ libxlDomainShutdownThread(void *opaque) goto cleanup; } -destroy: + destroy: if (dom_event) { libxlDomainEventQueue(driver, dom_event); dom_event = NULL; @@ -592,7 +592,7 @@ destroy: } goto cleanup; -restart: + restart: if (dom_event) { libxlDomainEventQueue(driver, dom_event); dom_event = NULL; @@ -601,7 +601,7 @@ restart: libxlDomainCleanupJob(driver, vm, VIR_DOMAIN_SHUTOFF_SHUTDOWN); libxlDomainStart(driver, vm, 0, -1); -cleanup: + cleanup: if (vm) virObjectUnlock(vm); if (dom_event) @@ -667,7 +667,7 @@ libxlEventHandler(void *data, VIR_LIBXL_EVENT_CONST libxl_event *event) */ return; -error: + error: /* Cast away any const */ libxl_event_free(priv->ctx, (libxl_event *)event); } @@ -727,7 +727,7 @@ libxlDomainObjPrivateInitCtx(virDomainObjPtr vm) ret = 0; -cleanup: + cleanup: VIR_FREE(log_file); return ret; } @@ -816,7 +816,7 @@ libxlDomainSaveImageOpen(libxlDriverPrivatePtr driver, return fd; -error: + error: VIR_FREE(xml); virDomainDefFree(def); VIR_FORCE_CLOSE(fd); @@ -930,7 +930,7 @@ libxlDomainEventsRegister(libxlDriverPrivatePtr driver, virDomainObjPtr vm) return 0; -error: + error: if (priv->deathW) { libxl_evdisable_domain_death(priv->ctx, priv->deathW); priv->deathW = NULL; @@ -975,7 +975,7 @@ libxlDomainAutoCoreDump(libxlDriverPrivatePtr driver, ignore_value(libxlDomainObjEndJob(driver, vm)); ret = 0; -cleanup: + cleanup: VIR_FREE(dumpfile); virObjectUnref(cfg); @@ -1031,7 +1031,7 @@ libxlDomainSetVcpuAffinities(libxlDriverPrivatePtr driver, virDomainObjPtr vm) ret = 0; -cleanup: + cleanup: VIR_FREE(cpumap); return ret; } @@ -1238,12 +1238,12 @@ libxlDomainStart(libxlDriverPrivatePtr driver, virDomainObjPtr vm, ret = 0; goto endjob; -cleanup_dom: + cleanup_dom: libxl_domain_destroy(priv->ctx, domid, NULL); vm->def->id = -1; virDomainObjSetState(vm, VIR_DOMAIN_SHUTOFF, VIR_DOMAIN_SHUTOFF_FAILED); -endjob: + endjob: if (!libxlDomainObjEndJob(driver, vm)) vm = NULL; diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c index 0c6672b..b44d771 100644 --- a/src/libxl/libxl_driver.c +++ b/src/libxl/libxl_driver.c @@ -123,7 +123,7 @@ libxlAutostartDomain(virDomainObjPtr v
[libvirt] [PATCH 08/24] Indent top-level labels by one space in src/locking/
--- src/locking/domain_lock.c | 10 +- src/locking/lock_daemon.c | 26 +- src/locking/lock_daemon_config.c | 4 ++-- src/locking/lock_daemon_dispatch.c | 16 src/locking/lock_driver_lockd.c| 18 +- src/locking/lock_driver_sanlock.c | 20 ++-- src/locking/lock_manager.c | 2 +- src/locking/sanlock_helper.c | 2 +- 8 files changed, 49 insertions(+), 49 deletions(-) diff --git a/src/locking/domain_lock.c b/src/locking/domain_lock.c index ed37dd9..01ea441 100644 --- a/src/locking/domain_lock.c +++ b/src/locking/domain_lock.c @@ -155,7 +155,7 @@ static virLockManagerPtr virDomainLockManagerNew(virLockManagerPluginPtr plugin, return lock; -error: + error: virLockManagerFree(lock); return NULL; } @@ -270,7 +270,7 @@ int virDomainLockDiskAttach(virLockManagerPluginPtr plugin, ret = 0; -cleanup: + cleanup: virLockManagerFree(lock); return ret; @@ -297,7 +297,7 @@ int virDomainLockDiskDetach(virLockManagerPluginPtr plugin, ret = 0; -cleanup: + cleanup: virLockManagerFree(lock); return ret; @@ -327,7 +327,7 @@ int virDomainLockLeaseAttach(virLockManagerPluginPtr plugin, ret = 0; -cleanup: + cleanup: virLockManagerFree(lock); return ret; @@ -354,7 +354,7 @@ int virDomainLockLeaseDetach(virLockManagerPluginPtr plugin, ret = 0; -cleanup: + cleanup: virLockManagerFree(lock); return ret; diff --git a/src/locking/lock_daemon.c b/src/locking/lock_daemon.c index dbec716..455cc88 100644 --- a/src/locking/lock_daemon.c +++ b/src/locking/lock_daemon.c @@ -164,7 +164,7 @@ virLockDaemonNew(virLockDaemonConfigPtr config, bool privileged) return lockd; -error: + error: virLockDaemonFree(lockd); return NULL; } @@ -246,7 +246,7 @@ virLockDaemonNewPostExecRestart(virJSONValuePtr object, bool privileged) return lockd; -error: + error: virLockDaemonFree(lockd); return NULL; } @@ -396,7 +396,7 @@ virLockDaemonPidFilePath(bool privileged, return 0; -error: + error: return -1; } @@ -431,7 +431,7 @@ virLockDaemonUnixSocketPaths(bool privileged, } return 0; -error: + error: return -1; } @@ -551,7 +551,7 @@ virLockDaemonSetupLogging(virLockDaemonConfigPtr config, return 0; -error: + error: return -1; } @@ -816,7 +816,7 @@ virLockDaemonClientNew(virNetServerClientPtr client, return priv; -error: + error: virMutexDestroy(&priv->lock); VIR_FREE(priv); return NULL; @@ -871,7 +871,7 @@ virLockDaemonClientNewPostExecRestart(virNetServerClientPtr client, } return priv; -error: + error: virLockDaemonClientFree(priv); return NULL; } @@ -917,7 +917,7 @@ virLockDaemonClientPreExecRestart(virNetServerClientPtr client ATTRIBUTE_UNUSED, return object; -error: + error: virJSONValueFree(object); return NULL; } @@ -955,7 +955,7 @@ virLockDaemonExecRestartStatePath(bool privileged, return 0; -error: + error: return -1; } @@ -1028,7 +1028,7 @@ virLockDaemonPostExecRestart(const char *state_file, ret = 1; -cleanup: + cleanup: unlink(state_file); VIR_FREE(wantmagic); VIR_FREE(state); @@ -1123,7 +1123,7 @@ virLockDaemonPreExecRestart(const char *state_file, abort(); /* This should be impossible to reach */ -cleanup: + cleanup: VIR_FREE(pairs); VIR_FREE(state); virJSONValueFree(object); @@ -1451,7 +1451,7 @@ int main(int argc, char **argv) { else ret = 0; -cleanup: + cleanup: virObjectUnref(lockProgram); virLockDaemonFree(lockDaemon); if (statuswrite != -1) { @@ -1472,7 +1472,7 @@ cleanup: VIR_FREE(run_dir); return ret; -no_memory: + no_memory: VIR_ERROR(_("Can't allocate memory")); exit(EXIT_FAILURE); } diff --git a/src/locking/lock_daemon_config.c b/src/locking/lock_daemon_config.c index 42abc56..62b8b02 100644 --- a/src/locking/lock_daemon_config.c +++ b/src/locking/lock_daemon_config.c @@ -102,7 +102,7 @@ virLockDaemonConfigFilePath(bool privileged, char **configfile) return 0; -error: + error: return -1; } @@ -144,7 +144,7 @@ virLockDaemonConfigLoadOptions(virLockDaemonConfigPtr data, return 0; -error: + error: return -1; } diff --git a/src/locking/lock_daemon_dispatch.c b/src/locking/lock_daemon_dispatch.c index a26e2cc..168a6af 100644 --- a/src/locking/lock_daemon_dispatch.c +++ b/src/locking/lock_daemon_dispatch.c @@ -88,7 +88,7 @@ virLockSpaceProtocolDispatchAcquireResource(virNetServerPtr server ATTRIBUTE_UNU rv = 0; -cleanup: + cleanup: if (rv < 0) virNetMessageSaveError(rerr); virMutexUnlock(&priv->lock); @@ -137,7 +137,7 @@ virLockSpaceProtocolDispatchCreateResource(virNetServerPtr server ATTRIBUTE_UNUS rv = 0; -cleanup: + cleanup: if (rv < 0) virNetMessageSave
[libvirt] [PATCH 09/24] Indent top-level labels by one space in src/lxc/
--- src/lxc/lxc_cgroup.c | 16 +++--- src/lxc/lxc_conf.c | 6 +-- src/lxc/lxc_container.c | 42 +++ src/lxc/lxc_controller.c | 54 +-- src/lxc/lxc_driver.c | 136 +++ src/lxc/lxc_fuse.c | 10 ++-- src/lxc/lxc_monitor.c| 4 +- src/lxc/lxc_native.c | 20 +++ src/lxc/lxc_process.c| 28 +- 9 files changed, 158 insertions(+), 158 deletions(-) diff --git a/src/lxc/lxc_cgroup.c b/src/lxc/lxc_cgroup.c index da5ccf5..bab3052 100644 --- a/src/lxc/lxc_cgroup.c +++ b/src/lxc/lxc_cgroup.c @@ -51,7 +51,7 @@ static int virLXCCgroupSetupCpuTune(virDomainDefPtr def, goto cleanup; ret = 0; -cleanup: + cleanup: return ret; } @@ -97,7 +97,7 @@ static int virLXCCgroupSetupCpusetTune(virDomainDefPtr def, } ret = 0; -cleanup: + cleanup: VIR_FREE(mask); return ret; } @@ -168,7 +168,7 @@ static int virLXCCgroupSetupMemTune(virDomainDefPtr def, goto cleanup; ret = 0; -cleanup: + cleanup: return ret; } @@ -263,7 +263,7 @@ static int virLXCCgroupGetMemStat(virCgroupPtr cgroup, } ret = 0; -cleanup: + cleanup: VIR_FREE(line); VIR_FREE(statFile); VIR_FORCE_FCLOSE(statfd); @@ -292,7 +292,7 @@ int virLXCCgroupGetMeminfo(virLXCMeminfoPtr meminfo) virLXCCgroupGetMemSwapUsage(cgroup, meminfo); ret = 0; -cleanup: + cleanup: virCgroupFree(&cgroup); return ret; } @@ -452,7 +452,7 @@ static int virLXCCgroupSetupDeviceACL(virDomainDefPtr def, VIR_DEBUG("Device whitelist complete"); ret = 0; -cleanup: + cleanup: return ret; } @@ -498,7 +498,7 @@ virCgroupPtr virLXCCgroupCreate(virDomainDefPtr def) } } -cleanup: + cleanup: return cgroup; } @@ -526,6 +526,6 @@ int virLXCCgroupSetup(virDomainDefPtr def, ret = 0; -cleanup: + cleanup: return ret; } diff --git a/src/lxc/lxc_conf.c b/src/lxc/lxc_conf.c index d4432cf..fd0b6ef 100644 --- a/src/lxc/lxc_conf.c +++ b/src/lxc/lxc_conf.c @@ -157,7 +157,7 @@ virCapsPtr virLXCDriverCapsInit(virLXCDriverPtr driver) return caps; -error: + error: virObjectUnref(caps); return NULL; } @@ -230,7 +230,7 @@ virLXCDriverConfigNew(void) goto error; return cfg; -error: + error: virObjectUnref(cfg); return NULL; } @@ -283,7 +283,7 @@ virLXCLoadDriverConfig(virLXCDriverConfigPtr cfg, virConfFree(conf); -done: + done: return 0; } diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c index b6c788a..fd8ab16 100644 --- a/src/lxc/lxc_container.c +++ b/src/lxc/lxc_container.c @@ -373,7 +373,7 @@ static int lxcContainerSetupFDs(int *ttyfd, rc = 0; -cleanup: + cleanup: VIR_DEBUG("rc=%d", rc); return rc; } @@ -400,7 +400,7 @@ int lxcContainerSendContinue(int control) } rc = 0; -error_out: + error_out: return rc; } @@ -506,7 +506,7 @@ static int lxcContainerRenameAndEnableInterfaces(bool privNet, if (veths || privNet) rc = virNetDevSetOnline("lo", true); -error_out: + error_out: VIR_FREE(newname); return rc; } @@ -580,7 +580,7 @@ static int lxcContainerUnmountSubtree(const char *prefix, ret = 0; -cleanup: + cleanup: virStringFreeList(mounts); return ret; @@ -718,7 +718,7 @@ static int lxcContainerPivotRoot(virDomainFSDefPtr root) ret = 0; -err: + err: VIR_FREE(oldroot); VIR_FREE(newroot); @@ -805,7 +805,7 @@ static int lxcContainerSetReadOnly(void) } ret = 0; -cleanup: + cleanup: for (i = 0; i < nmounts; i++) VIR_FREE(mounts[i]); VIR_FREE(mounts); @@ -892,7 +892,7 @@ static int lxcContainerMountBasicFS(bool userns_enabled) rc = 0; -cleanup: + cleanup: VIR_DEBUG("rc=%d", rc); return rc; } @@ -961,7 +961,7 @@ static int lxcContainerMountFSDev(virDomainDefPtr def, ret = 0; -cleanup: + cleanup: VIR_FREE(path); return ret; } @@ -996,7 +996,7 @@ static int lxcContainerMountFSDevPTS(virDomainDefPtr def, } ret = 0; -cleanup: + cleanup: VIR_FREE(path); return ret; } @@ -1126,7 +1126,7 @@ static int lxcContainerMountFSBind(virDomainFSDefPtr fs, ret = 0; -cleanup: + cleanup: VIR_FREE(src); return ret; } @@ -1193,9 +1193,9 @@ lxcContainerMountDetectFilesystem(const char *src, char **type) if (VIR_STRDUP(*type, data) < 0) goto cleanup; -done: + done: ret = 0; -cleanup: + cleanup: VIR_FORCE_CLOSE(fd); if (blkid) blkid_free_probe(blkid); @@ -1237,7 +1237,7 @@ static int lxcContainerMountFSBlockAuto(virDomainFSDefPtr fs, VIR_DEBUG("src=%s dst=%s srcprefix=%s", src, fs->dst, srcprefix); /* First time around we use /etc/filesystems */ -retry: + retry: if (virAsprintf(&fslist, "%s%s", srcprefix, tryProc ? "/proc/filesystems" : "/etc/filesystems") < 0) goto cleanup; @@ -133
[libvirt] [PATCH 05/24] Indent top-level labels by one space in src/esx/
--- src/esx/esx_driver.c| 110 ++-- src/esx/esx_interface_driver.c | 4 +- src/esx/esx_network_driver.c| 12 ++-- src/esx/esx_storage_backend_iscsi.c | 22 src/esx/esx_storage_backend_vmfs.c | 36 ++-- src/esx/esx_storage_driver.c| 2 +- src/esx/esx_util.c | 6 +- src/esx/esx_vi.c| 86 ++-- src/esx/esx_vi_methods.c| 2 +- src/esx/esx_vi_types.c | 18 +++--- 10 files changed, 149 insertions(+), 149 deletions(-) diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c index a08a69d..ff44881 100644 --- a/src/esx/esx_driver.c +++ b/src/esx/esx_driver.c @@ -255,7 +255,7 @@ esxParseVMXFileName(const char *fileName, void *opaque) } } - cleanup: + cleanup: esxVI_String_Free(&propertyNameList); esxVI_ObjectContent_Free(&datastoreList); esxVI_DatastoreHostMount_Free(&hostMount); @@ -361,7 +361,7 @@ esxFormatVMXFileName(const char *fileName, void *opaque) success = true; - cleanup: + cleanup: if (! success) { virBufferFreeAndReset(&buffer); VIR_FREE(result); @@ -433,7 +433,7 @@ esxAutodetectSCSIControllerModel(virDomainDiskDefPtr def, int *model, result = 0; - cleanup: + cleanup: esxVI_FileInfo_Free(&fileInfo); return result; @@ -508,7 +508,7 @@ esxSupportsLongMode(esxPrivate *priv) } } - cleanup: + cleanup: /* * If we goto cleanup in case of an error then priv->supportsLongMode * is still esxVI_Boolean_Undefined, therefore we don't need to set it. @@ -557,7 +557,7 @@ esxLookupHostSystemBiosUuid(esxPrivate *priv, unsigned char *uuid) result = 0; - cleanup: + cleanup: esxVI_String_Free(&propertyNameList); esxVI_ObjectContent_Free(&hostSystem); @@ -624,7 +624,7 @@ esxCapsInit(esxPrivate *priv) return caps; - failure: + failure: virObjectUnref(caps); return NULL; @@ -742,7 +742,7 @@ esxConnectToHost(esxPrivate *priv, result = 0; - cleanup: + cleanup: VIR_FREE(username); VIR_FREE(unescapedPassword); VIR_FREE(password); @@ -843,7 +843,7 @@ esxConnectToVCenter(esxPrivate *priv, result = 0; - cleanup: + cleanup: VIR_FREE(username); VIR_FREE(unescapedPassword); VIR_FREE(password); @@ -1070,7 +1070,7 @@ esxConnectOpen(virConnectPtr conn, virConnectAuthPtr auth, priv = NULL; result = VIR_DRV_OPEN_SUCCESS; - cleanup: + cleanup: esxFreePrivate(&priv); VIR_FREE(potentialVCenterIpAddress); @@ -1132,7 +1132,7 @@ esxSupportsVMotion(esxPrivate *priv) goto cleanup; } - cleanup: + cleanup: /* * If we goto cleanup in case of an error then priv->supportsVMotion is * still esxVI_Boolean_Undefined, therefore we don't need to set it. @@ -1258,7 +1258,7 @@ esxConnectGetHostname(virConnectPtr conn) goto cleanup; } - cleanup: + cleanup: /* * If we goto cleanup in case of an error then complete is still NULL, * either VIR_STRDUP returned -1 or virAsprintf failed. When virAsprintf @@ -1407,7 +1407,7 @@ esxNodeGetInfo(virConnectPtr conn, virNodeInfoPtr nodeinfo) result = 0; - cleanup: + cleanup: esxVI_String_Free(&propertyNameList); esxVI_ObjectContent_Free(&hostSystem); @@ -1487,7 +1487,7 @@ esxConnectListDomains(virConnectPtr conn, int *ids, int maxids) success = true; - cleanup: + cleanup: esxVI_String_Free(&propertyNameList); esxVI_ObjectContent_Free(&virtualMachineList); @@ -1577,7 +1577,7 @@ esxDomainLookupByID(virConnectPtr conn, int id) virReportError(VIR_ERR_NO_DOMAIN, _("No domain with ID %d"), id); } - cleanup: + cleanup: esxVI_String_Free(&propertyNameList); esxVI_ObjectContent_Free(&virtualMachineList); VIR_FREE(name_candidate); @@ -1626,7 +1626,7 @@ esxDomainLookupByUUID(virConnectPtr conn, const unsigned char *uuid) domain->id = -1; } - cleanup: + cleanup: esxVI_String_Free(&propertyNameList); esxVI_ObjectContent_Free(&virtualMachine); VIR_FREE(name); @@ -1684,7 +1684,7 @@ esxDomainLookupByName(virConnectPtr conn, const char *name) domain->id = -1; } - cleanup: + cleanup: esxVI_String_Free(&propertyNameList); esxVI_ObjectContent_Free(&virtualMachine); @@ -1740,7 +1740,7 @@ esxDomainSuspend(virDomainPtr domain) result = 0; - cleanup: + cleanup: esxVI_ObjectContent_Free(&virtualMachine); esxVI_String_Free(&propertyNameList); esxVI_ManagedObjectReference_Free(&task); @@ -1798,7 +1798,7 @@ esxDomainResume(virDomainPtr domain) result = 0; - cleanup: + cleanup: esxVI_ObjectContent_Free(&virtualMachine); esxVI_String_Free(&propertyNameList); esxVI_ManagedObjectReference_Free(&task); @@ -1845,7 +1845,7 @@ esxDomainShutdownFlags(virDomainPtr domain, unsigned in
[libvirt] [PATCH 03/24] Indent top-level labels by one space in src/conf/
--- src/conf/capabilities.c | 6 +- src/conf/cpu_conf.c | 12 +- src/conf/device_conf.c | 2 +- src/conf/domain_audit.c | 18 +-- src/conf/domain_conf.c | 222 +-- src/conf/domain_event.c | 10 +- src/conf/interface_conf.c| 20 ++-- src/conf/netdev_bandwidth_conf.c | 6 +- src/conf/netdev_vlan_conf.c | 2 +- src/conf/netdev_vport_profile_conf.c | 4 +- src/conf/network_conf.c | 84 ++--- src/conf/network_event.c | 2 +- src/conf/node_device_conf.c | 30 ++--- src/conf/nwfilter_conf.c | 22 ++-- src/conf/nwfilter_ipaddrmap.c| 4 +- src/conf/nwfilter_params.c | 14 +-- src/conf/object_event.c | 6 +- src/conf/snapshot_conf.c | 12 +- src/conf/storage_conf.c | 38 +++--- src/conf/storage_encryption_conf.c | 6 +- src/conf/virchrdev.c | 8 +- 21 files changed, 264 insertions(+), 264 deletions(-) diff --git a/src/conf/capabilities.c b/src/conf/capabilities.c index 3022b45..cf474d7 100644 --- a/src/conf/capabilities.c +++ b/src/conf/capabilities.c @@ -428,7 +428,7 @@ virCapabilitiesAddGuest(virCapsPtr caps, return guest; -error: + error: virCapabilitiesFreeGuest(guest); return NULL; } @@ -477,7 +477,7 @@ virCapabilitiesAddGuestDomain(virCapsGuestPtr guest, return dom; -error: + error: virCapabilitiesFreeGuestDomain(dom); return NULL; } @@ -552,7 +552,7 @@ virCapabilitiesHostSecModelAddBaseLabel(virCapsHostSecModelPtr secmodel, return 0; -no_memory: + no_memory: VIR_FREE(l); VIR_FREE(t); return -1; diff --git a/src/conf/cpu_conf.c b/src/conf/cpu_conf.c index 4b982c9..a8b1b03 100644 --- a/src/conf/cpu_conf.c +++ b/src/conf/cpu_conf.c @@ -168,7 +168,7 @@ virCPUDefCopy(const virCPUDef *cpu) return copy; -error: + error: virCPUDefFree(copy); return NULL; } @@ -472,13 +472,13 @@ virCPUDefParseXML(xmlNodePtr node, } } -cleanup: + cleanup: VIR_FREE(fallback); VIR_FREE(vendor_id); VIR_FREE(nodes); return def; -error: + error: virCPUDefFree(def); def = NULL; goto cleanup; @@ -499,9 +499,9 @@ virCPUDefFormat(virCPUDefPtr def, return virBufferContentAndReset(&buf); -no_memory: + no_memory: virReportOOMError(); -cleanup: + cleanup: virBufferFreeAndReset(&buf); return NULL; } @@ -820,6 +820,6 @@ virCPUDefIsEqual(virCPUDefPtr src, identical = true; -cleanup: + cleanup: return identical; } diff --git a/src/conf/device_conf.c b/src/conf/device_conf.c index f49dc21..de7aa55 100644 --- a/src/conf/device_conf.c +++ b/src/conf/device_conf.c @@ -106,7 +106,7 @@ virDevicePCIAddressParseXML(xmlNodePtr node, ret = 0; -cleanup: + cleanup: VIR_FREE(domain); VIR_FREE(bus); VIR_FREE(slot); diff --git a/src/conf/domain_audit.c b/src/conf/domain_audit.c index e8bd460..5b97b82 100644 --- a/src/conf/domain_audit.c +++ b/src/conf/domain_audit.c @@ -128,7 +128,7 @@ virDomainAuditDisk(virDomainObjPtr vm, virt, reason, vmname, uuidstr, oldsrc, newsrc); -cleanup: + cleanup: VIR_FREE(vmname); VIR_FREE(oldsrc); VIR_FREE(newsrc); @@ -209,13 +209,13 @@ virDomainAuditRNG(virDomainObjPtr vm, virt, reason, vmname, uuidstr, oldsrc, newsrc); -cleanup: + cleanup: VIR_FREE(vmname); VIR_FREE(oldsrc); VIR_FREE(newsrc); return; -no_memory: + no_memory: VIR_WARN("OOM while encoding audit message"); goto cleanup; } @@ -261,7 +261,7 @@ virDomainAuditFS(virDomainObjPtr vm, virt, reason, vmname, uuidstr, oldsrc, newsrc); -cleanup: + cleanup: VIR_FREE(vmname); VIR_FREE(oldsrc); VIR_FREE(newsrc); @@ -345,7 +345,7 @@ virDomainAuditNetDevice(virDomainDefPtr vmDef, virDomainNetDefPtr netDef, "virt=%s resrc=net reason=open %s uuid=%s net=%s %s rdev=%s", virt, vmname, uuidstr, macstr, dev_name, VIR_AUDIT_STR(rdev)); -cleanup: + cleanup: VIR_FREE(vmname); VIR_FREE(dev_name); VIR_FREE(rdev); @@ -469,7 +469,7 @@ virDomainAuditHostdev(virDomainObjPtr vm, virDomainHostdevDefPtr hostdev, goto cleanup; } -cleanup: + cleanup: VIR_FREE(vmname); VIR_FREE(device); VIR_FREE(address); @@ -530,7 +530,7 @@ virDomainAuditRedirdev(virDomainObjPtr vm, virDomainRedirdevDefPtr redirdev, virDomainRedirdevBusTypeToString(redirdev->bus), device); -cleanup: + cleanup: VIR_FREE(vmname); VIR_FREE(device); VIR_FREE(address); @@ -583,7 +583,7 @@ virDomainAuditTPM(virDomainObjPtr vm, virDomainTPMDefPtr tpm, break; } -cleanup: + cleanup: VIR_FREE(vmname); VIR_FREE(device); } @@ -704,7 +704,7 @@ virDoma
[libvirt] [PATCH 04/24] Indent top-level labels by one space in src/cpu/
--- src/cpu/cpu.c | 8 src/cpu/cpu_generic.c | 6 +++--- src/cpu/cpu_map.c | 6 +++--- src/cpu/cpu_powerpc.c | 20 ++-- src/cpu/cpu_x86.c | 50 +- 5 files changed, 45 insertions(+), 45 deletions(-) diff --git a/src/cpu/cpu.c b/src/cpu/cpu.c index 1994383..e91f5bb 100644 --- a/src/cpu/cpu.c +++ b/src/cpu/cpu.c @@ -103,7 +103,7 @@ cpuCompareXML(virCPUDefPtr host, ret = cpuCompare(host, cpu); -cleanup: + cleanup: virCPUDefFree(cpu); xmlXPathFreeContext(ctxt); xmlFreeDoc(doc); @@ -335,7 +335,7 @@ cpuBaselineXML(const char **xmlCPUs, cpustr = virCPUDefFormat(cpu, 0); -cleanup: + cleanup: if (cpus) { for (i = 0; i < ncpus; i++) virCPUDefFree(cpus[i]); @@ -347,7 +347,7 @@ cleanup: return cpustr; -error: + error: cpustr = NULL; goto cleanup; } @@ -577,7 +577,7 @@ cpuGetModels(const char *archName, char ***models) return data.len - 1; -error: + error: virStringFreeList(data.data); return -1; } diff --git a/src/cpu/cpu_generic.c b/src/cpu/cpu_generic.c index 1264da4..314d1e1 100644 --- a/src/cpu/cpu_generic.c +++ b/src/cpu/cpu_generic.c @@ -103,7 +103,7 @@ genericCompare(virCPUDefPtr host, else ret = VIR_CPU_COMPARE_IDENTICAL; -cleanup: + cleanup: virHashFree(hash); return ret; } @@ -188,12 +188,12 @@ genericBaseline(virCPUDefPtr *cpus, goto error; } -cleanup: + cleanup: VIR_FREE(features); return cpu; -error: + error: virCPUDefFree(cpu); cpu = NULL; goto cleanup; diff --git a/src/cpu/cpu_map.c b/src/cpu/cpu_map.c index 5a01d7b..fca306e 100644 --- a/src/cpu/cpu_map.c +++ b/src/cpu/cpu_map.c @@ -70,7 +70,7 @@ static int load(xmlXPathContextPtr ctxt, ret = 0; -cleanup: + cleanup: ctxt->node = ctxt_node; return ret; @@ -137,14 +137,14 @@ int cpuMapLoad(const char *arch, ret = 0; -cleanup: + cleanup: xmlXPathFreeContext(ctxt); xmlFreeDoc(xml); VIR_FREE(xpath); return ret; -no_memory: + no_memory: virReportOOMError(); goto cleanup; } diff --git a/src/cpu/cpu_powerpc.c b/src/cpu/cpu_powerpc.c index 36f4f25..3b868bb 100644 --- a/src/cpu/cpu_powerpc.c +++ b/src/cpu/cpu_powerpc.c @@ -163,7 +163,7 @@ ppcModelFromCPU(const virCPUDef *cpu, return model; -error: + error: ppcModelFree(model); return NULL; } @@ -198,10 +198,10 @@ ppcVendorLoad(xmlXPathContextPtr ctxt, map->vendors = vendor; } -cleanup: + cleanup: return 0; -ignore: + ignore: ppcVendorFree(vendor); goto cleanup; } @@ -263,11 +263,11 @@ ppcModelLoad(xmlXPathContextPtr ctxt, map->models = model; } -cleanup: + cleanup: VIR_FREE(vendor); return 0; -ignore: + ignore: ppcModelFree(model); goto cleanup; } @@ -326,7 +326,7 @@ ppcLoadMap(void) return map; -error: + error: ppcMapFree(map); return NULL; } @@ -431,7 +431,7 @@ ppcCompute(virCPUDefPtr host, ret = VIR_CPU_COMPARE_IDENTICAL; -cleanup: + cleanup: ppcMapFree(map); ppcModelFree(host_model); ppcModelFree(guest_model); @@ -487,7 +487,7 @@ ppcDecode(virCPUDefPtr cpu, ret = 0; -cleanup: + cleanup: ppcMapFree(map); return ret; @@ -632,12 +632,12 @@ ppcBaseline(virCPUDefPtr *cpus, cpu->type = VIR_CPU_TYPE_GUEST; cpu->match = VIR_CPU_MATCH_EXACT; -cleanup: + cleanup: ppcMapFree(map); return cpu; -error: + error: virCPUDefFree(cpu); cpu = NULL; goto cleanup; diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index 423bcc1..7328582 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -459,12 +459,12 @@ x86DataToCPU(const virCPUx86Data *data, x86DataToCPUFeatures(cpu, VIR_CPU_FEATURE_DISABLE, modelData, map)) goto error; -cleanup: + cleanup: virCPUx86DataFree(modelData); virCPUx86DataFree(copy); return cpu; -error: + error: virCPUDefFree(cpu); cpu = NULL; goto cleanup; @@ -549,14 +549,14 @@ x86VendorLoad(xmlXPathContextPtr ctxt, map->vendors = vendor; } -out: + out: VIR_FREE(string); return ret; -error: + error: ret = -1; -ignore: + ignore: x86VendorFree(vendor); goto out; } @@ -717,16 +717,16 @@ x86FeatureLoad(xmlXPathContextPtr ctxt, map->features = feature; } -out: + out: ctxt->node = ctxt_node; VIR_FREE(nodes); return ret; -error: + error: ret = -1; -ignore: + ignore: x86FeatureFree(feature); goto out; } @@ -756,7 +756,7 @@ x86DataFromCPUFeatures(virCPUDefPtr cpu, return data; -error: + error: virCPUx86DataFree(data); return NULL; } @@ -869,7 +869,7 @@ x86ModelFromCPU(const virCPUDef *cpu, return model; -error: + error: x86ModelFree(model); return NULL; } @@ -1055,15 +1055,15 @@ x86ModelLoad(xmlXPathContext
[libvirt] [PATCH 02/24] Indent top-level labels by one space in examples/
--- examples/dominfo/info1.c | 2 +- examples/domsuspend/suspend.c| 8 examples/hellolibvirt/hellolibvirt.c | 8 examples/openauth/openauth.c | 10 +- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/examples/dominfo/info1.c b/examples/dominfo/info1.c index 13c45ec..cd7ecd1 100644 --- a/examples/dominfo/info1.c +++ b/examples/dominfo/info1.c @@ -49,7 +49,7 @@ getDomainInfo(int id) printf("Domains %d: %d CPUs\n", id, info.nrVirtCpu); -error: + error: if (dom != NULL) virDomainFree(dom); if (conn != NULL) diff --git a/examples/domsuspend/suspend.c b/examples/domsuspend/suspend.c index f61a5d1..b1c49ec 100644 --- a/examples/domsuspend/suspend.c +++ b/examples/domsuspend/suspend.c @@ -130,7 +130,7 @@ parse_argv(int argc, char *argv[], *dom_name = argv[optind]; ret = 0; -cleanup: + cleanup: return ret; } @@ -161,7 +161,7 @@ fetch_domains(virConnectPtr conn) } ret = 0; -cleanup: + cleanup: free(domains); return ret; } @@ -216,7 +216,7 @@ suspend_and_resume(virConnectPtr conn, } ret = 0; -cleanup: + cleanup: if (dom) virDomainFree(dom); return ret; @@ -257,7 +257,7 @@ main(int argc, char *argv[]) goto cleanup; ret = EXIT_SUCCESS; -cleanup: + cleanup: if (conn) { int tmp; tmp = virConnectClose(conn); diff --git a/examples/hellolibvirt/hellolibvirt.c b/examples/hellolibvirt/hellolibvirt.c index 0179fad..c64fa96 100644 --- a/examples/hellolibvirt/hellolibvirt.c +++ b/examples/hellolibvirt/hellolibvirt.c @@ -46,7 +46,7 @@ showHypervisorInfo(virConnectPtr conn) minor, release); -out: + out: return ret; } @@ -107,7 +107,7 @@ showDomains(virConnectPtr conn) } free(nameList); -out: + out: return ret; } @@ -155,7 +155,7 @@ main(int argc, char *argv[]) goto disconnect; } -disconnect: + disconnect: if (0 != virConnectClose(conn)) { printf("Failed to disconnect from hypervisor: %s\n", virGetLastErrorMessage()); @@ -164,6 +164,6 @@ disconnect: printf("Disconnected from hypervisor\n"); } -out: + out: return ret; } diff --git a/examples/openauth/openauth.c b/examples/openauth/openauth.c index e7058fe..fae96e0 100644 --- a/examples/openauth/openauth.c +++ b/examples/openauth/openauth.c @@ -40,7 +40,7 @@ showError(virConnectPtr conn) virResetError(err); free(err); -out: + out: return; } @@ -82,7 +82,7 @@ showHypervisorInfo(virConnectPtr conn) minor, release); -out: + out: return ret; } @@ -144,7 +144,7 @@ showDomains(virConnectPtr conn) free(*(nameList + i)); } -out: + out: free(nameList); return ret; } @@ -274,7 +274,7 @@ main(int argc, char *argv[]) goto disconnect; } - disconnect: + disconnect: if (virConnectClose(conn) != 0) { printf("Failed to disconnect from hypervisor\n"); showError(conn); @@ -283,6 +283,6 @@ main(int argc, char *argv[]) printf("Disconnected from hypervisor\n"); } - out: + out: return ret; } -- 1.8.3.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 01/24] Indent top-level labels by one space in daemon/
--- daemon/libvirtd-config.c | 6 +- daemon/libvirtd.c| 14 +-- daemon/remote.c | 222 +++ daemon/stream.c | 4 +- 4 files changed, 123 insertions(+), 123 deletions(-) diff --git a/daemon/libvirtd-config.c b/daemon/libvirtd-config.c index a146340..c31ef16 100644 --- a/daemon/libvirtd-config.c +++ b/daemon/libvirtd-config.c @@ -215,7 +215,7 @@ daemonConfigFilePath(bool privileged, char **configfile) return 0; -error: + error: return -1; } @@ -301,7 +301,7 @@ daemonConfigNew(bool privileged ATTRIBUTE_UNUSED) return data; -error: + error: daemonConfigFree(data); return NULL; } @@ -443,7 +443,7 @@ daemonConfigLoadOptions(struct daemonConfig *data, return 0; -error: + error: return -1; } diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c index 4179147..e247259 100644 --- a/daemon/libvirtd.c +++ b/daemon/libvirtd.c @@ -242,7 +242,7 @@ static int daemonForkIntoBackground(const char *argv0) } } -error: + error: VIR_FORCE_CLOSE(statuspipe[0]); VIR_FORCE_CLOSE(statuspipe[1]); return -1; @@ -280,7 +280,7 @@ daemonPidFilePath(bool privileged, return 0; -error: + error: return -1; } @@ -325,7 +325,7 @@ daemonUnixSocketPaths(struct daemonConfig *config, } return 0; -error: + error: return -1; } @@ -618,7 +618,7 @@ static int daemonSetupNetworking(virNetServerPtr srv, return 0; -error: + error: #if WITH_GNUTLS virObjectUnref(svcTLS); #endif @@ -735,7 +735,7 @@ daemonSetupLogging(struct daemonConfig *config, return 0; -error: + error: return -1; } @@ -948,7 +948,7 @@ static void daemonRunStateInit(void *opaque) #endif /* Only now accept clients from network */ virNetServerUpdateServices(srv, true); -cleanup: + cleanup: daemonInhibitCallback(false, srv); virObjectUnref(srv); virObjectUnref(sysident); @@ -1539,7 +1539,7 @@ int main(int argc, char **argv) { virHookCall(VIR_HOOK_DRIVER_DAEMON, "-", VIR_HOOK_DAEMON_OP_SHUTDOWN, 0, "shutdown", NULL, NULL); -cleanup: + cleanup: virNetlinkEventServiceStopAll(); virObjectUnref(remoteProgram); virObjectUnref(lxcProgram); diff --git a/daemon/remote.c b/daemon/remote.c index 50e258d..8476961 100644 --- a/daemon/remote.c +++ b/daemon/remote.c @@ -156,7 +156,7 @@ remoteRelayDomainEventCheckACL(virNetServerClientPtr client, goto cleanup; ret = virConnectDomainEventRegisterAnyCheckACL(conn, &def); -cleanup: + cleanup: ignore_value(virIdentitySetCurrent(NULL)); virObjectUnref(identity); return ret; @@ -183,7 +183,7 @@ remoteRelayNetworkEventCheckACL(virNetServerClientPtr client, goto cleanup; ret = virConnectNetworkEventRegisterAnyCheckACL(conn, &def); -cleanup: + cleanup: ignore_value(virIdentitySetCurrent(NULL)); virObjectUnref(identity); return ret; @@ -210,7 +210,7 @@ remoteRelayDomainQemuMonitorEventCheckACL(virNetServerClientPtr client, goto cleanup; ret = virConnectDomainQemuMonitorEventRegisterCheckACL(conn, &def); -cleanup: + cleanup: ignore_value(virIdentitySetCurrent(NULL)); virObjectUnref(identity); return ret; @@ -412,7 +412,7 @@ remoteRelayDomainEventIOError(virConnectPtr conn, } return 0; -error: + error: VIR_FREE(data.srcPath); VIR_FREE(data.devAlias); return -1; @@ -464,7 +464,7 @@ remoteRelayDomainEventIOErrorReason(virConnectPtr conn, return 0; -error: + error: VIR_FREE(data.srcPath); VIR_FREE(data.devAlias); VIR_FREE(data.reason); @@ -539,7 +539,7 @@ remoteRelayDomainEventGraphics(virConnectPtr conn, return 0; -error: + error: VIR_FREE(data.authScheme); VIR_FREE(data.local.node); VIR_FREE(data.local.service); @@ -595,7 +595,7 @@ remoteRelayDomainEventBlockJob(virConnectPtr conn, } return 0; -error: + error: VIR_FREE(data.path); return -1; } @@ -693,7 +693,7 @@ remoteRelayDomainEventDiskChange(virConnectPtr conn, return 0; -error: + error: VIR_FREE(oldSrcPath_p); VIR_FREE(newSrcPath_p); return -1; @@ -1030,7 +1030,7 @@ remoteRelayDomainQemuMonitorEvent(virConnectPtr conn, &data); return; -error: + error: VIR_FREE(data.event); VIR_FREE(details_p); } @@ -1180,7 +1180,7 @@ remoteDispatchConnectOpen(virNetServerPtr server, rv = 0; -cleanup: + cleanup: if (rv < 0) virNetMessageSaveError(rerr); virMutexUnlock(&priv->lock); @@ -1229,7 +1229,7 @@ remoteDispatchDomainGetSchedulerType(virNetServerPtr server ATTRIBUTE_UNUSED, ret->nparams = nparams; rv = 0; -cleanup: + cleanup: if (rv < 0) virNetMessageSaveError(rerr); if (dom) @@ -1304,7 +1304,7 @@ remoteSerializeTypedParameters(virTypedParameterPtr params, val = NULL; rv = 0; -cleanup: + cleanup:
[libvirt] [PATCH 00/24] Indent top-level labels by one space
Change the existing code and introduce a syntax-check rule. Ján Tomko (24): Indent top-level labels by one space in daemon/ Indent top-level labels by one space in examples/ Indent top-level labels by one space in src/conf/ Indent top-level labels by one space in src/cpu/ Indent top-level labels by one space in src/esx/ Indent top-level labels by one space in src/libxl/ Indent top-level labels by one space in libvirt.c Indent top-level labels by one space in src/locking/ Indent top-level labels by one space in src/lxc/ Indent top-level labels by one space in src/network/ Indent top-level labels by one space in src/nwfilter/ Indent top-level labels by one space in src/parallels/ Indent top-level labels by one space in src/qemu/ Indent top-level labels by one space in src/remote/ Indent top-level labels by one space in src/rpc/ Indent top-level labels by one space in src/storage/ Indent top-level labels by one space in src/test/ Indent top-level labels by one space in src/util/ Indent top-level labels by one space in src/vbox/ Indent top-level labels by one space in src/xen/ Indent top-level labels by one space in the rest of src/ Indent top-level labels by one space in tests/ Indent top-level labels by one space in tools/ Add a rule for indenting labels HACKING | 31 +- cfg.mk| 6 + daemon/libvirtd-config.c | 6 +- daemon/libvirtd.c | 14 +- daemon/remote.c | 222 +- daemon/stream.c | 4 +- docs/hacking.html.in | 37 +- examples/dominfo/info1.c | 2 +- examples/domsuspend/suspend.c | 8 +- examples/hellolibvirt/hellolibvirt.c | 8 +- examples/openauth/openauth.c | 10 +- src/access/viraccessdriverpolkit.c| 4 +- src/access/viraccessmanager.c | 2 +- src/bhyve/bhyve_command.c | 4 +- src/bhyve/bhyve_driver.c | 26 +- src/bhyve/bhyve_process.c | 4 +- src/conf/capabilities.c | 6 +- src/conf/cpu_conf.c | 12 +- src/conf/device_conf.c| 2 +- src/conf/domain_audit.c | 18 +- src/conf/domain_conf.c| 222 +- src/conf/domain_event.c | 10 +- src/conf/interface_conf.c | 20 +- src/conf/netdev_bandwidth_conf.c | 6 +- src/conf/netdev_vlan_conf.c | 2 +- src/conf/netdev_vport_profile_conf.c | 4 +- src/conf/network_conf.c | 84 ++-- src/conf/network_event.c | 2 +- src/conf/node_device_conf.c | 30 +- src/conf/nwfilter_conf.c | 22 +- src/conf/nwfilter_ipaddrmap.c | 4 +- src/conf/nwfilter_params.c| 14 +- src/conf/object_event.c | 6 +- src/conf/snapshot_conf.c | 12 +- src/conf/storage_conf.c | 38 +- src/conf/storage_encryption_conf.c| 6 +- src/conf/virchrdev.c | 8 +- src/cpu/cpu.c | 8 +- src/cpu/cpu_generic.c | 6 +- src/cpu/cpu_map.c | 6 +- src/cpu/cpu_powerpc.c | 20 +- src/cpu/cpu_x86.c | 50 +-- src/datatypes.c | 20 +- src/driver.c | 2 +- src/esx/esx_driver.c | 110 ++--- src/esx/esx_interface_driver.c| 4 +- src/esx/esx_network_driver.c | 12 +- src/esx/esx_storage_backend_iscsi.c | 22 +- src/esx/esx_storage_backend_vmfs.c| 36 +- src/esx/esx_storage_driver.c | 2 +- src/esx/esx_util.c| 6 +- src/esx/esx_vi.c | 86 ++-- src/esx/esx_vi_methods.c | 2 +- src/esx/esx_vi_types.c| 18 +- src/fdstream.c| 16 +- src/hyperv/hyperv_driver.c| 44 +- src/hyperv/hyperv_util.c | 2 +- src/hyperv/hyperv_wmi.c | 4 +- src/interface/interface_backend_netcf.c | 28 +- src/interface/interface_backend_udev.c| 26 +- src/libvirt-lxc.c | 6 +- src/libvirt-qemu.c| 10 +- src/libvirt.c | 680 +++--- src/libxl/libxl_conf.c| 18 +- src/libxl/libxl_domain.c | 24 +- src/libxl/libxl_driver.c | 152 +++ src/locking/domain_lock.c | 10 +- src/locking/lock_daemon.c | 26 +- src/locking/lock_daemon_config.c | 4 +- src/locking/lock_daemon_dispatc