[vbox-dev] registervm error webservice but works using cli

alexandre.devely at orange.com alexandre.devely at orange.com
Tue Sep 10 08:46:14 GMT 2013


Hi Klaus,

Thank you for your response.

Using the Webservice and the SOAP API, you can not call openMachine twice (using the same session) :
I ve wrote this piece of code, and the result is an exception:

           second call IVirtualBox_openMachine error VirtualBox error: Cannot attach medium '/mnt/nfs/volcbdata/xxxx/testtom/NewVirtualDisk1.vdi' {0386b372-3416-40c1-a6ca-b199d4f32831} from snapshot '4916d0bd-4579-450b-8b55-dc79595d5c73': medium is already in use by this snapshot! (0x80BB000C)

Code : 
		cbhypervisor myhypervisor = new cbhypervisor("http://192.168.7.53:18083/", 2468);
            if (!myhypervisor.sessionlogon("xxx", "xxx"))
            {
                job_tracker(":myhypervisor.sessionlogon error " + myhypervisor.strLastErrorMessage);
                return ;
            }

            string strIMachine, strReturn;
            try
            {   // it works
                strIMachine = myhypervisor.vboxhypervisor.IVirtualBox_openMachine(myhypervisor.strSessionHypervisor,
                    "/mnt/nfs/volcbdata/xxxx/testtom/testtom.vbox");
                strReturn = myhypervisor.vboxhypervisor.IMachine_getName(strIMachine);
            }
            catch (Exception a) 
            {
                job_tracker("first call IVirtualBox_openMachine error " + a.Message);
            }


            try
            {   // failed
                strIMachine = myhypervisor.vboxhypervisor.IVirtualBox_openMachine(myhypervisor.strSessionHypervisor,
                    "/mnt/nfs/volcbdata/xxxx/testtom/testtom.vbox");
                strReturn = myhypervisor.vboxhypervisor.IMachine_getName(strIMachine);
            }
            catch (Exception b) 
            {
                job_tracker("second call IVirtualBox_openMachine error " + b.Message);
            }
            


Best Regards

Alex


-----Message d'origine-----
De : Klaus Espenlaub [mailto:klaus.espenlaub at oracle.com] 
Envoyé : lundi 9 septembre 2013 20:41
À : vbox-dev at virtualbox.org
Objet : Re: [vbox-dev] registervm error webservice but works using cli

Hi Alex,

On 28.08.2013 20:22, alexandre.devely at orange.com wrote:
> Hello Devs,
>
> On Linux Ubuntu(precise_amd64), i ve got an error using the Webservice 
> to register a VM, this error does not occur using the command line.
>
> I want to register a VM using the vboxwebsrv (runas vbox user). I use 
> IVirtualBox_openMachine and IVirtualBox_registerMachine.
>
> IVirtualBox_openMachine fails using webservice :
>
> exception VirtualBox error: Cannot attach medium 
> '/mnt/nfs/volcbdata/demoAlexWindowsXp/demoAlexWWindowsXp-disk1.vdi'
> {b3cf56ef-48ba-4dc8-9efc-77a64c43e534} from snapshot
> '775ed2f4-fd3e-487d-8963-f8ae4515eccd': medium is already in use by 
> this snapshot! (0x80BB000C)

Is the webservice running as the same user as below?

> But if i use the command line "vboxmanage registervm", it works using 
> the same file
>
> vbox at pbox:~$ vboxmanage registervm
> /mnt/nfs/volcbdata/demoAlexWindowsXp/demoAlexWindowsXp.vbox
>
> vbox at pbox:~$ vboxmanage list vms
>
> "demoAlexWindowsXp" {2bac5ce4-4e95-4573-b42f-29c3536c58a1}
>
> vbox at pbox:~$
>
> I use the last release VirtualBox 4.2.16
>
> Why does the command line work ?

Really no idea - the webservice is just converting its API calls to the normal local API (without adding/removing operations or re-grouping them), so if you do the same thing (in the same account) starting with the same files then the result has to be the same.

Scratching my head...

Klaus

>
> Thank you in advance.
>
> Best Regards
>
> Alex

_______________________________________________
vbox-dev mailing list
vbox-dev at virtualbox.org
https://www.virtualbox.org/mailman/listinfo/vbox-dev

_________________________________________________________________________________________________________________________

Ce message et ses pieces jointes peuvent contenir des informations confidentielles ou privilegiees et ne doivent donc
pas etre diffuses, exploites ou copies sans autorisation. Si vous avez recu ce message par erreur, veuillez le signaler
a l'expediteur et le detruire ainsi que les pieces jointes. Les messages electroniques etant susceptibles d'alteration,
Orange decline toute responsabilite si ce message a ete altere, deforme ou falsifie. Merci.

This message and its attachments may contain confidential or privileged information that may be protected by law;
they should not be distributed, used or copied without authorisation.
If you have received this email in error, please notify the sender and delete this message and its attachments.
As emails may be altered, Orange is not liable for messages that have been modified, changed or falsified.
Thank you.





More information about the vbox-dev mailing list