Re: [PATCH] interface: dumpx inactive xml when interface isn't active

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 07.04.2014 14:32, Laine Stump wrote:
Other drivers in libvirt (e.g. network, qemu) will automatically
return the "inactive" (persistent configuration) XML of an object when
that object is inactive. The netcf backend of the interface driver
would always try to return the live status XML of the interface, even
when it was down. Although netcf does return valid XML in that case,
for bond interfaces it is missing almost all of its content, including
the <bond> subelement itself, leading to this error message from
"virsh iface-dumpxml" of a bond interface that is inactive:

   error: XML error: bond interface misses the bond element

(this is because libvirt's validation of the XML returned by netcf
always requires a <bond> element be present).

This patch modifies the interface driver netcf backend to check if the
interface is inactive, and in that case always return the inactive XML
(which will always have a <bond> element, thus eliminating the error
message, as well as making operation more in line with other drivers.

This fixes the following bug:

   https://bugzilla.redhat.com/show_bug.cgi?id=878394
---
  src/interface/interface_backend_netcf.c | 6 +++++-
  1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/interface/interface_backend_netcf.c b/src/interface/interface_backend_netcf.c
index 4d55653..36a50bd 100644
--- a/src/interface/interface_backend_netcf.c
+++ b/src/interface/interface_backend_netcf.c
@@ -801,6 +801,7 @@ static char *netcfInterfaceGetXMLDesc(virInterfacePtr ifinfo,
      char *xmlstr = NULL;
      virInterfaceDefPtr ifacedef = NULL;
      char *ret = NULL;
+    bool active;

      virCheckFlags(VIR_INTERFACE_XML_INACTIVE, NULL);

@@ -812,7 +813,10 @@ static char *netcfInterfaceGetXMLDesc(virInterfacePtr ifinfo,
          goto cleanup;
      }

-    if ((flags & VIR_INTERFACE_XML_INACTIVE)) {
+    if (netcfInterfaceObjIsActive(iface, &active) < 0)
+       goto cleanup;
+
+    if ((flags & VIR_INTERFACE_XML_INACTIVE) || !active) {
          xmlstr = ncf_if_xml_desc(iface);
      } else {
          xmlstr = ncf_if_xml_state(iface);



ACK

Michal

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




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]