[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-API] Creating a VM from a record

  • To: xen-api@xxxxxxxxxxxxxxxxxxx
  • From: mftahy <mofta7y@xxxxxxxxx>
  • Date: Mon, 31 Jan 2011 22:39:58 -0500
  • Delivery-date: Mon, 31 Jan 2011 19:41:48 -0800
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding; b=Ka29s+IT6O58TlUnebJMwqabS4SY7OZ9S4MfJi074NmHB5iHsS5cxb5JOQw4iVHw5G NbAYovsVDtq7PpjrkRJ/2OjUVhw0ejKXXvTz4nv7hZwOqG+kdb/kmVP6hBqnxTHe+V4f yVJ0mCzPmwtq+OjM0lHPHYmK8A8789FTWsXPQ=
  • List-id: Discussion of API issues surrounding Xen <xen-api.lists.xensource.com>


I am trying to use Zend XmlRbc to create a VM using a record.

I am particularly using this method

(VM ref) create (session_id s, VM record args)

the way I am trying to do it is the follwing

1- start a vm

2- get the current vm record using VM.get_record

3- shutdown the vm

4- create the VM using the the record we have from step 2 using the method VM.create(session_id s, VM record args)

this does not work !!

this is the error that returns by XMLRBC

   [Status] => Failure
   [ErrorDescription] => Array
           [0] => INTERNAL_ERROR
           [1] => 'list' object has no attribute 'items'


and this is the output of xend.log

ERROR (xmlrpclib2:166) Internal error handling VM.create
Traceback (most recent call last):
 File "/usr/lib64/python2.6/site-packages/xen/util/xmlrpclib2.py", line 131, in 
   response = self._dispatch(method, params)
 File "/usr/lib64/python2.6/SimpleXMLRPCServer.py", line 418, in _dispatch
   return func(*params)
 File "/usr/lib64/python2.6/site-packages/xen/xend/XendAPI.py", line 649, in 
   wrapped_f = (lambda *args: new_f(f, *args))
 File "/usr/lib64/python2.6/site-packages/xen/xend/XendAPI.py", line 672, in 
   _ctor_event_dispatch(s, ctor, api_cls, session, args))
 File "/usr/lib64/python2.6/site-packages/xen/xend/XendAPI.py", line 170, in 
   result = ctor(xenapi, session, *args)
 File "/usr/lib64/python2.6/site-packages/xen/xend/XendAPI.py", line 237, in f
   return func(self, *args, **kwargs)
 File "/usr/lib64/python2.6/site-packages/xen/xend/XendAPI.py", line 272, in 
   return func(self, session, *args, **kwargs)
 File "/usr/lib64/python2.6/site-packages/xen/xend/XendAPI.py", line 1820, in 
   xendom.create_domain, vm_struct)
 File "/usr/lib64/python2.6/site-packages/xen/xend/XendTask.py", line 209, in 
   retval = func(*args, **kwds)
 File "/usr/lib64/python2.6/site-packages/xen/xend/XendDomain.py", line 808, in 
   raise XendError(str(e))
XendError: 'str' object has no attribute 'items'

every thing else is working OK except this call

and this is my xen version

xen_major              : 4
xen_minor              : 0
xen_extra              : .0_21091_06-0.1
xen_caps               : xen-3.0-x86_64 xen-3.0-x86_32p

what I am doing wrong here

example code that doesn't work

include_once "Zend/XmlRpc/Client.php";

       $client = new Zend_XmlRpc_Client('http://localhost:9363/');
       $service = $client->getProxy();
$result = $service->session->login_with_password($username, $password);

$session = $result['Value'];

$result= $this->service->VM->get_record($session,VMID);

$record = $result['Value'];



xen-api mailing list



Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.