[PATCH] [TEST] Test VM's AutoStart feature
by Sharad Mishra
# HG changeset patch
# User Sharad Mishra <snmishra(a)us.ibm.com>
# Date 1298473315 28800
# Node ID 53f2cfb2a6ea2940b4de62fff16e3413419cb511
# Parent 4f2bf0006818d2ca4903a0b550dde65e4d581d7c
[TEST] Test VM's AutoStart feature.
This testcase will create VM, get its AutoStart setting and compare against expected value. Then it changes AutoStart, modifies the VM and reads the AutoStart back to verify that it was changed.
Signed-off-by: Sharad Mishra <snmishra(a)us.ibm.com>
diff -r 4f2bf0006818 -r 53f2cfb2a6ea suites/libvirt-cim/cimtest/VSSD/07_autostart.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/suites/libvirt-cim/cimtest/VSSD/07_autostart.py Wed Feb 23 07:01:55 2011 -0800
@@ -0,0 +1,118 @@
+#!/usr/bin/python
+#
+# Copyright 2009 IBM Corp.
+#
+# Authors:
+# Sharad Mishra <snmishra(a)us.ibm.com>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# This test will create a VM, get its autostart setting and compare against
+# the expected value. Then it sets the autostart to '1', and Modifies the VM.
+# Updated VM's autostart is read and compared. Then once more autostart is reset
+# and VM updated. Updated VM's autostart is again compared.
+#
+
+import sys
+import time
+import pywbem
+from XenKvmLib import vsms
+from XenKvmLib import vxml
+from CimTest.Globals import logger
+from CimTest.ReturnCodes import PASS, FAIL, SKIP
+from XenKvmLib.const import do_main
+from XenKvmLib.classes import get_typed_class, inst_to_mof
+from XenKvmLib.enumclass import GetInstance
+from XenKvmLib.const import get_provider_version
+from pywbem.cim_types import Uint16
+
+sup_types = ['Xen', 'KVM', 'XenFV', 'LXC']
+default_dom = 'uuid_domain'
+autostart_support = 1076
+
+def get_vssd(ip, virt, dom):
+ cn = get_typed_class(virt, "VirtualSystemSettingData")
+ inst = None
+
+ try:
+ if virt == "XenFV":
+ virt = "Xen"
+
+ key_list = {"InstanceID" : "%s:%s" % (virt, dom) }
+
+ inst = GetInstance(ip, cn, key_list, True)
+
+ except Exception, details:
+ logger.error(details)
+ return FAIL, inst
+
+ if inst is None:
+ return FAIL, inst
+
+ return PASS, inst
+
+@do_main(sup_types)
+def main():
+ options = main.options
+ virt = options.virt
+ server = options.ip
+
+ curr_cim_rev, changeset = get_provider_version(virt, server)
+ if curr_cim_rev < autostart_support:
+ logger.info("Need provider version %d or greater to run testcase",
+ autostart_support)
+ return SKIP
+
+ service = vsms.get_vsms_class(options.virt)(options.ip)
+
+ sxml = None
+ cxml = vxml.get_class(options.virt)(default_dom)
+ ret = cxml.cim_define(options.ip)
+ if not ret:
+ logger.error("Failed to define the dom: %s", default_dom)
+ return FAIL
+
+ status, inst = get_vssd(options.ip, options.virt, default_dom)
+ if status != PASS:
+ raise Exception("Failed to get the VSSD instance for %s" %
+ default_dom)
+ inst['AutoStart'] = Uint16(1)
+ vssd = inst_to_mof(inst)
+ service.ModifySystemSettings(SystemSettings=vssd)
+
+ status, inst = get_vssd(options.ip, options.virt, default_dom)
+ if status != PASS:
+ raise Exception("Failed to get the VSSD instance for %s" %
+ default_dom)
+ if inst['AutoStart'] != Uint16(1):
+ raise Exception("Test failed, Autostart settings mismatch")
+
+ inst['AutoStart'] = Uint16(0)
+ vssd = inst_to_mof(inst)
+ service.ModifySystemSettings(SystemSettings=vssd)
+
+ status, inst = get_vssd(options.ip, options.virt, default_dom)
+ if status != PASS:
+ raise Exception("Failed to get the VSSD instance for %s" %
+ default_dom)
+ if inst['AutoStart'] != Uint16(0):
+ raise Exception("Test failed, Autostart settings mismatch")
+
+ cxml.undefine(options.ip)
+ return status
+
+if __name__ == "__main__":
+ sys.exit(main())
+
13 years, 5 months
[PATCH] (#2) Set CreationClassName property in VSMS
by Sharad Mishra
# HG changeset patch
# User Sharad Mishra <snmishra(a)us.ibm.com>
# Date 1298901442 28800
# Node ID 7a2ce3106321ac1729aeff2b9e42fb2e75da9295
# Parent 219b9e147e611772e9f540800943653ce73acdfd
(#2) Set CreationClassName property in VSMS
CCName was not getting set correctly. I do not understand why there was a check to see if CCName is set, and set it only if it is set.
This patch removed the check, and sets the ccname if CMPIInstance is not null and ccname property is non-null.
update #2: Removed unused 'data' variable.
Signed-off-by: Sharad Mishra <snmishra(a)us.ibm.com>
diff -r 219b9e147e61 -r 7a2ce3106321 libxkutil/misc_util.c
--- a/libxkutil/misc_util.c Wed Feb 23 06:48:43 2011 -0800
+++ b/libxkutil/misc_util.c Mon Feb 28 05:57:22 2011 -0800
@@ -246,7 +246,6 @@
CMPIObjectPath *op;
CMPIInstance *inst = NULL;
CMPIStatus s;
- CMPIData data;
new_cn = get_typed_class(refcn, base);
if (new_cn == NULL)
@@ -260,10 +259,8 @@
if ((s.rc != CMPI_RC_OK) || CMIsNullObject(inst))
goto out;
- data = CMGetProperty(inst, "CreationClassName", &s);
- if (s.rc == CMPI_RC_OK)
- CMSetProperty(inst, "CreationClassName",
- (CMPIValue *)new_cn, CMPI_chars);
+ CMSetProperty(inst, "CreationClassName",
+ (CMPIValue *)new_cn, CMPI_chars);
out:
free(new_cn);
13 years, 6 months
[PATCH] Set CreationClassName property in VSMS
by Sharad Mishra
# HG changeset patch
# User Sharad Mishra <snmishra(a)us.ibm.com>
# Date 1298644240 28800
# Node ID 147d3bcdefe0b21076c6aaa3eb66fbe7343db2fa
# Parent 219b9e147e611772e9f540800943653ce73acdfd
Set CreationClassName property in VSMS
CCName was not getting set correctly. I do not understand why there was a check to see if CCName is set, and set it only if it is set.
This patch removed the check, and sets the ccname if CMPIInstance is not null and ccname property is non-null.
Signed-off-by: Sharad Mishra <snmishra(a)us.ibm.com>
diff -r 219b9e147e61 -r 147d3bcdefe0 libxkutil/misc_util.c
--- a/libxkutil/misc_util.c Wed Feb 23 06:48:43 2011 -0800
+++ b/libxkutil/misc_util.c Fri Feb 25 06:30:40 2011 -0800
@@ -260,10 +260,8 @@
if ((s.rc != CMPI_RC_OK) || CMIsNullObject(inst))
goto out;
- data = CMGetProperty(inst, "CreationClassName", &s);
- if (s.rc == CMPI_RC_OK)
- CMSetProperty(inst, "CreationClassName",
- (CMPIValue *)new_cn, CMPI_chars);
+ CMSetProperty(inst, "CreationClassName",
+ (CMPIValue *)new_cn, CMPI_chars);
out:
free(new_cn);
13 years, 6 months
[PATCH] Set/Reset VM autostart
by Sharad Mishra
# HG changeset patch
# User Sharad Mishra <snmishra(a)us.ibm.com>
# Date 1298472523 28800
# Node ID 219b9e147e611772e9f540800943653ce73acdfd
# Parent f3d3d546da029d62d3e5bceec52152a010e2e4b2
Set/Reset VM autostart.
Support for VM autostart was added few months back, but a defect was opened against libvirt-cim that autostart can only be set during VM creation and cannot be changed later. This patch fixes that issue.
Signed-off-by: Sharad Mishra <snmishra(a)us.ibm.com>
diff -r f3d3d546da02 -r 219b9e147e61 libxkutil/device_parsing.c
--- a/libxkutil/device_parsing.c Thu Feb 17 12:00:51 2011 -0800
+++ b/libxkutil/device_parsing.c Wed Feb 23 06:48:43 2011 -0800
@@ -1086,12 +1086,17 @@
{
char *xml;
int ret;
+ int start;
xml = virDomainGetXMLDesc(dom, 0);
if (xml == NULL)
return 0;
ret = get_dominfo_from_xml(xml, dominfo);
+ if (virDomainGetAutostart(dom, &start) != 0)
+ return 0;
+
+ (*dominfo)->autostrt = start;
free(xml);
diff -r f3d3d546da02 -r 219b9e147e61 libxkutil/device_parsing.h
--- a/libxkutil/device_parsing.h Thu Feb 17 12:00:51 2011 -0800
+++ b/libxkutil/device_parsing.h Wed Feb 23 06:48:43 2011 -0800
@@ -136,13 +136,13 @@
char *name;
char *typestr; /*xen, kvm, etc */
char *uuid;
- int autostart;
char *bootloader;
char *bootloader_args;
char *clock;
bool acpi;
bool apic;
bool pae;
+ int autostrt;
union {
struct pv_os_info pv;
diff -r f3d3d546da02 -r 219b9e147e61 schema/ComputerSystem.mof
--- a/schema/ComputerSystem.mof Thu Feb 17 12:00:51 2011 -0800
+++ b/schema/ComputerSystem.mof Wed Feb 23 06:48:43 2011 -0800
@@ -10,9 +10,6 @@
[Description("UUID assigned to this DomU.")]
string UUID;
- [Description("Flag to set VM autostart.")]
- string autoStart;
-
};
[Description (
@@ -26,9 +23,6 @@
[Description("UUID assigned to this virtual machine.")]
string UUID;
- [Description("Flag to set VM autostart.")]
- string autoStart;
-
};
[Description (
@@ -42,8 +36,5 @@
[Description("UUID assigned to this virtual machine.")]
string UUID;
- [Description("Flag to set VM autostart.")]
- string autoStart;
-
};
diff -r f3d3d546da02 -r 219b9e147e61 schema/Virt_VSSD.mof
--- a/schema/Virt_VSSD.mof Thu Feb 17 12:00:51 2011 -0800
+++ b/schema/Virt_VSSD.mof Wed Feb 23 06:48:43 2011 -0800
@@ -24,4 +24,7 @@
[Description ("Flag to determine whether this guest has pae enabled")]
boolean EnablePAE;
+ [Description ("Flag to determine whether this guest has to be autostarted on reboot")]
+ uint16 AutoStart;
+
};
diff -r f3d3d546da02 -r 219b9e147e61 src/Virt_ComputerSystem.c
--- a/src/Virt_ComputerSystem.c Thu Feb 17 12:00:51 2011 -0800
+++ b/src/Virt_ComputerSystem.c Wed Feb 23 06:48:43 2011 -0800
@@ -65,33 +65,6 @@
return 1;
}
-/* Set the "autoStart" property of an instance from a domain */
-static int set_autostart_from_dom(virDomainPtr dom,
- CMPIInstance *instance,
- struct domain *dominfo)
-{
- int autoFlag = 0;
- char autovalue[16];
-
- if((virDomainGetAutostart(dom, &autoFlag)) == -1) {
- CU_DEBUG("Could not read autostart value from xml");
- } else {
- CU_DEBUG("Autostart for current domain is set to %d",
- autoFlag);
- dominfo->autostart = autoFlag;
- }
-
- if(autoFlag)
- strcpy(autovalue, "enable");
- else
- strcpy(autovalue, "disable");
-
- CMSetProperty(instance, "autoStart",
- (CMPIValue *)autovalue, CMPI_chars);
-
- return 1;
-}
-
/* Set the "UUID" property of an instance from a domain */
static int set_uuid_from_dom(virDomainPtr dom,
CMPIInstance *instance,
@@ -526,15 +499,6 @@
goto out;
}
- if (!set_autostart_from_dom(dom, instance, domain)) {
- virt_set_status(broker, &s,
- CMPI_RC_ERR_FAILED,
- virDomainGetConnect(dom),
- "Unable to get domain autostart flag");
-
- goto out;
- }
-
if (!set_uuid_from_dom(dom, instance, &uuid)) {
virt_set_status(broker, &s,
CMPI_RC_ERR_FAILED,
diff -r f3d3d546da02 -r 219b9e147e61 src/Virt_VSSD.c
--- a/src/Virt_VSSD.c Thu Feb 17 12:00:51 2011 -0800
+++ b/src/Virt_VSSD.c Wed Feb 23 06:48:43 2011 -0800
@@ -220,6 +220,9 @@
CMSetProperty(inst, "EnablePAE",
(CMPIValue *)&dominfo->pae, CMPI_boolean);
+ CMSetProperty(inst, "AutoStart",
+ (CMPIValue *)&dominfo->autostrt, CMPI_uint16);
+
if (dominfo->clock != NULL) {
uint16_t clock = VSSD_CLOCK_UTC;
diff -r f3d3d546da02 -r 219b9e147e61 src/Virt_VirtualSystemManagementService.c
--- a/src/Virt_VirtualSystemManagementService.c Thu Feb 17 12:00:51 2011 -0800
+++ b/src/Virt_VirtualSystemManagementService.c Wed Feb 23 06:48:43 2011 -0800
@@ -1374,8 +1374,6 @@
virDomainPtr dom;
const char *name;
CMPIInstance *inst = NULL;
- const char *autoStartFlag = NULL;
- int autoflag;
conn = connect_by_classname(_BROKER, CLASSNAME(ref), s);
if (conn == NULL) {
@@ -1404,19 +1402,6 @@
goto out;
}
- if (inst != NULL) {
- if (cu_get_str_prop(inst, "autoStart",
- &autoStartFlag) != CMPI_RC_OK)
- autoStartFlag = strdup("disable");
-
- if (STREQ(autoStartFlag, "enable"))
- autoflag = 1;
- else
- autoflag = 0;
- if((virDomainSetAutostart(dom, autoflag)) == -1)
- CU_DEBUG("Failed to set autostart flag.");
- }
-
out:
virDomainFree(dom);
virConnectClose(conn);
@@ -1663,6 +1648,74 @@
}
+static CMPIStatus set_autostart(CMPIInstance *vssd,
+ const CMPIObjectPath *ref,
+ virDomainPtr dom)
+{
+ CMPIStatus s;
+ const char *name = NULL;
+ CMPIrc ret;
+ virConnectPtr conn = NULL;
+ virDomainPtr inst_dom = NULL;
+ uint16_t val = 0;
+ int i = 0;
+
+ CU_DEBUG("Enter set_autostart");
+ ret = cu_get_str_prop(vssd, "VirtualSystemIdentifier", &name);
+ if (ret != CMPI_RC_OK) {
+ CU_DEBUG("Missing VirtualSystemIdentifier");
+ cu_statusf(_BROKER, &s,
+ ret,
+ "Missing VirtualSystemIdentifier");
+ goto out;
+ }
+
+ conn = connect_by_classname(_BROKER, CLASSNAME(ref), &s);
+ if (conn == NULL) {
+ CU_DEBUG("Failed to connect");
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_ERR_FAILED,
+ "Failed to connect");
+ goto out;
+ }
+
+ inst_dom = virDomainLookupByName(conn, name);
+ if (inst_dom == NULL) {
+ CU_DEBUG("reference domain '%s' does not exist", name);
+ virt_set_status(_BROKER, &s,
+ CMPI_RC_ERR_NOT_FOUND,
+ conn,
+ "Referenced domain `%s' does not exist", name);
+ goto out;
+ }
+
+ if (cu_get_u16_prop(vssd, "AutoStart", &val) != CMPI_RC_OK) {
+ if (dom != NULL) {
+ /* Read the current domain's autostart setting.
+ Since the user did not specify any new
+ autostart, the updated VM will use the same
+ autostart setting as used before this
+ update. */
+ if (virDomainGetAutostart(dom, &i) != 0)
+ i = 0;
+ }
+ }
+ else
+ i = val;
+ CU_DEBUG("setting VM's autostart to %d", i);
+ if (virDomainSetAutostart(inst_dom, i) == -1) {
+ CU_DEBUG("Failed to set autostart");
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_ERR_FAILED,
+ "Failed to set autostart");
+ }
+
+ out:
+ virDomainFree(inst_dom);
+ virConnectClose(conn);
+ return s;
+}
+
static CMPIInstance *create_system(const CMPIContext *context,
CMPIInstance *vssd,
CMPIArray *resources,
@@ -1673,15 +1726,13 @@
CMPIInstance *inst = NULL;
char *xml = NULL;
const char *msg = NULL;
- virConnectPtr conn = NULL;
- virDomainPtr dom = NULL;
struct inst_list list;
const char *props[] = {NULL};
-
struct domain *domain = NULL;
inst_list_init(&list);
+ CU_DEBUG("Enter create_system");
if (refconf != NULL) {
*s = get_reference_domain(&domain, ref, refconf);
if (s->rc != CMPI_RC_OK)
@@ -1731,6 +1782,7 @@
inst = connect_and_create(xml, ref, s);
if (inst != NULL) {
update_dominfo(domain, CLASSNAME(ref));
+ set_autostart(vssd, ref, NULL);
*s = enum_rasds(_BROKER,
ref,
@@ -1755,8 +1807,6 @@
out:
cleanup_dominfo(&domain);
free(xml);
- virDomainFree(dom);
- virConnectClose(conn);
inst_list_free(&list);
return inst;
@@ -1943,6 +1993,7 @@
char *xml = NULL;
const char *uuid = NULL;
+ CU_DEBUG("Enter update_system_settings");
ret = cu_get_str_prop(vssd, "VirtualSystemIdentifier", &name);
if (ret != CMPI_RC_OK) {
cu_statusf(_BROKER, &s,
@@ -2002,6 +2053,7 @@
}
if (s.rc == CMPI_RC_OK) {
+ set_autostart(vssd, ref, dom);
trigger_indication(context,
"ComputerSystemModifiedIndication",
ref);
13 years, 6 months
[PATCH] Remove test for duplicate mac address
by Sharad Mishra
# HG changeset patch
# User Sharad Mishra <snmishra(a)us.ibm.com>
# Date 1297972851 28800
# Node ID f3d3d546da029d62d3e5bceec52152a010e2e4b2
# Parent a1bb536dcf5ca836a2b09d7682134c88a4fbeb6e
Remove test for duplicate mac address.
This test has been removed since it was interfering with modifying network resources. This is an extra piece of check that was added in libvirt-cim, libvirt already does this check. Removing it should not cause any problem.
When a user modified an existing active net RASD, libvirt-cim clones the RASD and changes the properties to the new values. But if mac was not one of the changing property, then this extra check, took it to be a duplicate mac and gave error.
Signed-off-by: Sharad Mishra <snmishra(a)us.ibm.com>
diff -r a1bb536dcf5c -r f3d3d546da02 src/Virt_VirtualSystemManagementService.c
--- a/src/Virt_VirtualSystemManagementService.c Wed Feb 16 09:51:44 2011 -0800
+++ b/src/Virt_VirtualSystemManagementService.c Thu Feb 17 12:00:51 2011 -0800
@@ -623,6 +623,7 @@
return _mac;
}
+/*
static const char *filter_by_address(struct inst_list *src,
const char *address)
{
@@ -665,8 +666,8 @@
goto out;
}
- /* FIXME: This is a Pegasus work around. Pegsus loses the namespace
- when an ObjectPath is pulled from an instance */
+ FIXME: This is a Pegasus work around. Pegsus loses the namespace
+ when an ObjectPath is pulled from an instance
if (STREQ(NAMESPACE(op), ""))
CMSetNameSpace(op, ns);
@@ -684,7 +685,7 @@
inst_list_free(&in_list);
return msg;
}
-
+*/
static const char *net_rasd_to_vdev(CMPIInstance *inst,
struct virt_device *dev,
@@ -709,10 +710,12 @@
}
}
+/*
msg = check_duplicate_mac(inst, val, ns);
if (msg != NULL) {
goto out;
}
+*/
free(dev->dev.net.mac);
dev->dev.net.mac = strdup(val);
13 years, 6 months
[PATCH] Add support for deactivation of disk caching
by Sharad Mishra
# HG changeset patch
# User Sharad Mishra <snmishra(a)us.ibm.com>
# Date 1297878704 28800
# Node ID a1bb536dcf5ca836a2b09d7682134c88a4fbeb6e
# Parent 5217c96d817d3d330898df26dd4262b9c26abc21
Add support for deactivation of disk caching.
This patch adds support to deactivate caching of disk devices.
Signed-off-by: Sharad Mishra <snmishra(a)us.ibm.com>
diff -r 5217c96d817d -r a1bb536dcf5c libxkutil/device_parsing.c
--- a/libxkutil/device_parsing.c Wed Feb 16 06:48:11 2011 -0800
+++ b/libxkutil/device_parsing.c Wed Feb 16 09:51:44 2011 -0800
@@ -53,6 +53,7 @@
free(dev->type);
free(dev->device);
free(dev->driver);
+ free(dev->cache);
free(dev->source);
free(dev->virtual_dev);
free(dev->bus_type);
@@ -241,6 +242,7 @@
ddev->driver = get_attr_value(child, "name");
if (ddev->driver == NULL)
goto err;
+ ddev->cache = get_attr_value(child, "cache");
} else if (XSTREQ(child->name, "source")) {
ddev->source = get_attr_value(child, "file");
if (ddev->source) {
@@ -739,6 +741,7 @@
DUP_FIELD(dev, _dev, dev.disk.type);
DUP_FIELD(dev, _dev, dev.disk.device);
DUP_FIELD(dev, _dev, dev.disk.driver);
+ DUP_FIELD(dev, _dev, dev.disk.cache);
DUP_FIELD(dev, _dev, dev.disk.source);
DUP_FIELD(dev, _dev, dev.disk.virtual_dev);
DUP_FIELD(dev, _dev, dev.disk.bus_type);
diff -r 5217c96d817d -r a1bb536dcf5c libxkutil/device_parsing.h
--- a/libxkutil/device_parsing.h Wed Feb 16 06:48:11 2011 -0800
+++ b/libxkutil/device_parsing.h Wed Feb 16 09:51:44 2011 -0800
@@ -53,6 +53,7 @@
bool readonly;
bool shareable;
char *bus_type;
+ char *cache;
};
struct net_device {
diff -r 5217c96d817d -r a1bb536dcf5c libxkutil/xmlgen.c
--- a/libxkutil/xmlgen.c Wed Feb 16 06:48:11 2011 -0800
+++ b/libxkutil/xmlgen.c Wed Feb 16 09:51:44 2011 -0800
@@ -84,6 +84,15 @@
xmlNewProp(disk, BAD_CAST "type", BAD_CAST "file");
xmlNewProp(disk, BAD_CAST "device", BAD_CAST dev->device);
+ tmp = xmlNewChild(disk, NULL, BAD_CAST "driver", NULL);
+ if (tmp == NULL)
+ return XML_ERROR;
+ if(dev->driver != NULL) {
+ xmlNewProp(tmp, BAD_CAST "name", BAD_CAST dev->driver);
+ if(dev->cache != NULL)
+ xmlNewProp(tmp, BAD_CAST "cache", BAD_CAST dev->cache);
+ }
+
tmp = xmlNewChild(disk, NULL, BAD_CAST "source", NULL);
if (tmp == NULL)
return XML_ERROR;
diff -r 5217c96d817d -r a1bb536dcf5c schema/ResourceAllocationSettingData.mof
--- a/schema/ResourceAllocationSettingData.mof Wed Feb 16 06:48:11 2011 -0800
+++ b/schema/ResourceAllocationSettingData.mof Wed Feb 16 09:51:44 2011 -0800
@@ -20,6 +20,9 @@
[Description ("readonly mode for disk")]
boolean readonly;
+ [Description ("cache setting for device")]
+ string cache;
+
};
[Description ("KVM virtual disk configuration"),
@@ -41,6 +44,9 @@
[Description ("readonly mode for disk")]
boolean readonly;
+
+ [Description ("cache setting for device")]
+ string cache;
};
[Description ("LXC virtual disk configuration"),
diff -r 5217c96d817d -r a1bb536dcf5c src/Virt_RASD.c
--- a/src/Virt_RASD.c Wed Feb 16 06:48:11 2011 -0800
+++ b/src/Virt_RASD.c Wed Feb 16 09:51:44 2011 -0800
@@ -281,6 +281,12 @@
(CMPIValue *)&(dev->dev.disk.readonly),
CMPI_boolean);
+ if(dev->dev.disk.cache)
+ CMSetProperty(inst,
+ "cache",
+ (CMPIValue *)dev->dev.disk.cache,
+ CMPI_chars);
+
return s;
}
diff -r 5217c96d817d -r a1bb536dcf5c src/Virt_SettingsDefineCapabilities.c
--- a/src/Virt_SettingsDefineCapabilities.c Wed Feb 16 06:48:11 2011 -0800
+++ b/src/Virt_SettingsDefineCapabilities.c Wed Feb 16 09:51:44 2011 -0800
@@ -853,6 +853,7 @@
uint64_t disk_size,
uint16_t emu_type,
bool readonly,
+ const char *cache,
struct inst_list *list)
{
const char *dev;
@@ -899,6 +900,10 @@
if(readonly)
CMSetProperty(inst, "readonly",
(CMPIValue *)&readonly, CMPI_boolean);
+
+ if(cache != NULL)
+ CMSetProperty(inst, "cache",
+ (CMPIValue *)cache, CMPI_chars);
}
inst_list_add(list, inst);
@@ -920,6 +925,7 @@
const char *dev_str = NULL;
char *id_str = NULL;
bool readonly = true;
+ const char *cache = "none";
if (emu_type == VIRT_DISK_TYPE_CDROM)
dev_str = "CDROM";
@@ -966,6 +972,7 @@
vol_size,
emu_type,
readonly,
+ cache,
list);
}
} else if (STREQ(pfx, "KVM")) {
@@ -976,6 +983,7 @@
vol_size,
emu_type,
readonly,
+ cache,
list);
} else if (!STREQ(pfx, "LXC")){
@@ -1050,6 +1058,7 @@
int type = 0;
bool ret;
bool readonly = true;
+ const char *cache = "none";
CMPIStatus s = {CMPI_RC_OK, NULL};
@@ -1101,6 +1110,7 @@
disk_size,
emu_type,
readonly,
+ cache,
list);
if (s.rc != CMPI_RC_OK)
goto out;
@@ -1121,6 +1131,7 @@
disk_size,
emu_type,
readonly,
+ cache,
list);
}
@@ -1247,6 +1258,7 @@
int ret;
uint16_t emu_type = 0;
bool readonly = false;
+ const char *cache = "none";
ret = virStorageVolGetInfo(volume_ptr, &vol_info);
if (ret == -1) {
@@ -1304,6 +1316,7 @@
vol_size,
emu_type,
readonly,
+ cache,
list);
}
} else if (STREQ(pfx, "KVM")) {
@@ -1314,6 +1327,7 @@
vol_size,
emu_type,
readonly,
+ cache,
list);
} else {
cu_statusf(_BROKER, &s,
diff -r 5217c96d817d -r a1bb536dcf5c src/Virt_VirtualSystemManagementService.c
--- a/src/Virt_VirtualSystemManagementService.c Wed Feb 16 06:48:11 2011 -0800
+++ b/src/Virt_VirtualSystemManagementService.c Wed Feb 16 09:51:44 2011 -0800
@@ -878,6 +878,12 @@
dev->dev.disk.bus_type = NULL;
else
dev->dev.disk.bus_type = strdup(val);
+
+ free(dev->dev.disk.cache);
+ if (cu_get_str_prop(inst, "cache", &val) != CMPI_RC_OK)
+ dev->dev.disk.cache = NULL;
+ else
+ dev->dev.disk.cache = strdup(val);
free(dev->id);
dev->id = strdup(dev->dev.disk.virtual_dev);
13 years, 6 months
[PATCH] Add readonly property to disk
by Sharad Mishra
# 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;
13 years, 6 months
[PATCH] [TEST] Removing graphics device from this test
by Sharad Mishra
# HG changeset patch
# User Sharad Mishra <snmishra(a)us.ibm.com>
# Date 1295022559 28800
# Node ID f98167abd981e7e9551c26ab8367c8b2b71829dd
# Parent d54a6a278fa33413148d9a2ca63257284e5f7a1c
[TEST] Removing graphics device from this test.
The VM does not have a graphics device. It is
being removed.
Signed-off-by: Sharad Mishra <snmishra(a)us.ibm.com>
diff -r d54a6a278fa3 -r f98167abd981 suites/libvirt-cim/cimtest/VirtualSystemManagementService/16_removeresource.py
--- a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/16_removeresource.py Fri Jan 14 08:20:38 2011 -0800
+++ b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/16_removeresource.py Fri Jan 14 08:29:19 2011 -0800
@@ -66,7 +66,8 @@
sds_classname = get_typed_class(options.virt, 'SettingsDefineState')
mem = get_typed_class(options.virt, 'Memory')
proc = get_typed_class(options.virt, 'Processor')
- dev_not_rem = [mem, proc]
+ input = get_typed_class(options.virt, 'PointingDevice')
+ dev_not_rem = [mem, proc, input]
service = get_vsms_class(options.virt)(options.ip)
for dev in devs:
13 years, 6 months
[PATCH] [TEST] Memory is calculated in block sizes
by Sharad Mishra
# HG changeset patch
# User Sharad Mishra <snmishra(a)us.ibm.com>
# Date 1295021879 28800
# Node ID 0d0d87b8a5b44ed0af9c32490db7d7fcc586cf21
# Parent a0f35dd8ba2843bd548a3c3d0186e0fc48a9113d
[TEST] Memory is calculated in block sizes.
This test was modifying the VM memory and then
verify that the new memory size matches the expected
memory. The test was failing because memory was not
getting multiplied by the block size (512). Updated this
test to account for memory size in blocks.
Signed-off-by: Sharad Mishra <snmishra(a)us.ibm.com>
diff -r a0f35dd8ba28 -r 0d0d87b8a5b4 suites/libvirt-cim/cimtest/VirtualSystemManagementService/08_modifyresource.py
--- a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/08_modifyresource.py Fri Jan 14 08:16:16 2011 -0800
+++ b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/08_modifyresource.py Fri Jan 14 08:17:59 2011 -0800
@@ -41,7 +41,7 @@
ntype = 'network'
cpu = 2
ncpu = 1
-nmem = 256
+nmem = 131072
new_int = randint(10, 99)
new_mac1 = "11:%s:22:%s:33:%s" % (new_int, new_int, new_int)
new_int += 1
13 years, 6 months
[PATCH] [TEST] Memory is calculated in block sizes
by Sharad Mishra
# HG changeset patch
# User Sharad Mishra <snmishra(a)us.ibm.com>
# Date 1295019233 28800
# Node ID a99191b4a4f499c452cb50558b87f9c03925f1f2
# Parent 8866ff769a7637cbee7c793827152649856815f2
[TEST] Memory is calculated in block sizes.
This test was modifying the VM memory and then
verify that the new memory size matches the expected
memory. The test was failing because memory was not
getting multiplied by the block size (512). Updated this
test to account for memory size in blocks.
Signed-off-by: Sharad Mishra <snmishra(a)us.ibm.com>
diff -r 8866ff769a76 -r a99191b4a4f4 suites/libvirt-cim/cimtest/RASDIndications/02_guest_add_mod_rem_rasd_ind.py
--- a/suites/libvirt-cim/cimtest/RASDIndications/02_guest_add_mod_rem_rasd_ind.py Fri Jan 14 07:25:16 2011 -0800
+++ b/suites/libvirt-cim/cimtest/RASDIndications/02_guest_add_mod_rem_rasd_ind.py Fri Jan 14 07:33:53 2011 -0800
@@ -45,7 +45,7 @@
sup_types = ['KVM', 'Xen', 'XenFV']
libvirt_guest_rasd_indication_rev = 980
-nmem = 256
+nmem = 131072
nmac = '00:11:22:33:44:55'
def create_guest(test_dom, ip, virt, cxml):
13 years, 6 months