[vbox-dev] createBaseStorage() fails with VERR_INVALID_PARAMETER

Klaus Espenlaub klaus.espenlaub at oracle.com
Wed Jun 11 11:38:01 GMT 2014


You're thinking too complicated... it's really an invalid parameter. The 
trouble is the attempt to pass 10000000 to the logicalSize parameter 
(which is arguably a bit underspecified and there could be a better 
error message): it's impossible to create an image of this logical size 
in any of the image formats I'm aware of, simply because they have a 
minimum storage unit of 512 bytes. 10000000 (10MB by the SI definition) 
isn't a multiple of 512.

VBoxManage createhd can't do this either (note that most people use the 
--size option to specify the image size in MiBytes, which means that 
this issue is hidden, but there's the --sizebytes option)...

Klaus

On 10.06.2014 23:30, Maxime Dor wrote:
> What values do you get if you enumerate ISystemProperties::mediumFormats
> <https://www.virtualbox.org/sdkref/interface_i_system_properties.html#a3fddf22466361f98b6dc9fc4458d1049>?
>
> *From:*Karoline Haus [mailto:karolinehaus at yahoo.de]
> *Sent:* 10 June 2014 13:17
> *To:* Maxime Dor
> *Cc:* vbox-dev at virtualbox.org
> *Subject:* Re: [vbox-dev] createBaseStorage() fails with
> VERR_INVALID_PARAMETER
>
> I have now figured that the problem seems to be the format itself. If I
> used 'vmdk' instead of 'vdi' then it works. How is that possible, if
> using VBoxManage I can create VDI images? Do I have to pass a different
> set of parameters when using VDI? Or is a different type of image (
> MediumVariant
> <https://www.virtualbox.org/sdkref/_virtual_box_8idl.html#adedcbf1a6e5e35fe7a0ca0c4b3447154>)
> required when doing createBaseStorage() with the vdi format? Anyone got
> any pointers?
>
> Maxime Dor <maxime.dor at altherian.org <mailto:maxime.dor at altherian.org>>
> schrieb am 8:35 Sonntag, 8.Juni 2014:
>
> ​Then I don't know :( no such exception is documented (even tho its
> significance is clear) and I don't know which parameter is wrong or invalid.
>
> Hopefully the devs will have an answer.​
>
> On 6 June 2014 17:01, Karoline Haus <karolinehaus at yahoo.de
> <mailto:karolinehaus at yahoo.de>> wrote:
>
>     Yes it is an array. The type of size is int as there is no long type
>     in Python.
>
>     Maxime Dor <maxime.dor at altherian.org
>     <mailto:maxime.dor at altherian.org>> schrieb am 15:07 Freitag, 6.Juni
>     2014:
>
>     Never wrote python, but it looks good. Can you simply confirm
>     that self.vboxMgr.constants.MediumVariant_Standard is given in an
>     array? (it looks like but not sure).
>
>     Else, the size needs to be a long, if such type exists in Python.
>
>     On 6 June 2014 11:28, Karoline Haus <karolinehaus at yahoo.de
>     <mailto:karolinehaus at yahoo.de>> wrote:
>
>         This is the very simple code that fails over and over again and
>         I don't know how to fix it:
>
>         format='vdi'
>
>         diskImagePath='/home/user/test.vdi'
>
>         size=10000000
>
>         hdd = self.vboxMgr.vbox.createHardDisk(format, diskImagePath)
>                  try:
>                      progress = hdd.createBaseStorage(size,
>
>         (self.vboxMgr.constants.
>
>         MediumVariant_Standard,))
>
>         ...
>
>         This code throws an exception and tells me error code
>         VERR_INVALID_PARAMETER as mentioned above. Any idea how to fix this?
>
>         It fails in createBaseStorage().
>
>         Thanks!
>
>         Maxime Dor <maxime.dor at altherian.org
>         <mailto:maxime.dor at altherian.org>> schrieb am 8:58 Freitag,
>         6.Juni 2014:
>
>         Provide the part of your code that fails please, else it's a bit
>         hard to give you pointers.
>
>         On 5 June 2014 16:25, Karoline Haus <karolinehaus at yahoo.de
>         <mailto:karolinehaus at yahoo.de>> wrote:
>
>             Hi I'm trying to create a virtual hard drive using the
>             Python API.
>
>             I can successully create the IMedium object using
>             IVirtualBox::createHardDisk() but then when I try to call
>             createBaseStorage() on that object, I can an error saying
>             "Error in module Medium (VERR_INVALID_PARAMETER)" but I do
>             not get any further details on what the problem is.
>
>             According to the SDK documentation, the only error for this
>             function should be if the medium format is not supported by
>             my system ("The variant of storage creation operation is not
>             supported."), but I am just trying to create a VDI disk, and
>             when I list the HDD backends using VBoxManage, it is
>             definitely supported. The path I'm trying to create the
>             virtual disk under is also accessible and writable.
>
>             What else can the problem be? I do not seem to be able to
>             dig deeper into this. I'm using the /MediumVariant_Standard/
>             variant, so there is nothing special about this either.
>
>             Any pointers would be really appreciated.
>




More information about the vbox-dev mailing list