File tree Expand file tree Collapse file tree 6 files changed +53
-6
lines changed Expand file tree Collapse file tree 6 files changed +53
-6
lines changed Original file line number Diff line number Diff line change @@ -59,12 +59,17 @@ if [[ $result -ne 0 ]]; then
5959 exit $result
6060fi
6161
62- # Change the ownership of the volume to qemu. Without doing this libvirt cannot
63- # access the volume.
64- output=$( chown qemu:qemu $output 2> 1)
62+ # Change the ownership of the volume to VOLUME_OWNER:VOLUME_GROUP if
63+ # these environmental variables are defined. Without doing this libvirt
64+ # cannot access the volume on RedHat based GNU/Linux distributions.
65+ existing_owner=" $( stat --format ' %U' " $output " ) "
66+ existing_group=" $( stat --format ' %G' " $output " ) "
67+ new_owner=" ${VOLUME_OWNER:- $existing_owner } "
68+ new_group=" ${VOLUME_GROUP:- $existing_group } "
69+ output=$( chown " $new_owner " :" $new_group " $output 2> 1)
6570result=$?
6671if [[ $result -ne 0 ]]; then
67- echo " Failed to change ownership of the volume to qemu "
72+ echo " Failed to change ownership of the volume to $new_owner : $new_group "
6873 echo " $output "
6974 virsh vol-delete --pool $POOL --vol $NAME
7075 exit $result
Original file line number Diff line number Diff line change @@ -11,6 +11,12 @@ galaxy_info:
1111 - name : EL
1212 versions :
1313 - 7
14+ - name : Ubuntu
15+ versions :
16+ - all
17+ - name : Debian
18+ versions :
19+ - all
1420 galaxy_tags :
1521 - cloud
1622 - kvm
Original file line number Diff line number Diff line change 11---
2+ - name : Gather os specific variables
3+ include_vars : " {{ item }}"
4+ with_first_found :
5+ - files :
6+ - " {{ ansible_distribution }}-{{ ansible_distribution_major_version}}.yml"
7+ - " {{ ansible_distribution }}.yml"
8+ - " {{ ansible_os_family }}.yml"
9+ skip : true
10+ tags : vars
11+
212- name : Ensure the VM console log directory exists
313 file :
414 path : " {{ console_log_path | dirname }}"
515 state : directory
6- owner : qemu
7- group : qemu
16+ owner : " {{ libvirt_vm_log_owner }} "
17+ group : " {{ libvirt_vm_log_owner }} "
818 recurse : true
919 mode : 0770
1020 when : console_log_enabled | bool
Original file line number Diff line number Diff line change 11---
2+ - name : Gather os specific variables
3+ include_vars : " {{ item }}"
4+ with_first_found :
5+ - files :
6+ - " {{ ansible_distribution }}-{{ ansible_distribution_major_version}}.yml"
7+ - " {{ ansible_distribution }}.yml"
8+ - " {{ ansible_os_family }}.yml"
9+ tags : vars
10+
211- name : Ensure remote images are downloaded
312 get_url :
413 url : " {{ item }}"
2433 {{ libvirt_vm_image_cache_path }}/{{ item.image | basename }}
2534 {% endif %}
2635 with_items : " {{ volumes }}"
36+ environment : " {{ libvirt_vm_volume_creation_env }}"
2737 register : volume_result
2838 changed_when :
2939 - volume_result is success
Original file line number Diff line number Diff line change 1+ ---
2+
3+ # Who owns the serial console logs in console_log_path
4+ libvirt_vm_log_owner : libvirt-qemu
5+
6+ # The environment passed to virt_volume.sh
7+ libvirt_vm_volume_creation_env : {}
Original file line number Diff line number Diff line change 1+ ---
2+
3+ # Who owns the serial console logs in console_log_path
4+ libvirt_vm_log_owner : qemu
5+
6+ # The environment passed to virt_volume.sh
7+ libvirt_vm_volume_creation_env :
8+ VOLUME_GROUP : qemu
9+ VOLUME_OWNER : qemu
You can’t perform that action at this time.
0 commit comments