
# HG changeset patch # User Sharad Mishra <snmishra@us.ibm.com> # Date 1279127759 25200 # Node ID 487a2f2bbf148e8abbbe332e6c6f2f7a44f8e2a4 # Parent 62069e89413c139c3da8e0b23b83d20890eeec4f Add VM Autostart flag. VMs can be set to autostart on host reboot. Signed-off-by: Sharad Mishra <snmishra@us.ibm.com> diff -r 62069e89413c -r 487a2f2bbf14 schema/ComputerSystem.mof --- a/schema/ComputerSystem.mof Thu Jul 01 11:52:57 2010 -0400 +++ b/schema/ComputerSystem.mof Wed Jul 14 10:15:59 2010 -0700 @@ -10,6 +10,9 @@ [Description("UUID assigned to this DomU.")] string UUID; + [Description("Flag to set VM autostart.")] + boolean autoStart; + }; [Description ( @@ -23,6 +26,9 @@ [Description("UUID assigned to this virtual machine.")] string UUID; + [Description("Flag to set VM autostart.")] + boolean autoStart; + }; [Description ( @@ -36,5 +42,8 @@ [Description("UUID assigned to this virtual machine.")] string UUID; + [Description("Flag to set VM autostart.")] + boolean autoStart; + }; diff -r 62069e89413c -r 487a2f2bbf14 src/Virt_VirtualSystemManagementService.c --- a/src/Virt_VirtualSystemManagementService.c Thu Jul 01 11:52:57 2010 -0400 +++ b/src/Virt_VirtualSystemManagementService.c Wed Jul 14 10:15:59 2010 -0700 @@ -1356,6 +1356,7 @@ virDomainPtr dom; const char *name; CMPIInstance *inst = NULL; + bool autoStartFlag = false; conn = connect_by_classname(_BROKER, CLASSNAME(ref), s); if (conn == NULL) { @@ -1373,6 +1374,11 @@ goto out; } + if (cu_get_bool_prop(inst, "autoStart", &autoStartFlag) != CMPI_RC_OK) + autoStartFlag = false; + if(virDomainSetAutostart(dom, (autoStartFlag) ? 1 : 0) == -1) + CU_DEBUG("Failed to set autostart flag."); + name = virDomainGetName(dom); *s = get_domain_by_name(_BROKER, ref, name, &inst);