Skip to content

Commit 2950548

Browse files
committed
Do not attempt to resize raw volumes
Fixes #23.
1 parent f32a8d3 commit 2950548

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

files/virt_volume.sh

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -125,14 +125,18 @@ if [[ -n $IMAGE ]]; then
125125
exit $result
126126
fi
127127

128-
# Resize the volume to the requested capacity.
129-
output=$(virsh vol-resize --pool "$POOL" --vol "$NAME" --capacity "$CAPACITY" 2>&1)
130-
result=$?
131-
if [[ $result -ne 0 ]]; then
132-
echo "Failed to resize volume $VOLUME to $CAPACITY"
133-
echo "$output"
134-
virsh vol-delete --pool "$POOL" --vol "$NAME"
135-
exit $result
128+
# Resize the volume to the requested capacity. Attempting to resize a raw volume
129+
# to the same capacity will result in failure, see:
130+
# https://github.com/stackhpc/ansible-role-libvirt-vm/issues/23
131+
if [ "${FORMAT,,}" != "raw" ]; then
132+
output=$(virsh vol-resize --pool "$POOL" --vol "$NAME" --capacity "$CAPACITY" 2>&1)
133+
result=$?
134+
if [[ $result -ne 0 ]]; then
135+
echo "Failed to resize volume $VOLUME to $CAPACITY"
136+
echo "$output"
137+
virsh vol-delete --pool "$POOL" --vol "$NAME"
138+
exit $result
139+
fi
136140
fi
137141
fi
138142

0 commit comments

Comments
 (0)