[vbox-dev] Generic open and clone

Achim Hasenmueller hasenmueller at innotek.de
Sat Jan 27 10:16:47 GMT 2007


Chris,

thanks a lot for your input. As the complete cloning support will
require a lot of work, we'd like to provide an interim solution in
VBoxManage which directly calls the VDI* APIs. This is almost done,
expect the sources to be committed real soon. Initially it will just
provide VDI shrinking but you could easily add the import/export stuff
by just modifying VBoxManage.

We will also submit the API changes for additional disk formats (VMDK)
soon. What you could have a look at would be that RawHardDisk (and maybe
RawPartition) support. That is rather high on the users' wishlist and we
don't have time to look into it right now.

Thanks!

Achim.

Chris Wolfe wrote:
> I started looking at ways to plug in the image conversion features I
> need (for one, import and export of raw images). The simplest approach
> seems to be leveraging the existing create/open/clone behavior as used
> by "VBoxManage clonevdi" (adding optional -informat and -outformat
> arguments).
>
> Doing so, however, requires the ability to open from and clone to
> arbitrary HardDiskStorageTypes. Is there anything in the pipe that would
> provide something like the attached interface change? If not, I think I
> can get the underlying changes implemented without stepping on too many
> toes.
>
> (My contributions to the attached file are hereby placed in the Public
> Domain. Not that I think they were Copyrightable in the first place, but
> let's keep the lawyers happy.)
>
> Chris
>   
> ------------------------------------------------------------------------
>
> Index: src/VBox/Main/idl/VirtualBox.xidl
> ===================================================================
> --- src/VBox/Main/idl/VirtualBox.xidl	(revision 258)
> +++ src/VBox/Main/idl/VirtualBox.xidl	(working copy)
> @@ -858,6 +858,36 @@
>  
>          </method>
>  
> +        <method name="openHardDisk">
> +            <desc>
> +
> +                Opens a hard disk from a file path or URI using the given
> +                storage type. The opened hard disk remains unregistered
> +                until <link to="#registerHardDisk()"/> is called.
> +
> +                <note>The specified file path can be absolute (full path) or
> +                relative to the <link to="IVirtualBox::homeFolder"> VirtualBox
> +                home directory</link>. If only a file name without any path is
> +                given, the <link to="ISystemProperties::defaultVDIFolder">
> +                default VDI folder</link> will be used as a path to the image
> +                file.</note>
> +
> +            </desc>
> +
> +            <param name="storageType" type="HardDiskStorageType" dir="in">
> +                <desc>Storage type of the hard disk to open.</desc>
> +            </param>
> +            <param name="filePathOrUri" type="wstring" dir="in">
> +                <desc>
> +                    File path or URI that contains a valid disk image of the
> +                    given storage type.
> +                </desc>
> +            </param>
> +            <param name="hardDisk" type="IHardDisk" dir="return">
> +                <desc>Opened hard disk object of the given storage type.</desc>
> +            </param>
> +        </method>
> +
>          <method name="openVirtualDiskImage">
>              <desc>
>  
> @@ -4073,6 +4103,12 @@
>                  <link to="IISCSIHardDisk"/>)
>              </desc>
>          </const>
> +        <const name="RawHardDisk" value="1">
> +            <desc>
> +                A raw disk image, for compatibility with other systems and
> +                native devices.
> +            </desc>
> +        </const>
>      </enum>
>  
>      <enum
> @@ -4663,6 +4699,42 @@
>  
>          </method>
>  
> +        <method name="cloneToDisk">
> +
> +            <desc>
> +
> +                Starts creating a clone of this hard disk. The cloned hard disk
> +                will use the given storage format and will contain exactly the
> +                same sector data as the hard disk being cloned. If applicable to
> +                the format, a new UUID for the clone will be randomly generated.
> +
> +                The specified image file path can be absolute (full path) or
> +                relative to the <link to="IVirtualBox::homeFolder"> VirtualBox
> +                home directory</link>. If only a file name without any path is
> +                given, the <link to="ISystemProperties::defaultVDIFolder">
> +                default VDI folder</link> will be used as a path to the image
> +                file.
> +
> +                It is an error to use the object returned in the @a image
> +                parameter until the returned @a progress object reports success.
> +
> +            </desc>
> +
> +            <param name="storageType" type="HardDiskStorageType" dir="in">
> +                <desc>Storage type of the cloned hard disk.</desc>
> +            </param>
> +            <param name="filePath" type="wstring" dir="in">
> +                <desc>Path to a file in which to store the cloned hard disk.</desc>
> +            </param>
> +            <param name="hardDisk" type="IHardDisk" dir="out">
> +                <desc>Cloned hard disk object.</desc>
> +            </param>
> +            <param name="progress" type="IProgress" dir="return">
> +                <desc>Progress object to track the operation completion.</desc>
> +            </param>
> +
> +        </method>
> +
>      </interface>
>  
>      <!--
>   
> ------------------------------------------------------------------------
>
> _______________________________________________
> vbox-dev mailing list
> vbox-dev at virtualbox.org
> http://vbox.innotek.de/mailman/listinfo/vbox-dev
>   


-- 
Kind regards / mit freundlichen Gruessen / Cordialement,
    Achim Hasenmueller

InnoTek Systemberatung GmbH
phon: +49 7151 60405-0 (fax: -111)
achimha at innotek.de
http://www.innotek.de
Germany





More information about the vbox-dev mailing list