From da34a77939cf75e15cd9217b823932aaebeae6b8 Mon Sep 17 00:00:00 2001 From: Roger Luethi Date: Fri, 15 Aug 2014 13:32:51 +0200 Subject: [PATCH] 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 --- labs/lib/osbash/virtualbox.functions | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/labs/lib/osbash/virtualbox.functions b/labs/lib/osbash/virtualbox.functions index 9dff0d8a..973976fe 100644 --- a/labs/lib/osbash/virtualbox.functions +++ b/labs/lib/osbash/virtualbox.functions @@ -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" } #-------------------------------------------------------------------------------