Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 1095635 - Run once vm via REST with <pause>true</pause> parameter, save this parameter true also in next runs
Summary: Run once vm via REST with <pause>true</pause> parameter, save this parameter ...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise Virtualization Manager
Classification: Red Hat
Component: ovirt-engine
Version: 3.4.0
Hardware: x86_64
OS: Linux
unspecified
high
Target Milestone: ---
: 3.5.0
Assignee: Shahar Havivi
QA Contact: Artyom
URL:
Whiteboard: virt
Depends On:
Blocks: 1108676 rhev3.5beta 1156165
TreeView+ depends on / blocked
 
Reported: 2014-05-08 09:04 UTC by Artyom
Modified: 2015-02-17 08:26 UTC (History)
13 users (show)

Fixed In Version: ovirt-3.5.0-alpha2
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 1108676 (view as bug list)
Environment:
Last Closed: 2015-02-17 08:26:43 UTC
oVirt Team: ---
Target Upstream Version:


Attachments (Terms of Use)
engine and vdsm logs (deleted)
2014-05-08 09:04 UTC, Artyom
no flags Details


Links
System ID Priority Status Summary Last Updated
oVirt gerrit 27518 master ABANDONED restapi: Always pass "pause" to backend Never
oVirt gerrit 27996 master MERGED core: do not save state VMs state on RunOnce Never
oVirt gerrit 28122 ovirt-engine-3.4 MERGED core: do not save state VMs state on RunOnce Never

Description Artyom 2014-05-08 09:04:08 UTC
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:

Comment 1 Juan Hernández 2014-05-08 12:13:52 UTC
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?

Comment 2 Artyom 2014-05-08 14:12:58 UTC
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.

Comment 3 Juan Hernández 2014-05-08 14:33:24 UTC
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.

Comment 4 Juan Hernández 2014-05-08 14:46:06 UTC
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.

Comment 6 Artyom 2014-06-18 13:02:05 UTC
Verified on ovirt-engine-3.5.0-0.0.master.20140605145557.git3ddd2de.el6.noarch

Comment 7 Omer Frenkel 2015-02-17 08:26:43 UTC
RHEV-M 3.5.0 has been released


Note You need to log in before you can comment on or make changes to this bug.