ovirt-ansible-collection
ovirt-ansible-collection copied to clipboard
ovirt_disk: Add convert action of the disk
Fixes: https://github.com/oVirt/ovirt-ansible-collection/issues/600
@spameier could you please try this PR if it works for you? It calls the conversion in the engine but on my env fails.
Hey, thanks for the very quick initiative!
[SNIP]
After installing ovirt-engine-sdk-python
from pypi it seems to work :)
Happy to hear that! (probably unrelated issues on my env) Yeah, you need the latest SDK with the convert service.
I indeed see a conversion job being created in oVirt, but the format does not change. The job title in oVirt is "Converting disk test to Preallocated/RAW" when trying to convert from raw to cow.
Playbook:
- hosts: localhost
gather_facts: no
connection: local
vars_files:
- vault.yml # Contains encrypted `engine_password`
- vars.yml
tasks:
- name: Login
ovirt_auth:
url: "{{ engine_url }}"
password: "{{ engine_password }}"
username: "{{ engine_user }}"
- ovirt_disk_info:
auth: "{{ ovirt_auth }}"
pattern: id=d7ca29bf-aa77-402b-9c8d-ae854b260ac2
register: result
- debug:
msg: "{{ result.ovirt_disks[0].format }}"
- ovirt_disk:
auth: "{{ ovirt_auth }}"
id: d7ca29bf-aa77-402b-9c8d-ae854b260ac2
format: cow
sparse: yes
- ovirt_disk_info:
auth: "{{ ovirt_auth }}"
pattern: id=d7ca29bf-aa77-402b-9c8d-ae854b260ac2
register: result
- debug:
msg: "{{ result.ovirt_disks[0].format }}"
collections:
- ovirt.ovirt
Output:
PLAY [localhost] ******************************************************************************************************
TASK [Login] **********************************************************************************************************
ok: [localhost]
TASK [ovirt_disk_info] ************************************************************************************************
ok: [localhost]
TASK [debug] **********************************************************************************************************
ok: [localhost] => {
"msg": "raw"
}
TASK [ovirt_disk] *****************************************************************************************************
[WARNING]: Module did not set no_log for pass_discard
changed: [localhost]
TASK [ovirt_disk_info] ************************************************************************************************
ok: [localhost]
TASK [debug] **********************************************************************************************************
ok: [localhost] => {
"msg": "raw"
}
PLAY RECAP ************************************************************************************************************
localhost : ok=6 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
Do you have some error in engine log?
I see no real error i the GUI. Here's a gist with the logs while the playbook is running: https://gist.github.com/spameier/be77ed3c6c28081bea85376f05e88d48
I could recreate the behaviour with ovirtsdk4
. If I do not specify disk.format
oVirt just converts raw to raw (or cow to cow). I think you need to add disk.format =
. I can test it later with your branch but don't have access to a computer right now.