On Wed, Oct 20, 2021 at 3:55 PM Nir Soffer <nsoffer(a)redhat.com> wrote:
On Wed, Oct 20, 2021 at 2:24 PM Grace Chen <hippoqian(a)gmail.com> wrote:
> I want to use python script running from a host to automate the remote kvm
manager's vm backup. Our ovirt version is 4.3. I have installed ovirt-imageio-daemon
on the host
> I tried to yum install ovirt-imageio-client (we use yum), it couldn't find the
package.
> error message:
>
> Loaded plugins: ulninfo, vdsmupgrade, versionlock
> ovirt-4.3
| 3.0 kB 00:00:00
> ovirt-4.3-extra
| 3.0 kB 00:00:00
> ovirt-master-snapshot
| 3.0 kB 00:00:00
> ovirt-master-snapshot-static
| 3.0 kB 00:00:00
> No package ovirt-imageio-client available.
>
> I tried to copy folder ovirt_imageio from ovirt-imageio to my python library
directory, it could not compile the c file "ioutil.c"
> Can anybody help me install the python package? Am I installing on the correct
place, do I need to use the python script only on the host that installed the kvm
manager?
(Copied from private mail in case it is useful for others)
ovirt-imageio-client was released in 4.4, and is not compatible with python 2.
In general the client supports older version of ovirt server (e.g.
4.3), but it is
not tested in this configuration.
You can try to create a vm with centos 8 and ovirt-release44.rpm
and install the client in this vm.
Then you can run the backups on the vm, and store the backups in
NFS server accessed by this "backup" vm.
Note that you will get much better performance with ovirt 4.4., when
running the client directly on the ovirt host. 4.4. also supports incremental
backup, which is much faster and simpler compared with snapshot based
backup that you probably plan to use.\
We have another option now to install ovirt_imagieo, via pip.
It may work on any Linux distro with qemu-img (>= 4.2) and python >= 3.6,
but I tested it only on Fedora 34 (qem-img 6.1, python 3.9).
Note that the imageio client depends qemu-img and qemu-nbd, provided by qem-img
package on rpm based distros. pip cannot install this package, so you
need to install
it yourself using your distro package manager.
Here an example using virtual environment:
$ python3 -m venv venv
$ source venv/bin/activate
$ pip install --upgrade pip
$ pip install --upgrade ovirt-imageio
$ pip install --upgrade ovirt-engine-sdk-python
The imageio client is not very useful as is unless you want to write
an application
using the python library. But we have several useful example scripts
in the ovirt
engine python SDK. They are not installed by pip, but you can get them via git:
$ git clone
https://github.com/oVirt/python-ovirt-engine-sdk4.git
Finally, you need to add configuration file pointing to your engine(s):
$ cat /home/nsoffer/.config/ovirt.conf
[myengine]
engine_url =
https://myengine.example.com
username = admin@internal
password = password
cafile = /home/username/certs/myengine.pem
Now you can upload a disk image using:
$ python-ovirt-engine-sdk4/examples/upload_disk.py -c myengine
--sd-name my-storage-domain --disk-sparse disk.qcow2
These scripts will be most useful and should work with 4.3:
- upload_disk.py
- download_disk.py
These require ovirt 4.4:
- list_disk_snapshots.py
- download_disk_snapshot.py
- backup_vm.py
Nir