virsh on compute host

I am trying to use the command line to stop and start vms in ovirt 4.4. Previously, I used virsh on the standalone engine machine, but that has been removed in this release. On the compute host, I am able to use virsh to list vms, and shutdown vms from that list. The start command gives me this error: virsh # start r7-dante error: failed to get domain 'r7-dante' I have also tried to use curl with the restapi from the standalone engine. I have not been able to find examples of how to stop and start vms. Here is an example of my list of vms... curl --cacert '/etc/pki/ovirt-engine/ctg.crt' --request GET --header 'Version: 4' --header 'Accept: application/xml' --user 'admin@internal:psw' https://bacchus.neworleans.com/ovirt-engine/api/vms Can anyone help me with this? Thank you. Regards -- Paul Dyer, Mercury Consulting Group, RHCE 504-338-8750

I am trying curl with the restapi, following the docs, but I get a syntax error. # curl --cacert '/etc/pki/ovirt-engine/ctg.crt' --request POST --header 'Version: 4' --header 'Content-Type: application/xml' --header 'Accept: application/xml' --user 'admin@internal:psw' " https://baronne.neworleans.com/ovirt-engine/api/vms/636e3bb8-b025-482c-ba5a-... " <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <fault> <detail>For correct usage, see: https://baronne.neworleans.com/ovirt-engine/apidoc#services/vm/methods/start </detail> <reason>Request syntactically incorrect.</reason> </fault> On Fri, Feb 26, 2021 at 10:15 AM Paul Dyer <pmdyermms@gmail.com> wrote:
I am trying to use the command line to stop and start vms in ovirt 4.4. Previously, I used virsh on the standalone engine machine, but that has been removed in this release.
On the compute host, I am able to use virsh to list vms, and shutdown vms from that list. The start command gives me this error:
virsh # start r7-dante error: failed to get domain 'r7-dante'
I have also tried to use curl with the restapi from the standalone engine. I have not been able to find examples of how to stop and start vms. Here is an example of my list of vms...
curl --cacert '/etc/pki/ovirt-engine/ctg.crt' --request GET --header 'Version: 4' --header 'Accept: application/xml' --user 'admin@internal:psw' https://bacchus.neworleans.com/ovirt-engine/api/vms
Can anyone help me with this?
Thank you. Regards
-- Paul Dyer, Mercury Consulting Group, RHCE 504-338-8750
-- Paul Dyer, Mercury Consulting Group, RHCE 504-338-8750

On Fri, Feb 26, 2021 at 9:00 PM Paul Dyer <pmdyermms@gmail.com> wrote:
I am trying curl with the restapi, following the docs, but I get a syntax error.
# curl --cacert '/etc/pki/ovirt-engine/ctg.crt' --request POST --header 'Version: 4' --header 'Content-Type: application/xml' --header 'Accept: application/xml' --user 'admin@internal:psw' "https://baronne.neworleans.com/ovirt-engine/api/vms/636e3bb8-b025-482c-ba5a-..." <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <fault> <detail>For correct usage, see: https://baronne.neworleans.com/ovirt-engine/apidoc#services/vm/methods/start</detail>
Did you look there? It explains that you need to post "<action/>". I don't know why this is needed, but this is how the API works :-) Base on other examples, you are missing --data "<action/>"
<reason>Request syntactically incorrect.</reason> </fault>
On Fri, Feb 26, 2021 at 10:15 AM Paul Dyer <pmdyermms@gmail.com> wrote:
I am trying to use the command line to stop and start vms in ovirt 4.4. Previously, I used virsh on the standalone engine machine, but that has been removed in this release.
On the compute host, I am able to use virsh to list vms, and shutdown vms from that list. The start command gives me this error:
virsh # start r7-dante error: failed to get domain 'r7-dante'
oVirt vms are not persisted on the host. They exist in oVirt db, and defined on the host only when the vm is running. oVirt API is the right place to control the system. If you want something that is easier to script and does not require low level API details, you can use the SDK - here is a related example: https://github.com/oVirt/ovirt-engine-sdk/blob/master/sdk/examples/start_vm.... Nir

Thank you. It works perfectly. Paul On Fri, Feb 26, 2021 at 3:17 PM Nir Soffer <nsoffer@redhat.com> wrote:
On Fri, Feb 26, 2021 at 9:00 PM Paul Dyer <pmdyermms@gmail.com> wrote:
I am trying curl with the restapi, following the docs, but I get a
syntax error.
# curl --cacert '/etc/pki/ovirt-engine/ctg.crt' --request POST --header
'Version: 4' --header 'Content-Type: application/xml' --header 'Accept: application/xml' --user 'admin@internal:psw' " https://baronne.neworleans.com/ovirt-engine/api/vms/636e3bb8-b025-482c-ba5a-... "
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <fault> <detail>For correct usage, see: https://baronne.neworleans.com/ovirt-engine/apidoc#services/vm/methods/start </detail>
Did you look there?
It explains that you need to post "<action/>". I don't know why this is needed, but this is how the API works :-)
Base on other examples, you are missing
--data "<action/>"
<reason>Request syntactically incorrect.</reason> </fault>
On Fri, Feb 26, 2021 at 10:15 AM Paul Dyer <pmdyermms@gmail.com> wrote:
I am trying to use the command line to stop and start vms in ovirt
4.4. Previously, I used virsh on the standalone engine machine, but that has been removed in this release.
On the compute host, I am able to use virsh to list vms, and shutdown
vms from that list. The start command gives me this error:
virsh # start r7-dante error: failed to get domain 'r7-dante'
oVirt vms are not persisted on the host. They exist in oVirt db, and defined on the host only when the vm is running.
oVirt API is the right place to control the system.
If you want something that is easier to script and does not require low level API details, you can use the SDK - here is a related example:
https://github.com/oVirt/ovirt-engine-sdk/blob/master/sdk/examples/start_vm....
Nir
-- Paul Dyer, Mercury Consulting Group, RHCE 504-338-8750
participants (2)
-
Nir Soffer
-
Paul Dyer