|
|
c55d09 |
From a72ab39ba75702676af64af30d9412f5d7730cd9 Mon Sep 17 00:00:00 2001
|
|
|
c55d09 |
From: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
|
|
|
c55d09 |
Date: Mon, 14 Oct 2013 17:29:42 +0200
|
|
|
c55d09 |
Subject: [PATCH 27/60] RASD: Support for device address properties
|
|
|
c55d09 |
|
|
|
c55d09 |
This change allows to enumerate KVM disk and network RASDs containing
|
|
|
c55d09 |
device addresses. A new function set_rasd_device_address fills the
|
|
|
c55d09 |
CIM instance properties from a device_address structure.
|
|
|
c55d09 |
|
|
|
c55d09 |
Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
|
|
|
c55d09 |
Signed-off-by: John Ferlan <jferlan@redhat.com>
|
|
|
c55d09 |
---
|
|
|
c55d09 |
src/Virt_RASD.c | 73 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
|
c55d09 |
1 file changed, 73 insertions(+)
|
|
|
c55d09 |
|
|
|
c55d09 |
diff --git a/src/Virt_RASD.c b/src/Virt_RASD.c
|
|
|
c55d09 |
index e28d4e6..df1e921 100644
|
|
|
c55d09 |
--- a/src/Virt_RASD.c
|
|
|
c55d09 |
+++ b/src/Virt_RASD.c
|
|
|
c55d09 |
@@ -289,6 +289,67 @@ static bool get_vol_size(const CMPIBroker *broker,
|
|
|
c55d09 |
}
|
|
|
c55d09 |
#endif
|
|
|
c55d09 |
|
|
|
c55d09 |
+static CMPIStatus set_rasd_device_address(const CMPIBroker *broker,
|
|
|
c55d09 |
+ const CMPIObjectPath *ref,
|
|
|
c55d09 |
+ const struct device_address *addr,
|
|
|
c55d09 |
+ CMPIInstance *inst)
|
|
|
c55d09 |
+{
|
|
|
c55d09 |
+ int i;
|
|
|
c55d09 |
+ CMPIArray *arr_key;
|
|
|
c55d09 |
+ CMPIArray *arr_value;
|
|
|
c55d09 |
+ CMPIString *string;
|
|
|
c55d09 |
+ CMPIStatus s = {CMPI_RC_OK, NULL};
|
|
|
c55d09 |
+
|
|
|
c55d09 |
+ arr_key = CMNewArray(broker,
|
|
|
c55d09 |
+ addr->ct,
|
|
|
c55d09 |
+ CMPI_string,
|
|
|
c55d09 |
+ &s);
|
|
|
c55d09 |
+ if (s.rc != CMPI_RC_OK)
|
|
|
c55d09 |
+ goto out;
|
|
|
c55d09 |
+
|
|
|
c55d09 |
+ arr_value = CMNewArray(broker,
|
|
|
c55d09 |
+ addr->ct,
|
|
|
c55d09 |
+ CMPI_string,
|
|
|
c55d09 |
+ &s);
|
|
|
c55d09 |
+ if (s.rc != CMPI_RC_OK)
|
|
|
c55d09 |
+ goto out;
|
|
|
c55d09 |
+
|
|
|
c55d09 |
+ for (i = 0; i < addr->ct; i++) {
|
|
|
c55d09 |
+ string = CMNewString(broker,
|
|
|
c55d09 |
+ addr->key[i],
|
|
|
c55d09 |
+ &s);
|
|
|
c55d09 |
+ if (s.rc != CMPI_RC_OK)
|
|
|
c55d09 |
+ goto out;
|
|
|
c55d09 |
+
|
|
|
c55d09 |
+ CMSetArrayElementAt(arr_key,
|
|
|
c55d09 |
+ i,
|
|
|
c55d09 |
+ (CMPIValue *)&string,
|
|
|
c55d09 |
+ CMPI_string);
|
|
|
c55d09 |
+
|
|
|
c55d09 |
+ string = CMNewString(broker,
|
|
|
c55d09 |
+ addr->value[i],
|
|
|
c55d09 |
+ &s);
|
|
|
c55d09 |
+ if (s.rc != CMPI_RC_OK)
|
|
|
c55d09 |
+ goto out;
|
|
|
c55d09 |
+
|
|
|
c55d09 |
+ CMSetArrayElementAt(arr_value,
|
|
|
c55d09 |
+ i,
|
|
|
c55d09 |
+ (CMPIValue *)&string,
|
|
|
c55d09 |
+ CMPI_string);
|
|
|
c55d09 |
+ }
|
|
|
c55d09 |
+
|
|
|
c55d09 |
+ CMSetProperty(inst, "AddressProperties",
|
|
|
c55d09 |
+ (CMPIValue *)&arr_key,
|
|
|
c55d09 |
+ CMPI_stringA);
|
|
|
c55d09 |
+
|
|
|
c55d09 |
+ CMSetProperty(inst, "AddressValues",
|
|
|
c55d09 |
+ (CMPIValue *)&arr_value,
|
|
|
c55d09 |
+ CMPI_stringA);
|
|
|
c55d09 |
+
|
|
|
c55d09 |
+ out:
|
|
|
c55d09 |
+ return s;
|
|
|
c55d09 |
+}
|
|
|
c55d09 |
+
|
|
|
c55d09 |
static CMPIStatus set_disk_rasd_params(const CMPIBroker *broker,
|
|
|
c55d09 |
const CMPIObjectPath *ref,
|
|
|
c55d09 |
const struct virt_device *dev,
|
|
|
c55d09 |
@@ -427,6 +488,12 @@ static CMPIStatus set_disk_rasd_params(const CMPIBroker *broker,
|
|
|
c55d09 |
(CMPIValue *)&(dev->dev.disk.shareable),
|
|
|
c55d09 |
CMPI_boolean);
|
|
|
c55d09 |
|
|
|
c55d09 |
+ if (dev->dev.disk.address.ct > 0)
|
|
|
c55d09 |
+ set_rasd_device_address(broker,
|
|
|
c55d09 |
+ ref,
|
|
|
c55d09 |
+ &dev->dev.disk.address,
|
|
|
c55d09 |
+ inst);
|
|
|
c55d09 |
+
|
|
|
c55d09 |
virStoragePoolFree(pool);
|
|
|
c55d09 |
virStorageVolFree(vol);
|
|
|
c55d09 |
virConnectClose(conn);
|
|
|
c55d09 |
@@ -590,6 +657,12 @@ static CMPIStatus set_net_rasd_params(const CMPIBroker *broker,
|
|
|
c55d09 |
(CMPIValue *)dev->dev.net.poolid,
|
|
|
c55d09 |
CMPI_chars);
|
|
|
c55d09 |
|
|
|
c55d09 |
+ if (dev->dev.net.address.ct > 0)
|
|
|
c55d09 |
+ set_rasd_device_address(broker,
|
|
|
c55d09 |
+ ref,
|
|
|
c55d09 |
+ &dev->dev.net.address,
|
|
|
c55d09 |
+ inst);
|
|
|
c55d09 |
+
|
|
|
c55d09 |
#if LIBVIR_VERSION_NUMBER < 9000
|
|
|
c55d09 |
out:
|
|
|
c55d09 |
#endif
|
|
|
c55d09 |
--
|
|
|
c55d09 |
2.1.0
|
|
|
c55d09 |
|