Subject: virt-install: add --events support From: Chen Hanxiao chenhanxiao@cn.fujitsu.com Thu May 29 09:46:24 2014 +0800 Date: Thu May 29 09:46:24 2014 +0800: Git: 3c45262526ccf9115713917a7d9b771bf36127a3 This patch will enable setting event configuration: on_poweroff, on_reboot and on_crash. Signed-off-by: Chen Hanxiao Index: virt-manager-1.0.1/man/virt-install.pod =================================================================== --- virt-manager-1.0.1.orig/man/virt-install.pod +++ virt-manager-1.0.1/man/virt-install.pod @@ -123,6 +123,12 @@ Specify metadata values for the guest. P Use --metadata=? to see a list of all available sub options. Complete details at L +=item --events OPT=VAL,[...] + +Specify events values for the guest. Possible options include on_poweroff, on_reboot, and on_crash. + +Use --events=? to see a list of all available sub options. Complete details at L + =item --vcpus=VCPUS[,maxvcpus=MAX][,sockets=#][,cores=#][,threads=#][,cpuset=CPUSET] Number of virtual cpus to configure for the guest. If 'maxvcpus' is specified, Index: virt-manager-1.0.1/tests/cli-test-xml/compare/virt-xml-edit-simple-events.xml =================================================================== --- /dev/null +++ virt-manager-1.0.1/tests/cli-test-xml/compare/virt-xml-edit-simple-events.xml @@ -0,0 +1,11 @@ + + destroy + restart +- restart ++ preserve + + + + +Domain 'test-many-devices' defined successfully. +Changes will take effect after the next domain shutdown. \ No newline at end of file Index: virt-manager-1.0.1/tests/clitest.py =================================================================== --- virt-manager-1.0.1.orig/tests/clitest.py +++ virt-manager-1.0.1/tests/clitest.py @@ -805,6 +805,7 @@ c = vixml.add_category("simple edit diff c.add_compare("""--metadata name=foo-my-new-name,uuid=12345678-12F4-1234-1234-123456789AFA,description="hey this is my new very,very=new desc\\\'",title="This is my,funky=new title" """, "edit-simple-metadata") +c.add_compare("--events on_poweroff=destroy,on_reboot=restart,on_crash=preserve", "edit-simple-events") c.add_compare("--memory 500,maxmemory=1000,hugepages=off", "edit-simple-memory") c.add_compare("--vcpus 10,maxvcpus=20,cores=5,sockets=4,threads=1", "edit-simple-vcpus") c.add_compare("--cpu model=pentium2,+x2apic,forbid=pbe", "edit-simple-cpu") Index: virt-manager-1.0.1/virtinst/cli.py =================================================================== --- virt-manager-1.0.1.orig/virtinst/cli.py +++ virt-manager-1.0.1/virtinst/cli.py @@ -797,6 +797,7 @@ def add_guest_xml_options(geng): help=_("Set domain XML. Ex:\n" "--clock offset=localtime,rtc_tickpolicy=catchup")) geng.add_argument("--pm", help=_("Config power management features")) + geng.add_argument("--events", help=_("Config OS lifecycle operation management features")) def add_boot_options(insg): @@ -1225,6 +1226,17 @@ class ParserMetadata(VirtCLIParser): ###################### +# --events parsing # +###################### + +class ParserEvents(VirtCLIParser): + def _init_params(self): + self.set_param("on_poweroff", "on_poweroff") + self.set_param("on_reboot", "on_reboot") + self.set_param("on_crash", "on_crash") + + +###################### # --numatune parsing # ###################### @@ -2210,6 +2222,7 @@ def build_parser_map(options, skip=None, parsermap[parserobj.option_variable_name] = parserobj register_parser("metadata", ParserMetadata) + register_parser("events", ParserEvents) register_parser("memory", ParserMemory) register_parser("memtune", ParserMemorytune) register_parser("vcpus", ParserVCPU)