[libvirt] error: internal error unable to execute QEMU command 'getfd': No file descriptor supplied via SCM_RIGHTS

饶俊明(云平台事业部) RAOJUNMING113 at pingan.com.cn
Sat May 14 06:01:29 UTC 2016


Hi,



I am getting the following error when I try to migrate VM on my network using virsh migrate:

         error : qemuMonitorJSONCheckError:359 : internal error unable to execute QEMU command 'getfd': No file descriptor supplied via SCM_RIGHTS ;

but, other vm's running on the server successfully migrated to remote server;



Libvirt Version: libvirt-0.10.2-46.el6.x86_64;

Qemu-kvm Version: qemu-kvm-0.12.1.2-2.448.el6.3.x86_64;

OS Version: Red Hat Enterprise Linux Server release 6.6;



Thanks~













Work Hard, Have Fun, Make History!



Mail: raojunming113 at pingan.com





-----邮件原件-----
发件人: libvir-list-bounces at redhat.com [mailto:libvir-list-bounces at redhat.com] 代表 libvir-list-request at redhat.com
发送时间: 2016年5月14日 7:47
收件人: libvir-list at redhat.com
主题: libvir-list Digest, Vol 126, Issue 182



Send libvir-list mailing list submissions to

         libvir-list at redhat.com<mailto:libvir-list at redhat.com>



To subscribe or unsubscribe via the World Wide Web, visit

         https://www.redhat.com/mailman/listinfo/libvir-list

or, via email, send a message with subject or body 'help' to

         libvir-list-request at redhat.com<mailto:libvir-list-request at redhat.com>



You can reach the person managing the list at

         libvir-list-owner at redhat.com<mailto:libvir-list-owner at redhat.com>



When replying, please edit your Subject line so it is more specific than "Re: Contents of libvir-list digest..."





Today's Topics:



   1. [PATCH 3/6] iscsi: Export virISCSITargetAutologin (John Ferlan)

   2. [PATCH 4/6] util: Add "--op nonpersistent" to iSCSI

      sendtargets (John Ferlan)

   3. [PATCH 5/6] iscsi: Inhibit autologin for only libvirt         managed

      targets (John Ferlan)

   4. [PATCH 6/6] iscsi: Remove initiatoriqn from

      virISCSIScanTargets (John Ferlan)

   5. [PATCH] capabilities: Advertise cpuselection if -cpu host      is

      usable (Jiri Denemark)

   6. Re: [PATCH 0/2] libxl: support pvusb (Jim Fehlig)

   7. Re: [PATCH] libxl: add .domainInterfaceAddresses (Jim Fehlig)





----------------------------------------------------------------------



Message: 1

Date: Fri, 13 May 2016 17:29:23 -0400

From: John Ferlan <jferlan at redhat.com<mailto:jferlan at redhat.com>>

To: libvir-list at redhat.com<mailto:libvir-list at redhat.com>

Subject: [libvirt] [PATCH 3/6] iscsi: Export virISCSITargetAutologin

Message-ID: <1463174966-3185-4-git-send-email-jferlan at redhat.com<mailto:1463174966-3185-4-git-send-email-jferlan at redhat.com>>



Make it accessible for future patches



Signed-off-by: John Ferlan <jferlan at redhat.com<mailto:jferlan at redhat.com>>

---

src/libvirt_private.syms | 1 +

src/util/viriscsi.c      | 2 +-

src/util/viriscsi.h      | 7 +++++++

3 files changed, 9 insertions(+), 1 deletion(-)



diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index fb24808..719d753 100644

--- a/src/libvirt_private.syms

+++ b/src/libvirt_private.syms

@@ -1675,6 +1675,7 @@ virISCSIGetSession;  virISCSINodeUpdate;  virISCSIRescanLUNs;  virISCSIScanTargets;

+virISCSITargetAutologin;



 # util/virjson.h

diff --git a/src/util/viriscsi.c b/src/util/viriscsi.c index be296d7..ea01b3d 100644

