WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-api

[Xen-API] Creating a VM from a record

To: xen-api@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-API] Creating a VM from a record
From: mftahy <mofta7y@xxxxxxxxx>
Date: Mon, 31 Jan 2011 22:39:58 -0500
Delivery-date: Mon, 31 Jan 2011 19:41:48 -0800
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:message-id:date:from:user-agent:mime-version:to :subject:content-type:content-transfer-encoding; bh=Qpx3s5dV6oX8iYv8JnlJfMlytNCFDLi9UdOFU7+kU4A=; b=w0vISIzzglpgw+XWhFkaPJ52G9h5XkI2OmgYXT5b0oHoMjjJ5YcG4741w0XOTuwgYs Pg8UteKX+CndyJZ9MKcN0yqEOhbne7apAQIXpDPN7/H76iDPIrSU3xWrZ9zf+omMOQfP thiZR9XKceT5wfkS91nJxOz6mpmX5R+t96bBs=
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=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-api-request@lists.xensource.com?subject=help>
List-id: Discussion of API issues surrounding Xen <xen-api.lists.xensource.com>
List-post: <mailto:xen-api@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-api>, <mailto:xen-api-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-api>, <mailto:xen-api-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-api-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Thunderbird 2.0.0.24 (X11/20101027)
Hi


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

Array
(
   [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 
_marshaled_dispatch
   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 
<lambda>
   wrapped_f = (lambda *args: new_f(f, *args))
 File "/usr/lib64/python2.6/site-packages/xen/xend/XendAPI.py", line 672, in 
<lambda>
   _ctor_event_dispatch(s, ctor, api_cls, session, args))
 File "/usr/lib64/python2.6/site-packages/xen/xend/XendAPI.py", line 170, in 
_ctor_event_dispatch
   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 
check_session
   return func(self, session, *args, **kwargs)
 File "/usr/lib64/python2.6/site-packages/xen/xend/XendAPI.py", line 1820, in 
VM_create
   xendom.create_domain, vm_struct)
 File "/usr/lib64/python2.6/site-packages/xen/xend/XendTask.py", line 209, in 
log_progress
   retval = func(*args, **kwds)
 File "/usr/lib64/python2.6/site-packages/xen/xend/XendDomain.py", line 808, in 
create_domain
   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/');
       $client->setSkipSystemLookup(true);
       $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'];

$this->service->VM->create($session,$record);



thanks



_______________________________________________
xen-api mailing list
xen-api@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/mailman/listinfo/xen-api

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-API] Creating a VM from a record, mftahy <=