Vboxmanage modifymedium --move problem

Discussions related to using VirtualBox on Linux hosts.
Post Reply
sertys
Posts: 6
Joined: 28. Jun 2017, 02:00

Vboxmanage modifymedium --move problem

Post by sertys »

I was having a script that replaces mediums for VMs to migrate to newer differencing parents(templates). Since i am setting my Snapshots folder to '/ssd/' so saved states are loaded from fast storage, whenever i attach a new image, it places it in '/ssd'. And i would like to be having these images in /VirtualBox VMs/VM_name/Snapshots/ .
My script did this roughly :

Code: Select all

//Unmount the newly-created vdi
/usr/bin/vboxmanage storageattach "+vm+" --storagectl sata1 --port 1 --device 0 --type hdd --medium none
//Move the file to the Snapshots folder 
/usr/bin/vboxmanage modifymedium disk "+matches_new_disk[2]+" --move "+enclose(dir_matches[1]+'/Snapshots/')
//Mount the image again 
/usr/bin/vboxmanage storageattach "+vm+" --storagectl sata1 --port 0 --device 0 --type hdd --medium "+enclose(matches_new_disk[2])
At some point i got to find that it was no longer moving the .vdi images to the Snapshots folder. Upon inspection saw that stderr was filled with :
VBoxManage: error: Failed to lock media '/ssd/{0ba31cc1-5563-4f09-9713-65baebb9d8c2}.vdi'
VBoxManage: error: Details: code VBOX_E_INVALID_OBJECT_STATE (0x80bb0007), component MediumWrap, interface IMedium, callee nsISupports
VBoxManage: error: Context: "SetLocation(Bstr(strLocation).raw(), pProgress.asOutParam())" at line 763 of file VBoxManageDisk.cpp

And yet stdout was having:
Move medium with UUID 0ba31cc1-5563-4f09-9713-65baebb9d8c2 finished

Is this a desired behaviour or an upstream bug with the new releases.
I'm running on Ubuntu with vboxmanage --version
5.2.22r126460
Post Reply