Created attachment 893583 [details] engine and vdsm logs Description of problem: When I run once vm via REST: <action> <async>false</async> <grace_period> <expiry>10</expiry> </grace_period> <pause>true</pause> </action> And after it I stop vm, in edit options I see that box "Start in Pause Mode" still checked, and if after it I run once vm with: <action> <async>false</async> <grace_period> <expiry>10</expiry> </grace_period> <pause>false</pause> </action> It start vm in pause mode, because box "Start in Pause Mode" checked. And it impossible to unchecked this box via REST because <pause> parameter not exist under vm: <vm href= "/api/vms/4d508cfb-d109-4ac7-a15b-3acc1eeaeee0" id="4d508cfb-d109-4ac7-a15b-3acc1eeaeee0"> <actions> <link href= "/api/vms/4d508cfb-d109-4ac7-a15b-3acc1eeaeee0/undo_snapshot" rel="undo_snapshot"/> <link href= "/api/vms/4d508cfb-d109-4ac7-a15b-3acc1eeaeee0/commit_snapshot" rel="commit_snapshot"/> <link href= "/api/vms/4d508cfb-d109-4ac7-a15b-3acc1eeaeee0/preview_snapshot" rel="preview_snapshot"/> <link href= "/api/vms/4d508cfb-d109-4ac7-a15b-3acc1eeaeee0/cancelmigration" rel="cancelmigration"/> <link href= "/api/vms/4d508cfb-d109-4ac7-a15b-3acc1eeaeee0/ticket" rel="ticket"/> <link href= "/api/vms/4d508cfb-d109-4ac7-a15b-3acc1eeaeee0/move" rel="move"/> <link href= "/api/vms/4d508cfb-d109-4ac7-a15b-3acc1eeaeee0/migrate" rel="migrate"/> <link href= "/api/vms/4d508cfb-d109-4ac7-a15b-3acc1eeaeee0/reboot" rel="reboot"/> <link href= "/api/vms/4d508cfb-d109-4ac7-a15b-3acc1eeaeee0/detach" rel="detach"/> <link href= "/api/vms/4d508cfb-d109-4ac7-a15b-3acc1eeaeee0/export" rel="export"/> <link href= "/api/vms/4d508cfb-d109-4ac7-a15b-3acc1eeaeee0/shutdown" rel="shutdown"/> <link href= "/api/vms/4d508cfb-d109-4ac7-a15b-3acc1eeaeee0/start" rel="start"/> <link href= "/api/vms/4d508cfb-d109-4ac7-a15b-3acc1eeaeee0/stop" rel="stop"/> <link href= "/api/vms/4d508cfb-d109-4ac7-a15b-3acc1eeaeee0/suspend" rel="suspend"/> </actions> <name>run_once_vm</name> <link href= "/api/vms/4d508cfb-d109-4ac7-a15b-3acc1eeaeee0/applications" rel="applications"/> <link href= "/api/vms/4d508cfb-d109-4ac7-a15b-3acc1eeaeee0/disks" rel="disks"/> <link href= "/api/vms/4d508cfb-d109-4ac7-a15b-3acc1eeaeee0/nics" rel="nics"/> <link href= "/api/vms/4d508cfb-d109-4ac7-a15b-3acc1eeaeee0/cdroms" rel="cdroms"/> <link href= "/api/vms/4d508cfb-d109-4ac7-a15b-3acc1eeaeee0/snapshots" rel="snapshots"/> <link href= "/api/vms/4d508cfb-d109-4ac7-a15b-3acc1eeaeee0/tags" rel="tags"/> <link href= "/api/vms/4d508cfb-d109-4ac7-a15b-3acc1eeaeee0/permissions" rel="permissions"/> <link href= "/api/vms/4d508cfb-d109-4ac7-a15b-3acc1eeaeee0/statistics" rel="statistics"/> <link href= "/api/vms/4d508cfb-d109-4ac7-a15b-3acc1eeaeee0/reporteddevices" rel="reporteddevices"/> <link href= "/api/vms/4d508cfb-d109-4ac7-a15b-3acc1eeaeee0/watchdogs" rel="watchdogs"/> <type>desktop</type> <status> <state>paused</state> <detail>noerr</detail> </status> <memory>1073741824</memory> <cpu> <topology sockets="1" cores="1"/> <architecture>X86_64</architecture> </cpu> <cpu_shares>0</cpu_shares> <os type="other"> <boot dev="hd"/> </os> <high_availability> <enabled>false</enabled> <priority>0</priority> </high_availability> <display> <type>spice</type> <address>brown-vdsc.qa.lab.tlv.redhat.com</address> <port>5900</port> <secure_port>5901</secure_port> <monitors>1</monitors> <single_qxl_pci>false</single_qxl_pci> <allow_override>false</allow_override> <certificate> <subject>O=Test,CN=brown-vdsc.qa.lab.tlv.redhat.com</subject> </certificate> <smartcard_enabled>false</smartcard_enabled> </display> <host href= "/api/hosts/3f7c5947-f3da-4634-8416-0548a284037f" id="3f7c5947-f3da-4634-8416-0548a284037f"/> <cluster href= "/api/clusters/cb434140-f722-4d97-9cfb-dfe75dbd0afb" id="cb434140-f722-4d97-9cfb-dfe75dbd0afb"/> <template href= "/api/templates/00000000-0000-0000-0000-000000000000" id="00000000-0000-0000-0000-000000000000"/> <start_time>2014-05-04T14:05:01.837+03:00</start_time> <stop_time>2014-05-04T14:05:00.314+03:00</stop_time> <creation_time>2014-05-04T14:03:43.683+03:00</creation_time> <origin>ovirt</origin> <stateless>false</stateless> <delete_protected>false</delete_protected> <sso> <methods> <method id="GUEST_AGENT"/> </methods> </sso> <domain> <name/> </domain> <initialization> <domain/> <regenerate_ssh_keys>false</regenerate_ssh_keys> <nic_configurations/> </initialization> <placement_policy> <affinity>migratable</affinity> </placement_policy> <memory_policy> <guaranteed>1073741824</guaranteed> <ballooning>true</ballooning> </memory_policy> <usb> <enabled>false</enabled> </usb> <migration_downtime>-1</migration_downtime> </vm> Version-Release number of selected component (if applicable): av8 How reproducible: Always Steps to Reproduce: 1. See above 2. 3. Actual results: After that I stop Run once mode(with pause), box "Start in Pause Mode" still checked, also pause parameter not appear under vm Expected results: After that I stop Run once mode(with pause), box "Start in Pause Mode" unchecked and pause parameter appear under vm. Additional info:
As far as I can tell it isn't possible to change the properties of the VM with the start operation, so I can only reproduce this if I manually change the "Start in Pause Mode" in the GUI. The action that you are executing is "run", not "run once". In order to execute "run once" you need to pass a "vm" element, maybe empty: <action> <async>false</async> <grace_period> <expiry>10</expiry> </grace_period> <vm/> <pause>true</pause> </action> From the point of view of the RESTAPI the presence of this "vm" element is what differentiates "run" and "run once". When using "run once" I see that the "pause" parameter is ignored, unless the value is "true". That is something to fix. It is also true that the flag that specifies if the machine should by default be started paused isn't available via the RESTAPI. Please open another bug to add that. Ori, can you please confirm/reject my comments?
Update: For reproduce behavior, you also need to attach floppy to vm in run once mode, so command in REST looks: <action> <async>false</async> <grace_period> <expiry>10</expiry> </grace_period> <vm> <floppies> <floppy> <file id=floppy_image/> </floppy> </floppies> </vm> <pause>true</pause> </action> Also the same thing happening in UI, if you run once vm with attached floppy and with enable flag "Start in paused mode", flag stay enabled under vm options also after stop vm.
I verified that in my environment, if the pause parameter is true *and* a floppy is provided, then the "Start in paused mode" is automatically set in the database.
The update of the "is_run_and_pause" database column is triggered in RunVmCommand.initVm(), it calls the VmStaticDAO.update() method when attaching a floppy: // if we attach floppy we don't need the sysprep if (!StringUtils.isEmpty(getParameters().getFloppyPath())) { getVmStaticDAO().update(getVm().getStaticData()); } I'm not sure, but I think that the "run once" flow should never update the vm_static table. I'm moving the bug to the backend component and abandoning the proposed patch, as it is probably irrelevant.
Verified on ovirt-engine-3.5.0-0.0.master.20140605145557.git3ddd2de.el6.noarch
RHEV-M 3.5.0 has been released