labs: fix multiattach disks

When using VBoxMange storageattach with the "--mtype multiattach"
option, the command fails if another VM is already attached (via
multiattach) and running at the time of the call. If the option
is left out, the new VM has its disk multiattached as desired.

Rather than trying to find out when to use the option, this patch uses
modifyhd to register a disk as type multiattach. This call does not fail
if made several times for the same disk, and all subsequent
storageattach calls for that disk have the multiattach option
automatically set.

Change-Id: I5306b855f0736d3e6a00761c514b4a031f167ead
Implements: blueprint openstack-training-labs
This commit is contained in:
Roger Luethi 2014-08-15 13:32:51 +02:00
parent ae267572b4
commit da34a77939

View File

@ -269,14 +269,16 @@ function vm_attach_disk {
function vm_attach_disk_multi {
local VM_NAME=$1
local DISK=$2
$VBM modifyhd --type multiattach "$DISK"
echo >&2 -e "Attaching to VM \"$VM_NAME\":\n\t$DISK"
$VBM storageattach "$VM_NAME" \
--storagectl SATA \
--port 0 \
--device 0 \
--type hdd \
--medium "$DISK" \
--mtype multiattach
--medium "$DISK"
}
#-------------------------------------------------------------------------------