[libvirt] [PATCH v2 07/10] Narrow down a parameter to function

Martin Kletzander mkletzan at redhat.com
Mon Jul 25 09:39:45 UTC 2016


On Sat, Jul 16, 2016 at 02:42:52AM +0200, Tomasz Flendrich wrote:
>Attaching to both live and config will soon be tested, so
>testQemuHotplugCheckResult will be used on both def and newDef.
>

Or you could just pass the modification impact flag in as well and
select ->def or ->newDef based on that.

>---
> tests/qemuhotplugtest.c | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
>diff --git a/tests/qemuhotplugtest.c b/tests/qemuhotplugtest.c
>index 0a5f068..d862a0e 100644
>--- a/tests/qemuhotplugtest.c
>+++ b/tests/qemuhotplugtest.c
>@@ -175,7 +175,7 @@ testQemuHotplugUpdate(virDomainObjPtr vm,
> }
>
> static int
>-testQemuHotplugCheckResult(virDomainObjPtr vm,
>+testQemuHotplugCheckResult(virDomainDefPtr def,
>                            const char *expected,
>                            const char *expectedFile,
>                            bool fail)
>@@ -183,11 +183,11 @@ testQemuHotplugCheckResult(virDomainObjPtr vm,
>     char *actual;
>     int ret;
>
>-    actual = virDomainDefFormat(vm->def, driver.caps,
>+    actual = virDomainDefFormat(def, driver.caps,
>                                 VIR_DOMAIN_DEF_FORMAT_SECURE);
>     if (!actual)
>         return -1;
>-    vm->def->id = QEMU_HOTPLUG_TEST_DOMAIN_ID;
>+    def->id = QEMU_HOTPLUG_TEST_DOMAIN_ID;
>

This should not be set for newDef, it needs to be kept at '-1' for
config updates, because 'id != -1' means the domain is running.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20160725/b2700cad/attachment-0001.sig>


More information about the libvir-list mailing list