Make sure we round up for the disk.

OBS-URL: https://build.opensuse.org/package/show/Virtualization/virt-manager?expand=0&rev=589
This commit is contained in:
Charles Arnold 2023-01-20 21:38:29 +00:00 committed by Git OBS Bridge
parent 36aa37cc98
commit 0aabe59115

View File

@ -11,31 +11,35 @@ libvirt.libvirtError: internal error: qemu unexpectedly closed the monitor: 2023
Cannot get 'write' permission without 'resize': Image size is not a multiple of request alignment
--- virt-manager-4.1.0/virtManager/createvol.py.orig 2023-01-20 10:58:40.230657960 -0700
+++ virt-manager-4.1.0/virtManager/createvol.py 2023-01-20 11:03:54.722665454 -0700
Index: virt-manager-4.1.0/virtManager/createvol.py
===================================================================
--- virt-manager-4.1.0.orig/virtManager/createvol.py
+++ virt-manager-4.1.0/virtManager/createvol.py
@@ -246,7 +246,13 @@ class vmmCreateVolume(vmmGObjectUI):
vol = self._make_stub_vol()
vol.name = volname
vol.capacity = (cap * 1024 * 1024 * 1024)
+ if vol.capacity:
+ # If a raw disk is marked 'shared', libvirt requires this
+ vol.capacity = 4096 * round(vol.capacity/4096)
+ # If a raw disk is marked 'shared', round up for libvirt
+ vol.capacity -= vol.capacity % -4096
vol.allocation = (alloc * 1024 * 1024 * 1024)
+ if vol.allocation:
+ vol.allocation = 4096 * round(vol.allocation/4096)
+ vol.allocation -= vol.allocation % -4096
+
if backing:
vol.backing_store = backing
if fmt:
--- virt-manager-4.1.0/virtinst/devices/disk.py.orig 2023-01-20 10:58:28.578657682 -0700
+++ virt-manager-4.1.0/virtinst/devices/disk.py 2023-01-20 11:05:00.706667026 -0700
Index: virt-manager-4.1.0/virtinst/devices/disk.py
===================================================================
--- virt-manager-4.1.0.orig/virtinst/devices/disk.py
+++ virt-manager-4.1.0/virtinst/devices/disk.py
@@ -361,6 +361,9 @@ class DeviceDisk(Device):
volname, poolobj.name())
cap = (size * 1024 * 1024 * 1024)
+ if cap:
+ # If a raw disk is marked 'shared', libvirt requires this
+ cap = 4096 * round(cap/4096)
+ # If a raw disk is marked 'shared', round up for libvirt
+ cap -= cap % -4096
if sparse:
alloc = 0
else: