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
[email protected]
http://vbox.innotek.de/mailman/listinfo/vbox-dev

Reply via email to