On 08/14/2016 01:26 PM, Nicolás wrote:
Hi,
This has been asked a short time ago, you can find the thread in [1].
In [2] you can find an unofficial oVirt project written in Python + QT5
that already does that, it connects to the API, gets a list of available
VMs for the supplied credentials and then you can open a VM console to
any of these machines (using virt-viewer).
Regards.
[1]:
http://lists.ovirt.org/pipermail/users/2016-June/040222.html
[2]:
https://github.com/nkovacne/ovirt-desktop-client
In addition to what Nicolás suggests you can also take inspiration from
how the "console" command is implemented in the "ovirt-engine-cli"
tool:
https://github.com/oVirt/ovirt-engine-cli/blob/master/src/ovirtcli/comman...
That code shows how to obtain the required VM. Information (display
address, display port, etc). Then the virt-viewer configuration file is
created here:
https://github.com/oVirt/ovirt-engine-cli/blob/master/src/ovirtcli/platfo...
Note also that recent versions of the engine (including 3.6) can
generate the virt-viewer configutation file for you. For example, if you
know the id of the VM you can get the virt-viewer configuration file and
then launch the "remote-viewer" program with a simple script like this:
---8<---
#!/bin/bash -ex
# Connection parameters:
url="https://engine36.local/ovirt-engine/api"
user="admin@internal"
password="..."
# The identifier of the VM:
vm="3235367b-9bae-4ff1-87ed-b42446e97046"
# The name of the protocol, encoded in hexadecimal, it will
# be 5350494345 for SPICE and 564e43 for VNC:
protocol="5350494345"
# Download the "virt-viewer" configuration file:
curl \
--verbose \
--cacert /etc/pki/ovirt-engine/ca.pem \
--request GET \
--user "${user}:${password}" \
--header "Version: 3" \
--header "Accept: application/x-virt-viewer" \
--output "${vm}.vv" \
"${url}/vms/${vm}/graphicsconsoles/${protocol}"
# Launch the "virt-viewer" program (it will automatically delete
# the configuration file once loaded):
remote-viewer "${vm}.vv"
--->8---
El 12/08/16 a las 07:59, Wang Evan escribió:
>
> Hi :
>
>
>
> I want to integrate oVirt-engine into our system platform. In
> reference to ovirt rest API , I have finished added host and create
> virtual machine. But I can't find the way to open vm console by API or
> CLI ,so what should I do ?
>
>
>
> Thanks !
>
>
>
> Evan
>
--
Dirección Comercial: C/Jose Bardasano Baos, 9, Edif. Gorbea 3, planta
3ºD, 28016 Madrid, Spain
Inscrita en el Reg. Mercantil de Madrid – C.I.F. B82657941 - Red Hat S.L.