mirror of
https://github.com/OpenNebula/one.git
synced 2026-11-20 11:52:37 +09:00
This commit is contained in:
1 parent
435274d256
commit
1d54c3571e
4 files changed
+17
-27
No files matched your search
@@ -99,6 +99,14 @@ if [ -n "$CEPH_CONF" ]; then
|
||||
RBD="$RBD --conf ${CEPH_CONF}"
|
||||
fi
|
||||
|
||||
###
|
||||
|
||||
# for running VMs, leave disk resize on kvm/resize_disk
|
||||
if [ `lcm_state $VM_ID` -eq 62 ]; then
|
||||
log "Not resizing disk ${SRC_PATH} for running virt. machine directly"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
RESIZE_CMD=$(cat <<EOF
|
||||
$RBD resize --size ${SIZE} $RBD_DST
|
||||
EOF
|
||||
|
||||
@@ -35,5 +35,11 @@ fi
|
||||
SRC_PATH=$(arg_path $SRC)
|
||||
SRC_HOST=$(arg_host $SRC)
|
||||
|
||||
# for running VMs, leave disk resize on kvm/resize_disk
|
||||
if [ `lcm_state $VMID` -eq 62 ]; then
|
||||
log "Not resizing disk ${SRC_PATH} for running virt. machine directly"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
ssh_exec_and_log "${SRC_HOST}" "qemu-img resize ${SRC_PATH} ${SIZE}M" \
|
||||
"Error resizing image ${SRC_PATH}"
|
||||
@@ -105,7 +105,7 @@ function lcm_state
|
||||
|
||||
while IFS= read -r -d '' element; do
|
||||
XPATH_ELEMENTS[i++]="$element"
|
||||
done < <(onevm show -x $VMID| $XPATH \
|
||||
done < <(onevm show -x "${1:-$VMID}" | $XPATH \
|
||||
/VM/LCM_STATE )
|
||||
|
||||
LCM_STATE="${XPATH_ELEMENTS[0]}"
|
||||
|
||||
@@ -24,31 +24,7 @@ DRV_ACTION=$4
|
||||
source $(dirname $0)/kvmrc
|
||||
source $(dirname $0)/../../scripts_common.sh
|
||||
|
||||
(
|
||||
set -e
|
||||
|
||||
get_disk_information "DISK_ID=$DISK_ID"
|
||||
|
||||
regexp="/domain/devices/disk[target/@dev='${DISK_TARGET}']/alias/@name"
|
||||
|
||||
drives="virsh --connect $LIBVIRT_URI dumpxml $DOMAIN"
|
||||
alias=$($drives | $XPATH --stdin "$regexp")
|
||||
|
||||
if [ -n "$alias" ]; then
|
||||
drive="drive-$alias"
|
||||
else
|
||||
error_message "Drive $DISK_TARGET not found"
|
||||
exit -1
|
||||
fi
|
||||
|
||||
log_info "Resizing $DISK_TARGET to $DISK_SIZE"
|
||||
|
||||
virsh --connect $LIBVIRT_URI qemu-monitor-command $DOMAIN --hmp "block_resize $drive ${DISK_SIZE}M"
|
||||
|
||||
) > /dev/null
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Could not notify the VM about the disk resize. Poweroff cycle needed."
|
||||
fi
|
||||
|
||||
|
||||
exec_and_log "virsh --connect ${LIBVIRT_URI} blockresize ${DOMAIN} ${DISK_TARGET} ${DISK_SIZE}M" \
|
||||
"Failed to resize disk ${DISK_ID} on ${DOMAIN}"
|
||||
Reference in new issue
Block a user