+1

Sharad Mishra
System x Enablement
Linux Technology Center
IBM

Inactive hide details for Kaitlin Rupert ---12/09/2009 11:35:46 AM---# HG changeset patchKaitlin Rupert ---12/09/2009 11:35:46 AM---# HG changeset patch

          Kaitlin Rupert <kaitlin@linux.vnet.ibm.com>
          Sent by: libvirt-cim-bounces@redhat.com

          12/09/2009 11:44 AM
          Please respond to
          List for discussion and development of libvirt CIM <libvirt-cim@redhat.com>


To

libvirt-cim@redhat.com

cc


Subject

[Libvirt-cim] [PATCH] Revert net->name to net->source

# HG changeset patch
# User Kaitlin Rupert <karupert@us.ibm.com>
# Date 1260387726 28800
# Node ID c3eef4ba0afdf544c36a38759754075fcda68739
# Parent  04bed5a4c113db575b34761ccc2ce06e48839e7e
Revert net->name to net->source

For Xen guests, a network device is turned into a bridge device.  However,
the network resource still belongs to the virtual network pool.  This change
makes sure the bridge name is written to the source field of the net struct so
that look ups in Virt_DevicePool.c work properly.

Signed-off-by: Kaitlin Rupert <karupert@us.ibm.com>

diff -r 04bed5a4c113 -r c3eef4ba0afd libxkutil/device_parsing.c
--- a/libxkutil/device_parsing.c Tue Dec 08 15:19:04 2009 -0800
+++ b/libxkutil/device_parsing.c Wed Dec 09 11:42:06 2009 -0800
@@ -304,8 +304,8 @@
                        if (ndev->mac == NULL)
                                goto err;
                } else if (XSTREQ(child->name, "source")) {
-                        ndev->name = get_attr_value(child, "bridge");
-                        if (ndev->name != NULL)
+                        ndev->source = get_attr_value(child, "bridge");
+                        if (ndev->source != NULL)
                                continue;
                        ndev->source = get_attr_value(child, "network");
                        if (ndev->source != NULL)
@@ -659,7 +659,6 @@
                DUP_FIELD(dev, _dev, dev.net.mac);
                DUP_FIELD(dev, _dev, dev.net.type);
                DUP_FIELD(dev, _dev, dev.net.source);
-                DUP_FIELD(dev, _dev, dev.net.name);
                DUP_FIELD(dev, _dev, dev.net.model);
        } else if (dev->type == CIM_RES_TYPE_DISK) {
                DUP_FIELD(dev, _dev, dev.disk.type);
diff -r 04bed5a4c113 -r c3eef4ba0afd libxkutil/device_parsing.h
--- a/libxkutil/device_parsing.h Tue Dec 08 15:19:04 2009 -0800
+++ b/libxkutil/device_parsing.h Wed Dec 09 11:42:06 2009 -0800
@@ -50,7 +50,6 @@
        char *mac;
        char *source;
        char *model;
-        char *name;
};

struct mem_device {
diff -r 04bed5a4c113 -r c3eef4ba0afd libxkutil/xmlgen.c
--- a/libxkutil/xmlgen.c Tue Dec 08 15:19:04 2009 -0800
+++ b/libxkutil/xmlgen.c Wed Dec 09 11:42:06 2009 -0800
@@ -165,12 +165,7 @@
{
        xmlNodePtr tmp;

-        if ((STREQC(src_type, "bridge")) && (dev->name != NULL)) {
-                tmp = xmlNewChild(nic, NULL, BAD_CAST "source", NULL);
-                if (tmp == NULL)
-                        return XML_ERROR;
-                xmlNewProp(tmp, BAD_CAST src_type, BAD_CAST dev->name);
-        } else if ((STREQC(src_type, "network")) && (dev->source != NULL)) {
+        if (dev->source != NULL) {
                tmp = xmlNewChild(nic, NULL, BAD_CAST "source", NULL);
                if (tmp == NULL)
                        return XML_ERROR;
diff -r 04bed5a4c113 -r c3eef4ba0afd src/Virt_RASD.c
--- a/src/Virt_RASD.c Tue Dec 08 15:19:04 2009 -0800
+++ b/src/Virt_RASD.c Wed Dec 09 11:42:06 2009 -0800
@@ -435,11 +435,11 @@
                              (CMPIValue *)dev->dev.net.mac,
                              CMPI_chars);

-                if ((dev->dev.net.name != NULL) &&
-                     (STREQ(dev->dev.net.type, "bridge")))
+                if ((dev->dev.net.source != NULL)
+                   && (STREQ(dev->dev.net.type, "bridge")))
                        CMSetProperty(inst,
                                      "NetworkName",
-                                      (CMPIValue *)dev->dev.net.name,
+                                      (CMPIValue *)dev->dev.net.source,
                                      CMPI_chars);

                if (dev->dev.net.model != NULL)
diff -r 04bed5a4c113 -r c3eef4ba0afd src/Virt_VirtualSystemManagementService.c
--- a/src/Virt_VirtualSystemManagementService.c Tue Dec 08 15:19:04 2009 -0800
+++ b/src/Virt_VirtualSystemManagementService.c Wed Dec 09 11:42:06 2009 -0800
@@ -720,15 +720,15 @@
        dev->id = strdup(dev->dev.net.mac);

        free(dev->dev.net.type);
-        free(dev->dev.net.name);
        if (cu_get_str_prop(inst, "NetworkType", &val) != CMPI_RC_OK)
                return "No Network Type specified";

+        free(dev->dev.net.source);
        if (STREQC(val, BRIDGE_TYPE)) {
                dev->dev.net.type = strdup(BRIDGE_TYPE);
                if (cu_get_str_prop(inst, "NetworkName", &val) == CMPI_RC_OK)
                        if (strlen(val) > 0)
-                                dev->dev.net.name = strdup(val);
+                                dev->dev.net.source = strdup(val);
                        else
                                return "Bridge name is empty";
                else
@@ -741,7 +741,6 @@
                if (val == NULL)
                        return "No NetworkPool specified no default available";

-                free(dev->dev.net.source);
                network = name_from_pool_id(val);
                if (network == NULL) {
                        msg = "PoolID specified is not formatted properly";

_______________________________________________
Libvirt-cim mailing list
Libvirt-cim@redhat.com
https://www.redhat.com/mailman/listinfo/libvirt-cim