--- a/src/util/viriscsi.c

+++ b/src/util/viriscsi.c

@@ -404,7 +404,7 @@ virISCSIGetTargets(char **const groups,  }



-static int

+int

virISCSITargetAutologin(const char *portal,

                         const char *initiatoriqn,

                         const char *target, diff --git a/src/util/viriscsi.h b/src/util/viriscsi.h index f4093f7..3e7ea68 100644

--- a/src/util/viriscsi.h

+++ b/src/util/viriscsi.h

@@ -48,6 +48,13 @@ virISCSIRescanLUNs(const char *session)

     ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK;

 int

+virISCSITargetAutologin(const char *portal,

+                        const char *initiatoriqn,

+                        const char *target,

+                        bool enable)

+    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(3) ATTRIBUTE_RETURN_CHECK;

+

+int

virISCSIScanTargets(const char *portal,

                     const char *initiatoriqn,

                     size_t *ntargetsret,

--

2.5.5







------------------------------



Message: 2

Date: Fri, 13 May 2016 17:29:24 -0400

From: John Ferlan <jferlan at redhat.com<mailto:jferlan at redhat.com>>

To: libvir-list at redhat.com<mailto:libvir-list at redhat.com>

Subject: [libvirt] [PATCH 4/6] util: Add "--op nonpersistent" to iSCSI

         sendtargets

Message-ID: <1463174966-3185-5-git-send-email-jferlan at redhat.com<mailto:1463174966-3185-5-git-send-email-jferlan at redhat.com>>



From: Fritz Elfert <fritz at fritz-elfert.de<mailto:fritz at fritz-elfert.de>>



The root cause of commit id '3c12b654' was to ensure that an iSCSI

sendtargets command to discover all the available targets on the

host didn't reset the "node.startup" value for a future restarts

on any target that libvirt is managing.



However, by adding the "--op nonpersistent" inhibits the iSCSI

initiator from recording/modifying in the bowels /var/lib/iscsi

of any target.



Signed-off-by: John Ferlan <jferlan at redhat.com<mailto:jferlan at redhat.com>>

---

src/util/viriscsi.c  | 1 +

tests/viriscsitest.c | 4 +++-

2 files changed, 4 insertions(+), 1 deletion(-)



diff --git a/src/util/viriscsi.c b/src/util/viriscsi.c

index ea01b3d..36612c5 100644

--- a/src/util/viriscsi.c

+++ b/src/util/viriscsi.c

@@ -446,6 +446,7 @@ virISCSIScanTargets(const char *portal,

                                              "--mode", "discovery",

                                              "--type", "sendtargets",

                                              "--portal", portal,

+                                             "--op", "nonpersistent",

                                              NULL);

     memset(&list, 0, sizeof(list));

diff --git a/tests/viriscsitest.c b/tests/viriscsitest.c

index c697a4a..b5b0e20 100644

--- a/tests/viriscsitest.c

+++ b/tests/viriscsitest.c

@@ -90,7 +90,9 @@ static void testIscsiadmCb(const char *const*args,

                args[4] && STREQ(args[4], "sendtargets") &&

                args[5] && STREQ(args[5], "--portal") &&

                args[6] && STREQ(args[6], "10.20.30.40:3260,1") &&

-               args[7] == NULL) {

+               args[7] && STREQ(args[7], "--op") &&

+               args[8] && STREQ(args[8], "nonpersistent") &&

+               args[9] == NULL) {

         ignore_value(VIR_STRDUP(*output, iscsiadmSendtargetsOutput));

     } else {

         *status = -1;

--

2.5.5







------------------------------



Message: 3

Date: Fri, 13 May 2016 17:29:25 -0400

From: John Ferlan <jferlan at redhat.com<mailto:jferlan at redhat.com>>

To: libvir-list at redhat.com<mailto:libvir-list at redhat.com>

Subject: [libvirt] [PATCH 5/6] iscsi: Inhibit autologin for only

         libvirt        managed targets

Message-ID: <1463174966-3185-6-git-send-email-jferlan at redhat.com<mailto:1463174966-3185-6-git-send-email-jferlan at redhat.com>>



https://bugzilla.redhat.com/show_bug.cgi?id=1331552



Based on code originally posted by Fritz Elfert <fritz at fritz-elfert.de<mailto:fritz at fritz-elfert.de>>

to remove the Autologin code entirely from libvirt, but reworked to only

set Autologin for libvirt managed targets.



Commit id '3c12b654' took a "large hammer" approach to inhibiting logins

which causes issues if there are iSCSI targets not being managed by libvirt.



Now that the previous commit ensures that the iscsi initiator doesn't update

the /var/lib/iscsi tree with the results for a 'sendtargets' by using the

"--op nonpersistent" option, let's remove the code from virISCSIScanTargets

that disables autologin for every target, but add that same setting into

the start pool code for each managed/started target to ensure that nothing

else goes and tries to autologin.



Signed-off-by: John Ferlan <jferlan at redhat.com<mailto:jferlan at redhat.com>>

---

src/storage/storage_backend_iscsi.c | 11 +++++++++++

src/util/viriscsi.c                 | 15 ++-------------

2 files changed, 13 insertions(+), 13 deletions(-)



diff --git a/src/storage/storage_backend_iscsi.c b/src/storage/storage_backend_iscsi.c

index 9e2d01e..5fbf390 100644

--- a/src/storage/storage_backend_iscsi.c

+++ b/src/storage/storage_backend_iscsi.c

@@ -404,6 +404,17 @@ virStorageBackendISCSIStartPool(virConnectPtr conn,

                                 NULL, NULL) < 0)

             goto cleanup;

+        /* Inhibit our autologin for our managed source device */

+        if (virISCSITargetAutologin(portal,

+                                    pool->def->source.initiator.iqn,

+                                    pool->def->source.devices[0].path,

+                                    false) < 0) {

+            virReportError(VIR_ERR_INTERNAL_ERROR,

+                           _("failed to inhibit autologin for target '%s'"),

+                           pool->def->source.devices[0].path);

+            goto cleanup;

+        }

+

         if (virStorageBackendISCSISetAuth(portal, conn, &pool->def->source) < 0)

             goto cleanup;

diff --git a/src/util/viriscsi.c b/src/util/viriscsi.c

index 36612c5..3133d88 100644

--- a/src/util/viriscsi.c

+++ b/src/util/viriscsi.c

@@ -415,13 +415,14 @@ virISCSITargetAutologin(const char *portal,

                                 "--value", enable ? "automatic" : "manual",

                                 NULL };

+    VIR_DEBUG("set autologin for '%s' to '%d'", target, enable);

     return virISCSIConnection(portal, initiatoriqn, target, extraargv);

}



 int

virISCSIScanTargets(const char *portal,

-                    const char *initiatoriqn,

+                    const char *initiatoriqn ATTRIBUTE_UNUSED,

                     size_t *ntargetsret,

                     char ***targetsret)

{

@@ -459,18 +460,6 @@ virISCSIScanTargets(const char *portal,

                            &list, NULL, NULL) < 0)

         goto cleanup;

-    for (i = 0; i < list.ntargets; i++) {

-        /* We have to ignore failure, because we can't undo

-         * the results of 'sendtargets', unless we go scrubbing

-         * around in the dirt in /var/lib/iscsi.

-         */

-        if (virISCSITargetAutologin(portal,

-                                    initiatoriqn,

-                                    list.targets[i], false) < 0)

-            VIR_WARN("Unable to disable auto-login on iSCSI target %s: %s",

-                     portal, list.targets[i]);

-    }

-

     if (ntargetsret && targetsret) {

         *ntargetsret = list.ntargets;

         *targetsret = list.targets;

--

2.5.5







------------------------------



Message: 4

Date: Fri, 13 May 2016 17:29:26 -0400

From: John Ferlan <jferlan at redhat.com<mailto:jferlan at redhat.com>>

To: libvir-list at redhat.com<mailto:libvir-list at redhat.com>

Subject: [libvirt] [PATCH 6/6] iscsi: Remove initiatoriqn from

         virISCSIScanTargets

Message-ID: <1463174966-3185-7-git-send-email-jferlan at redhat.com<mailto:1463174966-3185-7-git-send-email-jferlan at redhat.com>>



No longer necessary to have it, so remove it.



Signed-off-by: John Ferlan <jferlan at redhat.com<mailto:jferlan at redhat.com>>

---

src/storage/storage_backend_iscsi.c | 8 ++------

src/util/viriscsi.c                 | 3 +--

src/util/viriscsi.h                 | 1 -

tests/viriscsitest.c                | 3 +--

4 files changed, 4 insertions(+), 11 deletions(-)



diff --git a/src/storage/storage_backend_iscsi.c b/src/storage/storage_backend_iscsi.c

index 5fbf390..b6b23d3 100644

--- a/src/storage/storage_backend_iscsi.c

+++ b/src/storage/storage_backend_iscsi.c

@@ -197,9 +197,7 @@ virStorageBackendISCSIFindPoolSources(virConnectPtr conn ATTRIBUTE_UNUSED,

     if (!(portal = virStorageBackendISCSIPortal(source)))

         goto cleanup;

-    if (virISCSIScanTargets(portal,

-                            source->initiator.iqn,

-                            &ntargets, &targets) < 0)

+    if (virISCSIScanTargets(portal, &ntargets, &targets) < 0)

         goto cleanup;

     if (VIR_ALLOC_N(list.sources, ntargets) < 0)

@@ -399,9 +397,7 @@ virStorageBackendISCSIStartPool(virConnectPtr conn,

          * iscsiadm doesn't let you login to a target, unless you've

          * first issued a 'sendtargets' command to the portal :-(

          */

-        if (virISCSIScanTargets(portal,

-                                pool->def->source.initiator.iqn,

-                                NULL, NULL) < 0)

+        if (virISCSIScanTargets(portal, NULL, NULL) < 0)

             goto cleanup;

         /* Inhibit our autologin for our managed source device */

diff --git a/src/util/viriscsi.c b/src/util/viriscsi.c

index 3133d88..a2acb67 100644

--- a/src/util/viriscsi.c

+++ b/src/util/viriscsi.c

@@ -321,7 +321,7 @@ virISCSIConnection(const char *portal,

              * portal. Without the sendtargets all that is received is a

              * "iscsiadm: No records found"

              */

-            if (virISCSIScanTargets(portal, initiatoriqn, NULL, NULL) < 0)

+            if (virISCSIScanTargets(portal, NULL, NULL) < 0)

                 goto cleanup;

             break;

@@ -422,7 +422,6 @@ virISCSITargetAutologin(const char *portal,

 int

virISCSIScanTargets(const char *portal,

-                    const char *initiatoriqn ATTRIBUTE_UNUSED,

                     size_t *ntargetsret,

                     char ***targetsret)

{

diff --git a/src/util/viriscsi.h b/src/util/viriscsi.h

index 3e7ea68..44fb1f4 100644

--- a/src/util/viriscsi.h

+++ b/src/util/viriscsi.h

@@ -56,7 +56,6 @@ virISCSITargetAutologin(const char *portal,

 int

virISCSIScanTargets(const char *portal,

-                    const char *initiatoriqn,

                     size_t *ntargetsret,

                     char ***targetsret)

     ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK;

diff --git a/tests/viriscsitest.c b/tests/viriscsitest.c

index b5b0e20..40e4d10 100644

--- a/tests/viriscsitest.c

+++ b/tests/viriscsitest.c

@@ -145,8 +145,7 @@ testISCSIScanTargets(const void *data)

     virCommandSetDryRun(NULL, testIscsiadmCb, NULL);

-    if (virISCSIScanTargets(info->portal, NULL,

-                            &ntargets, &targets) < 0)

+    if (virISCSIScanTargets(info->portal, &ntargets, &targets) < 0)

         goto cleanup;

     if (info->nexpected != ntargets) {

--

2.5.5







------------------------------



Message: 5

Date: Fri, 13 May 2016 23:36:17 +0200

From: Jiri Denemark <jdenemar at redhat.com<mailto:jdenemar at redhat.com>>

To: libvir-list at redhat.com<mailto:libvir-list at redhat.com>

Subject: [libvirt] [PATCH] capabilities: Advertise cpuselection if

         -cpu host is usable

Message-ID:

         <a3394e6b8d0f28591147dd981909e9a1ae39f64d.1463175377.git.jdenemar at redhat.com<mailto:a3394e6b8d0f28591147dd981909e9a1ae39f64d.1463175377.git.jdenemar at redhat.com>>





When -cpu host is supported by a QEMU binary, a user can use

<cpu mode='host-passthrough'/> in domain XML even when libvirtd failed

to find a matching model for the host CPU. Let's make it obvious by

advertising <cpuselection/> guest capability whenever -cpu host is

supported.



Signed-off-by: Jiri Denemark <jdenemar at redhat.com<mailto:jdenemar at redhat.com>>

---

src/qemu/qemu_capabilities.c                      | 7 ++++---

tests/qemucaps2xmldata/all_1.6.0-1.xml            | 1 +

tests/qemucaps2xmldata/nodisksnapshot_1.6.0-1.xml | 1 +

3 files changed, 6 insertions(+), 3 deletions(-)



diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c

index 1bddf43..fcfd1cd 100644

--- a/src/qemu/qemu_capabilities.c

+++ b/src/qemu/qemu_capabilities.c

@@ -928,9 +928,10 @@ virQEMUCapsInitGuestFromBinary(virCapsPtr caps,

     machines = NULL;

     nmachines = 0;

-    if (caps->host.cpu &&

-        caps->host.cpu->model &&

-        virQEMUCapsGetCPUDefinitions(qemubinCaps, NULL) > 0 &&

+    if ((virQEMUCapsGet(qemubinCaps, QEMU_CAPS_CPU_HOST) ||

+         (caps->host.cpu &&

+          caps->host.cpu->model &&

+          virQEMUCapsGetCPUDefinitions(qemubinCaps, NULL) > 0)) &&

         !virCapabilitiesAddGuestFeature(guest, "cpuselection", true, false))

         goto cleanup;

diff --git a/tests/qemucaps2xmldata/all_1.6.0-1.xml b/tests/qemucaps2xmldata/all_1.6.0-1.xml

index 2489f49..84d6000 100644

--- a/tests/qemucaps2xmldata/all_1.6.0-1.xml

+++ b/tests/qemucaps2xmldata/all_1.6.0-1.xml

@@ -18,6 +18,7 @@

       </domain>

     </arch>

     <features>

+      <cpuselection/>

       <deviceboot/>

       <disksnapshot default='on' toggle='no'/>

       <acpi default='on' toggle='yes'/>

diff --git a/tests/qemucaps2xmldata/nodisksnapshot_1.6.0-1.xml b/tests/qemucaps2xmldata/nodisksnapshot_1.6.0-1.xml

index 281fab0..28762c2 100644

--- a/tests/qemucaps2xmldata/nodisksnapshot_1.6.0-1.xml

+++ b/tests/qemucaps2xmldata/nodisksnapshot_1.6.0-1.xml

@@ -18,6 +18,7 @@

       </domain>

     </arch>

     <features>

+      <cpuselection/>

       <deviceboot/>

       <disksnapshot default='off' toggle='no'/>

       <acpi default='on' toggle='yes'/>

--

2.8.2







------------------------------



Message: 6

Date: Fri, 13 May 2016 16:57:30 -0600

From: Jim Fehlig <jfehlig at suse.com<mailto:jfehlig at suse.com>>

To: Joao Martins <joao.m.martins at oracle.com<mailto:joao.m.martins at oracle.com>>

Cc: libvirt-list at redhat.com<mailto:libvirt-list at redhat.com>

Subject: Re: [libvirt] [PATCH 0/2] libxl: support pvusb

Message-ID: <57365BDA.7090005 at suse.com<mailto:57365BDA.7090005 at suse.com>>

Content-Type: text/plain; charset=windows-1252



On 05/13/2016 07:14 AM, Joao Martins wrote:

> On 05/12/2016 11:43 PM, Jim Fehlig wrote:

>> Chunyan Liu wrote:

>>> This patch series is to support pvusb in libxl driver.

>>>

>>> Chunyan Liu (2):

>>>   libxl: support creating guest with USB hostdev

>>>   libxl: support hotplug USB host device

>> This series should also include support for converting domXML USB config to/from

>> xl.cfg(5) in src/xenconfig/xen_xl.c, along with a test.

>>

>> FYI, the series fails to build with Xen < 4.7, where LIBXL_HAVE_PVUSB is not

>> defined :-).

> Probably a nice follow-up after this series is in, would be to add the USB

> subsys type to domain capabilities (that you address in the OVMF series)



Yes, good point. I'll add it to that series if this one makes it in first.



Speaking of the OVMF series, I've fixed a few things after more testing and will

rebase and resend a V2. Thanks in advance if either of you have time to look at it.



Regards,

Jim







------------------------------



Message: 7

Date: Fri, 13 May 2016 17:47:09 -0600

From: Jim Fehlig <jfehlig at suse.com<mailto:jfehlig at suse.com>>

To: Chunyan Liu <cyliu at suse.com<mailto:cyliu at suse.com>>, libvirt-list at redhat.com<mailto:libvirt-list at redhat.com>

Subject: Re: [libvirt] [PATCH] libxl: add .domainInterfaceAddresses

Message-ID: <5736677D.8030209 at suse.com<mailto:5736677D.8030209 at suse.com>>

Content-Type: text/plain; charset=windows-1252



On 05/13/2016 12:21 AM, Chunyan Liu wrote:

> Add .domainInterfaceAddresses so that user can have a way to

> get domain interface address by 'virsh domifaddr'. Currently

> it only supports '--source lease'.

>

> Signed-off: Chunyan Liu <cyliu at suse.com<mailto:cyliu at suse.com>>

> ---

>  src/libxl/libxl_driver.c | 140 +++++++++++++++++++++++++++++++++++++++++++++++

>  1 file changed, 140 insertions(+)

>

> diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c

> index 062d6f8..f2bd6fa 100644

> --- a/src/libxl/libxl_driver.c

> +++ b/src/libxl/libxl_driver.c

> @@ -5425,6 +5425,145 @@ static int libxlNodeGetSecurityModel(virConnectPtr conn,

>      return 0;

>  }

>

> +static int

> +libxlGetDHCPInterfaces(virDomainPtr dom,

> +                       virDomainObjPtr vm,

> +                       virDomainInterfacePtr **ifaces)

> +{

> +    int rv = -1;

> +    int n_leases = 0;

> +    size_t i, j;

> +    size_t ifaces_count = 0;

> +    virNetworkPtr network = NULL;

> +    char macaddr[VIR_MAC_STRING_BUFLEN];

> +    virDomainInterfacePtr iface = NULL;

> +    virNetworkDHCPLeasePtr *leases = NULL;

> +    virDomainInterfacePtr *ifaces_ret = NULL;

> +

> +    if (!dom->conn->networkDriver ||

> +        !dom->conn->networkDriver->networkGetDHCPLeases) {

> +        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",

> +                       _("Network driver does not support DHCP lease query"));

> +        return -1;

> +    }

> +

> +    for (i = 0; i < vm->def->nnets; i++) {

> +        if (vm->def->nets[i]->type != VIR_DOMAIN_NET_TYPE_NETWORK)

> +            continue;

> +

> +        virMacAddrFormat(&(vm->def->nets[i]->mac), macaddr);

> +        virObjectUnref(network);

> +        network = virNetworkLookupByName(dom->conn,

> +                                         vm->def->nets[i]->data.network.name);

> +

> +        if ((n_leases = virNetworkGetDHCPLeases(network, macaddr,

> +                                                &leases, 0)) < 0)

> +            goto error;

> +

> +        if (n_leases) {

> +            if (VIR_EXPAND_N(ifaces_ret, ifaces_count, 1) < 0)

> +                goto error;

> +

> +            if (VIR_ALLOC(ifaces_ret[ifaces_count - 1]) < 0)

> +                goto error;

> +

> +            iface = ifaces_ret[ifaces_count - 1];

> +            /* Assuming each lease corresponds to a separate IP */

> +            iface->naddrs = n_leases;

> +

> +            if (VIR_ALLOC_N(iface->addrs, iface->naddrs) < 0)

> +                goto error;

> +

> +            if (VIR_STRDUP(iface->name, vm->def->nets[i]->ifname) < 0)

> +                goto cleanup;

> +

> +            if (VIR_STRDUP(iface->hwaddr, macaddr) < 0)

> +                goto cleanup;

> +        }

> +

> +        for (j = 0; j < n_leases; j++) {

> +            virNetworkDHCPLeasePtr lease = leases[j];

> +            virDomainIPAddressPtr ip_addr = &iface->addrs[j];

> +

> +            if (VIR_STRDUP(ip_addr->addr, lease->ipaddr) < 0)

> +                goto cleanup;

> +

> +            ip_addr->type = lease->type;

> +            ip_addr->prefix = lease->prefix;

> +        }

> +

> +        for (j = 0; j < n_leases; j++)

> +            virNetworkDHCPLeaseFree(leases[j]);

> +

> +        VIR_FREE(leases);

> +    }

> +

> +    *ifaces = ifaces_ret;

> +    ifaces_ret = NULL;

> +    rv = ifaces_count;

> +

> + cleanup:

> +    virObjectUnref(network);

> +    if (leases) {

> +        for (i = 0; i < n_leases; i++)

> +            virNetworkDHCPLeaseFree(leases[i]);

> +    }

> +    VIR_FREE(leases);

> +

> +    return rv;

> +

> + error:

> +    if (ifaces_ret) {

> +        for (i = 0; i < ifaces_count; i++)

> +            virDomainInterfaceFree(ifaces_ret[i]);

> +    }

> +    VIR_FREE(ifaces_ret);

> +

> +    goto cleanup;

> +}



It's unfortunate this is a copy-paste from the qemu driver. The code is not

trivial and any bug fixes in one copy could be missed in the other. A lot of the

function is domain related, so probably can't be abstracted further to the

network code. Have you considered approaches that allow the drivers to share

this code?



Regards,

Jim







------------------------------



--

libvir-list mailing list

libvir-list at redhat.com<mailto:libvir-list at redhat.com>

https://www.redhat.com/mailman/listinfo/libvir-list



End of libvir-list Digest, Vol 126, Issue 182

*********************************************

********************************************************************************************************************************
The information in this email is confidential and may be legally privileged. If you have received this email in error or are not the intended recipient, please immediately notify the sender and delete this message from your computer. Any use, distribution, or copying of this email other than by the intended recipient is strictly prohibited. All messages sent to and from us may be monitored to ensure compliance with internal policies and to protect our business.
Emails are not secure and cannot be guaranteed to be error free as they can be intercepted, amended, lost or destroyed, or contain viruses. Anyone who communicates with us by email is taken to accept these risks.

收发邮件者请注意:
本邮件含保密信息,若误收本邮件,请务必通知发送人并直接删去,不得使用、传播或复制本邮件。
进出邮件均受到本公司合规监控。邮件可能发生被截留、被修改、丢失、被破坏或包含计算机病毒等不安全情况。
********************************************************************************************************************************
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20160514/bee0a6fb/attachment-0001.htm>


More information about the libvir-list mailing list