VirtualBox.VirtualBox box = new VirtualBox.VirtualBox();
//create a new machine
IMachine machine = box.CreateMachine(null, "MyClone", null, null, "forceOverwrite=1");
box.RegisterMachine(machine);
//Lock machine for editing
machine.LockMachine(session, LockType.LockType_Write);
IMachine machsettings = session.Machine;
//clone the disk image from an existing vdi (source VDI is not being locked/used)
IMedium hddorig = box.OpenMedium("c:\\tmp\\VDI\\dsl-4.4.10-x86.vdi", DeviceType.DeviceType_HardDisk, AccessMode.AccessMode_ReadOnly, 0);
IMedium hddclone = box.CreateHardDisk("VDI", "c:\\tmp\\VDI\\clone.vdi");
IProgress hddprogress = hddorig.CloneTo(hddclone, 0, hddorig);
hddprogress.WaitForCompletion(-1);
//attach disk image to machine
machsettings.AddStorageController("IDE", StorageBus.StorageBus_IDE);
machsettings.AttachDevice("IDE", 0, 0, DeviceType.DeviceType_HardDisk, hddclone); //fails - Storage for the medium 'c:\tmp\VDI\clone.vdi' is not created
machsettings.SaveSettings();
AttachDevice always fails saying "Storage for the medium is not created". What step am I missing here?If I just AttachDevice(... hddorig), it works fine - so it looks like there is some issue creating hddclone
thanks
Steve