# HG changeset patch
# User Sharad Mishra <snmishra(a)us.ibm.com>
# Date 1297867691 28800
# Node ID 5217c96d817d3d330898df26dd4262b9c26abc21
# Parent 432922275bea75a769cf058209bdb81198f3b360
Add readonly property to disk.
This patch adds readonly property to disks.
Signed-off-by: Sharad Mishra <snmishra(a)us.ibm.com>
diff -r 432922275bea -r 5217c96d817d schema/ResourceAllocationSettingData.mof
--- a/schema/ResourceAllocationSettingData.mof Fri Jan 21 15:59:27 2011 -0500
+++ b/schema/ResourceAllocationSettingData.mof Wed Feb 16 06:48:11 2011 -0800
@@ -17,6 +17,9 @@
[Description ("Bus type of the device")]
string BusType;
+ [Description ("readonly mode for disk")]
+ boolean readonly;
+
};
[Description ("KVM virtual disk configuration"),
@@ -35,6 +38,9 @@
[Description ("Bus type of the device")]
string BusType;
+
+ [Description ("readonly mode for disk")]
+ boolean readonly;
};
[Description ("LXC virtual disk configuration"),
diff -r 432922275bea -r 5217c96d817d src/Virt_RASD.c
--- a/src/Virt_RASD.c Fri Jan 21 15:59:27 2011 -0500
+++ b/src/Virt_RASD.c Wed Feb 16 06:48:11 2011 -0800
@@ -275,6 +275,12 @@
(CMPIValue *)&type,
CMPI_uint16);
+ if(dev->dev.disk.readonly)
+ CMSetProperty(inst,
+ "readonly",
+ (CMPIValue *)&(dev->dev.disk.readonly),
+ CMPI_boolean);
+
return s;
}
diff -r 432922275bea -r 5217c96d817d src/Virt_SettingsDefineCapabilities.c
--- a/src/Virt_SettingsDefineCapabilities.c Fri Jan 21 15:59:27 2011 -0500
+++ b/src/Virt_SettingsDefineCapabilities.c Wed Feb 16 06:48:11 2011 -0800
@@ -852,6 +852,7 @@
const char *disk_path,
uint64_t disk_size,
uint16_t emu_type,
+ bool readonly,
struct inst_list *list)
{
const char *dev;
@@ -895,6 +896,9 @@
(CMPIValue *)dev, CMPI_chars);
CMSetProperty(inst, "EmulatedType",
(CMPIValue *)&emu_type, CMPI_uint16);
+ if(readonly)
+ CMSetProperty(inst, "readonly",
+ (CMPIValue *)&readonly, CMPI_boolean);
}
inst_list_add(list, inst);
@@ -915,6 +919,7 @@
CMPIStatus s = {CMPI_RC_OK, NULL};
const char *dev_str = NULL;
char *id_str = NULL;
+ bool readonly = true;
if (emu_type == VIRT_DISK_TYPE_CDROM)
dev_str = "CDROM";
@@ -960,6 +965,7 @@
vol_path,
vol_size,
emu_type,
+ readonly,
list);
}
} else if (STREQ(pfx, "KVM")) {
@@ -969,6 +975,7 @@
vol_path,
vol_size,
emu_type,
+ readonly,
list);
} else if (!STREQ(pfx, "LXC")){
@@ -1042,6 +1049,7 @@
const char *id;
int type = 0;
bool ret;
+ bool readonly = true;
CMPIStatus s = {CMPI_RC_OK, NULL};
@@ -1092,6 +1100,7 @@
disk_path,
disk_size,
emu_type,
+ readonly,
list);
if (s.rc != CMPI_RC_OK)
goto out;
@@ -1111,6 +1120,7 @@
disk_path,
disk_size,
emu_type,
+ readonly,
list);
}
@@ -1236,6 +1246,7 @@
CMPIStatus s = {CMPI_RC_OK, NULL};
int ret;
uint16_t emu_type = 0;
+ bool readonly = false;
ret = virStorageVolGetInfo(volume_ptr, &vol_info);
if (ret == -1) {
@@ -1292,6 +1303,7 @@
vol_path,
vol_size,
emu_type,
+ readonly,
list);
}
} else if (STREQ(pfx, "KVM")) {
@@ -1301,6 +1313,7 @@
vol_path,
vol_size,
emu_type,
+ readonly,
list);
} else {
cu_statusf(_BROKER, &s,
@@ -1457,7 +1470,7 @@
if (STREQ(pfx, "LXC"))
goto out;
- s = cdrom_or_floppy_template(ref,
+ s = odrom_or_floppy_template(ref,
template_type,
VIRT_DISK_TYPE_CDROM,
list);
diff -r 432922275bea -r 5217c96d817d src/Virt_VirtualSystemManagementService.c
--- a/src/Virt_VirtualSystemManagementService.c Fri Jan 21 15:59:27 2011 -0500
+++ b/src/Virt_VirtualSystemManagementService.c Wed Feb 16 06:48:11 2011 -0800
@@ -835,6 +835,7 @@
{
const char *val = NULL;
uint16_t type;
+ bool read = false;
CU_DEBUG("Enter disk_rasd_to_vdev");
if (cu_get_str_prop(inst, "VirtualDevice", &val) != CMPI_RC_OK)
@@ -867,6 +868,11 @@
CU_DEBUG("device type is %s", dev->dev.disk.device);
+ if (cu_get_bool_prop(inst, "readonly", &read) != CMPI_RC_OK)
+ dev->dev.disk.readonly = false;
+ else
+ dev->dev.disk.readonly = read;
+
free(dev->dev.disk.bus_type);
if (cu_get_str_prop(inst, "BusType", &val) != CMPI_RC_OK)
dev->dev.disk.bus_type = NULL;