stackhpc / ansible-role-libvirt-vm

This role configures and creates VMs on a KVM hypervisor.
128 stars 67 forks source link

Do not attempt to resize raw volumes #24

Closed jovial closed 5 years ago

jovial commented 5 years ago

Fixes #23. Not sure why we are resizing the volume when we just created it with a given capacity.

markgoddard commented 5 years ago

IIRC the reason for resizing is that the previous 'upload' step simply replaced the volume with the image, and it ended up having the size of the image.

Can you verify that this isn't the case for raw volumes?

jovial commented 5 years ago
(venv-openstack) [verne@kef1c-cde-ucd0001 vm]$ sudo virsh vol-create-as --pool libvirt-storage --name delete_me --capacity 1GiB --format raw
(venv-openstack) [verne@kef1c-cde-ucd0001 vm]$ sudo virsh vol-info --pool libvirt-storage delete_me
Name:           delete_me
Type:           file
Capacity:       1.00 GiB
Allocation:     1.00 GiB
(venv-openstack) [verne@kef1c-cde-ucd0001 vm]$ dd if=/dev/zero of=/tmp/raw.img bs=1M count=1 
1+0 records in
1+0 records out
1048576 bytes (1.0 MB) copied, 0.00210321 s, 499 MB/s

(venv-openstack) [verne@kef1c-cde-ucd0001 vm]$ sudo virsh vol-upload --pool libvirt-storage delete_me /tmp/raw.img 

(venv-openstack) [verne@kef1c-cde-ucd0001 vm]$ sudo virsh vol-info --pool libvirt-storage delete_me
Name:           delete_me
Type:           file
Capacity:       1.00 GiB
Allocation:     1.00 GiB

Seems to stay at the same capacity.