
+1 Sharad Mishra System x Enablement Linux Technology Center IBM Kaitlin Rupert <kaitlin@linux.vn et.ibm.com> To Sent by: libvirt-cim@redhat.com libvirt-cim-bounc cc es@redhat.com Subject [Libvirt-cim] [PATCH 2 of 3] Add 01/28/2010 03:58 new attribute to hold the name of PM the net target device Please respond to List for discussion and development of libvirt CIM <libvirt-cim@redh at.com> # HG changeset patch # User Kaitlin Rupert <karupert@us.ibm.com> # Date 1264722331 28800 # Node ID 0273f86ebd7b6e54ec606d0a2a9aa54ce40246f1 # Parent 9532502f5d5e76efa998c4b6c9339cf47f91b914 Add new attribute to hold the name of the net target device VirtualDevice is used, as this is the same attribute used to hold the target device of a disk device. This patch also adds support for representing the target device in the device's RASD. Signed-off-by: Kaitlin Rupert <karupert@us.ibm.com> diff -r 9532502f5d5e -r 0273f86ebd7b schema/ResourceAllocationSettingData.mof --- a/schema/ResourceAllocationSettingData.mof Thu Jan 28 15:45:31 2010 -0800 +++ b/schema/ResourceAllocationSettingData.mof Thu Jan 28 15:45:31 2010 -0800 @@ -60,6 +60,8 @@ [Description ("Bridge name")] string NetworkName; + [Description ("Target device as seen by the guest")] + string VirtualDevice; }; [Description ("KVM virtual network configuration"), @@ -74,6 +76,8 @@ [Description ("Bridge name")] string NetworkName; + [Description ("Target device as seen by the guest")] + string VirtualDevice; }; [Description ("LXC virtual network configuration"), @@ -81,6 +85,8 @@ ] class LXC_NetResourceAllocationSettingData : LXC_ResourceAllocationSettingData { + [Description ("Target device as seen by the guest")] + string VirtualDevice; }; [Description ("Xen virtual processor"), diff -r 9532502f5d5e -r 0273f86ebd7b src/Virt_RASD.c --- a/src/Virt_RASD.c Thu Jan 28 15:45:31 2010 -0800 +++ b/src/Virt_RASD.c Thu Jan 28 15:45:31 2010 -0800 @@ -278,6 +278,45 @@ return s; } +static CMPIStatus set_net_rasd_params(const CMPIBroker *broker, + const CMPIObjectPath *ref, + const struct virt_device *dev, + CMPIInstance *inst) +{ + CMPIStatus s = {CMPI_RC_OK, NULL}; + + CMSetProperty(inst, + "NetworkType", + (CMPIValue *)dev->dev.net.type, + CMPI_chars); + + CMSetProperty(inst, + "Address", + (CMPIValue *)dev->dev.net.mac, + CMPI_chars); + + if ((dev->dev.net.source != NULL) && + (STREQ(dev->dev.net.type, "bridge"))) + CMSetProperty(inst, + "NetworkName", + (CMPIValue *)dev->dev.net.source, + CMPI_chars); + + if (dev->dev.net.device != NULL) + CMSetProperty(inst, + "VirtualDevice", + (CMPIValue *)dev->dev.net.device, + CMPI_chars); + + if (dev->dev.net.model != NULL) + CMSetProperty(inst, + "ResourceSubType", + (CMPIValue *)dev->dev.net.model, + CMPI_chars); + + return s; +} + static CMPIStatus set_graphics_rasd_params(const struct virt_device *dev, CMPIInstance *inst, const char *name, @@ -429,27 +468,7 @@ if (dev->type == CIM_RES_TYPE_DISK) { s = set_disk_rasd_params(broker, ref, dev, inst); } else if (dev->type == CIM_RES_TYPE_NET) { - CMSetProperty(inst, - "NetworkType", - (CMPIValue *)dev->dev.net.type, - CMPI_chars); - CMSetProperty(inst, - "Address", - (CMPIValue *)dev->dev.net.mac, - CMPI_chars); - - if ((dev->dev.net.source != NULL) - && (STREQ(dev->dev.net.type, "bridge"))) - CMSetProperty(inst, - "NetworkName", - (CMPIValue *)dev->dev.net.source, - CMPI_chars); - - if (dev->dev.net.model != NULL) - CMSetProperty(inst, - "ResourceSubType", - (CMPIValue *)dev->dev.net.model, - CMPI_chars); + s = set_net_rasd_params(broker, ref, dev, inst); } else if (dev->type == CIM_RES_TYPE_MEM) { const char *units = "KiloBytes"; _______________________________________________ Libvirt-cim mailing list Libvirt-cim@redhat.com https://www.redhat.com/mailman/listinfo/libvirt-cim