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
Java API - Create harddisk - size limitation?
-
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?
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.
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?
hi,
I have tried 8GB, exactly it was (long)8*1024*1024*1024 (I know, it looks awful)
from vbox sdk documentation:
I can post exact code snippet later today -- no access to my dev machine right now.
Michal
I have tried 8GB, exactly it was (long)8*1024*1024*1024 (I know, it looks awful)
from vbox sdk documentation:
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.5.51.5 createBaseStorage
IProgress IMedium::createBaseStorage(
[in] long long logicalSize,
[in] unsigned long variant)
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?
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.
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.