Bug 1450351 - [RFE] Allow specifying a shutdown reason on the .shutdown() call
Summary: [RFE] Allow specifying a shutdown reason on the .shutdown() call
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: ovirt-engine
Classification: oVirt
Component: RestAPI
Version: 4.1.1
Hardware: Unspecified
OS: Unspecified
unspecified
low
Target Milestone: ovirt-4.4.0
: ---
Assignee: Liran Rotenberg
QA Contact: Guilherme Santos
URL:
Whiteboard:
: 1751734 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-05-12 10:13 UTC by nicolas
Modified: 2020-05-20 20:01 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: Enhancement
Doc Text:
With this update, you can set the reason for shutting down or powering off a virtual machine when using a REST API request to execute the shutdown or power-off.
Clone Of:
Environment:
Last Closed: 2020-05-20 20:01:48 UTC
oVirt Team: Virt
Embargoed:
rbarry: ovirt-4.4?
rule-engine: planning_ack?
pm-rhel: devel_ack+
lleistne: testing_ack+


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
oVirt gerrit 103247 0 master MERGED frontend+backend: support 'reason' for stop VM, shutdown VM 2020-05-19 09:07:26 UTC
oVirt gerrit 103308 0 master MERGED restapi: added the support for stop and shutdown 2020-05-19 09:07:26 UTC
oVirt gerrit 104082 0 master MERGED restapi: Update to model 4.4.9 2020-05-19 09:07:26 UTC

Description nicolas 2017-05-12 10:13:23 UTC
Description of problem:

It would be nice if Python-SDK allowed specifying the shutdown reason using the .shutdown() call of Connection.system_service().vms_service().vm_service()

Currently this is not implemented.

Comment 1 Juan Hernández 2017-05-12 10:23:57 UTC
In order to have this in the Python SDK (and in all the other SDKs) we need to add it to the specification of the API, and then implement it in the API itself, so I am moving to the API component. Once it is implemented in the API the SDKs will automatically reflect it.

Comment 2 Juan Hernández 2017-05-12 10:29:14 UTC
This should be added also to the 'stop' operation.

We already have a 'stop_reason' attribute in the VM type, so I think this could be implemented copying the reason provided by the user into that attribute, both for the 'shutodwn' and 'stop' operations.

I'd suggest to define it as follows:

  POST /ovirt-engine/api/vms/123/shutdown?reason=My%20reason

In the Python SDK it will then be used like this:

  vm_service = ...
  vm_service.shutdown(
    reason='My reason'
  )

Same for 'stop'.

Comment 3 Ryan Barry 2019-01-03 12:49:55 UTC
This will not be addressed in a reasonable timeframe. Please re-open if it's still important.

Comment 4 nicolas 2019-01-03 15:53:00 UTC
Even if not implemented in a short timefrime, it's still important to us... It allows to automatize tasks from the Python-SDK API and let the users know why the VMs were shut down.

Comment 5 Ryan Barry 2019-09-13 13:29:16 UTC
*** Bug 1751734 has been marked as a duplicate of this bug. ***

Comment 6 Ryan Barry 2019-09-13 13:30:16 UTC
Let's also fix the other half (shutdown/stop reason propagation from the admin portal) in this bug

Comment 8 Guilherme Santos 2020-03-23 20:30:26 UTC
Verified on:
ovirt-engine-4.4.0-0.25.master.el8ev.noarch

Steps:
1. # curl -X POST -H "Content-type: application/xml" -u admin@internal:<password> --insecure https://<engine-fqdn>/ovirt-engine/api/v4/vms/<vm-id>/stop -d'<action><reason>why not</reason></action>'
2. On engine: # grep "why not" /var/log/ovirt-engine/engine.log
3. Checked the Events Tab in the engine GUI

Results:
Vm successfully stopped with reason message "why not" showing in the logs and in the events tab

Comment 9 Sandro Bonazzola 2020-05-20 20:01:48 UTC
This bugzilla is included in oVirt 4.4.0 release, published on May 20th 2020.

Since the problem described in this bug report should be
resolved in oVirt 4.4.0 release, it has been closed with a resolution of CURRENT RELEASE.

If the solution does not work for you, please open a new bug report.


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