Java API - Create harddisk - size limitation?

This is for discussing general topics about how to use VirtualBox.
Post Reply
mkowalik
Posts: 2
Joined: 21. May 2012, 09:32
Primary OS: Fedora 16
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Centos x86_64 mostly
Location: Europe

Java API - Create harddisk - size limitation?

Post by mkowalik »

Hi all,

I'm trying to create a harddisk with java api, but looks like there's a size limitation I haven't found in documentation. The biggest disk I'm able to create with CreateHardDisk() and CreateBasicStorage() is 1GB.
If I try anything bigger, the disk won't be created at all. of course, there's absolutely no problem while I use either vboxmanage or gui.

Any tip for me?

Thanks,
Michal
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Mostly XP

Re: Java API - Create harddisk - size limitation?

Post by mpack »

I''m a C programmer, not Java, but I'll have a go.

Which bigger values did you try? Exactly 2GB would map to a negative number if expressed in signed 32bit arithmetic, but anything less than that would be ok. Also I would look to how your own code transports this number around prior to the API call. My bet is that you are reading the value into a variable type that's too small.
mkowalik
Posts: 2
Joined: 21. May 2012, 09:32
Primary OS: Fedora 16
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Centos x86_64 mostly
Location: Europe

Re: Java API - Create harddisk - size limitation?

Post by mkowalik »

hi,
I have tried 8GB, exactly it was (long)8*1024*1024*1024 (I know, it looks awful)

from vbox sdk documentation:
5.51.5 createBaseStorage
IProgress IMedium::createBaseStorage(
[in] long long logicalSize,
[in] unsigned long variant)
long should be good enough for anything in between -2^64 to 2^64-1 if I'm correct, so 8GB, which is 8*2^30, should be definitely in the range.

I can post exact code snippet later today -- no access to my dev machine right now.

Michal
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Mostly XP

Re: Java API - Create harddisk - size limitation?

Post by mpack »

Sorry, by bigger values I meant values between 1GB and 2GB.

Also: I'm not offering to do your debugging for you! There's no need to post code. I'm simply suggesting that you check for a 32bit signed integer variable used somewhere in the "transport chain" between the input and the API call.
Post Reply