How to clone without creating a new vdi

Discussion about using the VirtualBox API, Tutorials, Samples.
Post Reply
eric-wu
Posts: 16
Joined: 24. Apr 2017, 14:06

How to clone without creating a new vdi

Post by eric-wu »

Hi.

Code: Select all

        CloneOptions options[] = { CloneOptions::CloneOptions_Link };
	SAFEARRAY * psa;
	SAFEARRAYBOUND rgsabound[1];
	rgsabound[0].lLbound = 0;
	rgsabound[0].cElements = 1;
	psa = SafeArrayCreate(VT_INT, 1, rgsabound);
	LONG  rgIndex = 0;
	HRESULT hr = SafeArrayPutElement(psa, &rgIndex, options);

	rc=machine->CloneTo(machine_cloned, CloneMode::CloneMode_MachineState,psa, &progress);
wheni use this method, it will create a new vdi.
how can I clone without creating a new vdi, but different states on different disks.
noteirak
Site Moderator
Posts: 5229
Joined: 13. Jan 2012, 11:14
Primary OS: Debian other
VBox Version: OSE Debian
Guest OSses: Debian, Win 2k8, Win 7
Contact:

Re: How to clone without creating a new vdi

Post by noteirak »

You cannot clone without creating a new VDI, that's the very definition of cloning.

Do you mean taking a snapshot?
Hyperbox - Virtual Infrastructure Manager - https://apps.kamax.lu/hyperbox/
Manage your VirtualBox infrastructure the free way!
mpack
Site Moderator
Posts: 39156
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: How to clone without creating a new vdi

Post by mpack »

I think he's asking how to make a linked clone using the API. I have no use for the API, so: pass.
noteirak
Site Moderator
Posts: 5229
Joined: 13. Jan 2012, 11:14
Primary OS: Debian other
VBox Version: OSE Debian
Guest OSses: Debian, Win 2k8, Win 7
Contact:

Re: How to clone without creating a new vdi

Post by noteirak »

mpack wrote:I think he's asking how to make a linked clone using the API. I have no use for the API, so: pass.
Maybe... same answer for the OP then, that will always create an extra VDI.
Hyperbox - Virtual Infrastructure Manager - https://apps.kamax.lu/hyperbox/
Manage your VirtualBox infrastructure the free way!
eric-wu
Posts: 16
Joined: 24. Apr 2017, 14:06

Re: How to clone without creating a new vdi

Post by eric-wu »

noteirak wrote:You cannot clone without creating a new VDI, that's the very definition of cloning.

Do you mean taking a snapshot?
what are the differences when i take a snapshot?
mpack
Site Moderator
Posts: 39156
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: How to clone without creating a new vdi

Post by mpack »

A clone is a new VM, a copy of the old VM. A snapshot is a restore point for the current VM. The two features are not really similar.
eric-wu
Posts: 16
Joined: 24. Apr 2017, 14:06

Re: How to clone without creating a new vdi

Post by eric-wu »

noteirak wrote:You cannot clone without creating a new VDI, that's the very definition of cloning.

Do you mean taking a snapshot?
when i use eNSP, the created router is a clone without creating a new vdi.
noteirak
Site Moderator
Posts: 5229
Joined: 13. Jan 2012, 11:14
Primary OS: Debian other
VBox Version: OSE Debian
Guest OSses: Debian, Win 2k8, Win 7
Contact:

Re: How to clone without creating a new vdi

Post by noteirak »

What is eNSP?
Hyperbox - Virtual Infrastructure Manager - https://apps.kamax.lu/hyperbox/
Manage your VirtualBox infrastructure the free way!
eric-wu
Posts: 16
Joined: 24. Apr 2017, 14:06

Re: How to clone without creating a new vdi

Post by eric-wu »

noteirak wrote:What is eNSP?
it's a networking simulation platform by Huawei.
noteirak
Site Moderator
Posts: 5229
Joined: 13. Jan 2012, 11:14
Primary OS: Debian other
VBox Version: OSE Debian
Guest OSses: Debian, Win 2k8, Win 7
Contact:

Re: How to clone without creating a new vdi

Post by noteirak »

then I guess they are doing it in software inside the VM, but at the VirtualBox level, any kind of clone will trigger a new VDI.
Hyperbox - Virtual Infrastructure Manager - https://apps.kamax.lu/hyperbox/
Manage your VirtualBox infrastructure the free way!
eric-wu
Posts: 16
Joined: 24. Apr 2017, 14:06

Re: How to clone without creating a new vdi

Post by eric-wu »

noteirak wrote:then I guess they are doing it in software inside the VM, but at the VirtualBox level, any kind of clone will trigger a new VDI.
thanks a lot.
Post Reply