Opened 12 years ago
#12045 new defect
Cannot attach new vm via multiattach when another vm is running
Reported by: | charlie-jacobsen | Owned by: | |
---|---|---|---|
Component: | virtual disk | Version: | VirtualBox 4.2.14 |
Keywords: | multi-attach | Cc: | |
Guest type: | other | Host type: | other |
Description ¶
Cf. bug report: https://www.virtualbox.org/ticket/11700. The suggested solution doesn't work if the vdi file is read only (on the file system).
After running the commands
NAME=test1
VBoxManage createvm --name "${NAME}" --ostype Ubuntu --register
VBoxManage modifyvm "${NAME}" --memory 1024
VBoxManage storagectl "${NAME}" --name "sata1" --add sata
VBoxManage storageattach "${NAME}" --storagectl "sata1" --port 0 --device 0 \
--type hdd --medium /path/to/my.vdi --mtype multiattach
to create a new vm (with an existing multiattach virtual disk), I start up the vm. While it's running, I create a new vm with similar commands, but I get the following error:
VBoxManage: error: Medium '/home/charlesj/vm/2100vm.vdi' is locked for reading by another task VBoxManage: error: Details: code VBOX_E_INVALID_OBJECT_STATE (0x80bb0007), component Medium, interface IMedium, callee nsISupports VBoxManage: error: Context: "COMSETTER(Type)(mediumType)" at line 678 of file VBoxManageStorageController.cpp VBoxManage: error: Failed to set the medium type
It looks like it's trying to set the medium type prematurely (in case it isn't multiattach).
Setting up a new vm with multiattach works when all attached vms are powered down / suspended, even when the vdi file is read only.
I've attached the log file for the first machine that successfully boots; the second machine does not produce a log file on failure.