[vbox-dev] trying to clone a vm

Carlo Bongiovanni carlo.bongiovanni at gmail.com
Mon Jul 15 08:01:09 GMT 2013


Hi All,

I am running VirtualBox 4.2.10 on Ubuntu 12.04.

I am trying to clone a vm with the Java API. Doing this operation from the
console, I would issue the following command:
VBoxManage clonevm vmuid_src --name vmname_dest --register

With Java I am doing the following:

        IMachine m_clone = vbox.findMachine(vmuid_src);
        String m_clone_os = m_clone.getOSTypeId();
        IMachine machine = vbox.createMachine(null, vmname_dest, null,
m_clone_os, null);
        machine.saveSettings();
        vbox.registerMachine(machine);

        CloneMode cm = CloneMode.MachineState;
        List<CloneOptions> cloneOptionsList = new ArrayList<CloneOptions>();
        cloneOptionsList.add(CloneOptions.KeepAllMACs);

        machine.cloneTo(m_clone, cm, cloneOptionsList);

After the execution of this code, I found a new vm in the list, but without
any storage attached. What am I missing? Can you direct me to the right way
to do it? I couldn't understand it from the sdkref.

Thanks, best
Carlo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.virtualbox.org/pipermail/vbox-dev/attachments/20130715/ff0777d7/attachment.html>


More information about the vbox-dev mailing list