On Mon, Oct 28, 2013 at 1:52 PM, Sebastien Goasguen <run...@gmail.com>wrote:

> I think the error is in the java code of AssignVirtualMachine:
> api/src/org/apache/cloudstack/api/command/admin/vm/AssignVMCmd.java:
>
> @APICommand(name = "assignVirtualMachine", description="Change ownership
> of a VM from one account to another. This API is available for Basic zones
> with security groups and Advanced zones with guest networks. A root
> administrator can reassign a VM from any account to any other account in
> any domain. A domain administrator can reassign a VM to any account in the
> same domain.", responseObject=UserVmResponse.class, since="3.0.0")
> public class AssignVMCmd extends BaseCmd  {
>     public static final Logger s_logger =
> Logger.getLogger(AssignVMCmd.class.getName());
>
>    private static final String s_name = "moveuservmresponse";
>
>
> Shouldn't the string be "assignvirtualmachineresponse" ?
>

Thanks Ryan for the output, Sebastien is right the response string of
AssignVMCmd
should be fixed. Please open a bug ticket, patch contributions are most
welcome :)

Regards.


>
> On Oct 27, 2013, at 11:02 PM, Ryan Lei <ryan...@cht.com.tw> wrote:
>
> > Here's the assignVirtualMachine response json from log:
> >
> > 2013-10-25 17:02:54,107 - cloudmonkey.py:83 - [DEBUG] Loaded config
> fields:
> > ['cache_file=/root/.cloudmonkey/cache',
> > 'log_file=/root/.cloudmonkey/log', 'asyncblock=true',
> > 'paramcompletion=false', 'history_file=/root/.cloudmonkey/history',
> > 'color=true', 'prompt=> ', 'display=table',
> >
> 'secretkey=wOV6_F8BZXxXV0zfX_DLVscCtbGrZgV3h8AcWfQLIa-OBCddLJimXTIQaM9hFH5ggItwwIFcivjJ77zn7LjWCQ',
> >
> 'apikey=KbvOOFTETTNL8RbmSmA0d-zOw8BxRW1msmKTVj_2T8b42KrpMb5DoVwNrc2aKRonFFTZ7W6GsSeL2hvReek4WA',
> > 'path=/client/api', 'host=localhost', 'protocol=http', 'port=8080',
> > 'timeout=3600']
> >
> > 2013-10-25 17:03:19,839 - requester.py:45 - [DEBUG] ======== START
> > Request ========
> > 2013-10-25 17:03:19,840 - requester.py:45 - [DEBUG] Requesting
> > command=assignVirtualMachine, args={'account': 'domain1-user2',
> > 'domainid': 'cfc19b03-0858-4f39-9058-e0b67685bc2f',
> > 'virtualmachineid': '939f1c53-91e8-47a1-92d1-9ec9c2c1802c'}
> > 2013-10-25 17:03:19,841 - requester.py:45 - [DEBUG] Request sent:
> >
> http://localhost:8080/client/api?account=domain1-user2&apiKey=KbvOOFTETTNL8RbmSmA0d-zOw8BxRW1msmKTVj_2T8b42KrpMb5DoVwNrc2aKRonFFTZ7W6GsSeL2hvReek4WA&command=assignVirtualMachine&domainid=cfc19b03-0858-4f39-9058-e0b67685bc2f&response=json&virtualmachineid=939f1c53-91e8-47a1-92d1-9ec9c2c1802c&signature=gcqky6emSpV08QHZuavLZFS6Pcg%3D
> >
> > 2013-10-25 17:03:20,107 - requester.py:45 - [DEBUG] Response received:
> > { "virtualmachine" :  { "virtualmachine" :
> >
> {"id":"939f1c53-91e8-47a1-92d1-9ec9c2c1802c","name":"domain1-admin","displayname":"domain1-admin","account":"domain1-user2","domainid":"cfc19b03-0858-4f39-9058-e0b67685bc2f","domain":"domain1","created":"2013-10-25T15:15:03+0800","state":"Stopped","haenable":false,"zoneid":"6e0b2791-513e-49be-bbd8-62c2597640ef","zonename":"Zone-Xen","templateid":"855b7915-9739-4ad7-945e-8b8514040198","templatename":"CentOS-6.4-x86_64
> > (scalable)","templatedisplaytext":"CentOS-6.4-x86_64
> >
> (scalable)","passwordenabled":false,"serviceofferingid":"32f7668c-5edd-4152-b927-c7b744281dc2","serviceofferingname":"Small
> >
> Instance","cpunumber":1,"cpuspeed":500,"memory":512,"cpuused":"0%","networkkbsread":0,"networkkbswrite":1,"diskkbsread":0,"diskkbswrite":0,"diskioread":0,"diskiowrite":0,"guestosid":"f70b6aaa-37da-11e3-9cb9-46ca9f9b4d97","rootdeviceid":0,"rootdevicetype":"ROOT","securitygroup":[],"nic":[{"id":"2f2a6ff3-ab11-4127-8991-2813a9a1c3ba","networkid":"aad53b98-3a6c-4cd3-a1e3-cbb84834d8c1","networkname":"domain1-user2-network","netmask":"255.255.255.0","gateway":"10.1.1.1","ipaddress":"10.1.1.204","traffictype":"Guest","type":"Isolated","isdefault":true,"macaddress":"02:00:17:61:00:01"}],"hypervisor":"XenServer","tags":[],"affinitygroup":[],"displayvm":true,"isdynamicallyscalable":true}
> > }  }
> > 2013-10-25 17:03:20,108 - requester.py:45 - [DEBUG] ======== END
> > Request ========
> >
> >
> > I'm using Cloudmonkey from git (corresponding to 5.0.0), and I have tried
> > using root admin and domain admin to call this API. Both turned out to
> > succeed but crash Cloudmonkey.
> >
> >
> -------------------------------------------------------------------------------------------
> > Yu-Heng (Ryan) Lei, Associate Researcher
> > Chunghwa Telecom Laboratories / Cloud Computing Laboratory
> > ryan...@cht.com.tw<
> https://email.cht.com.tw/owa/redir.aspx?C=-wE1FEC3G0SWYpVkiWo8SsDdf3ZqO9AIuAPTzRnFYCUi-z4YljtI_hyVKkNHfn9F1Bn-vUWJnQ4.&URL=mailto%3aryanlei%40cht.com.tw
> >
> > or
> > ryanlei750...@gmail.com
> >
> >
> >
> > On Fri, Oct 25, 2013 at 7:02 PM, Rohit Yadav <bhais...@apache.org>
> wrote:
> >
> >> Hi Ryan,
> >>
> >> Will check this next week, the issue is clearly with response which
> lacks a
> >> key with name 'response' in it, it could be a case issue as well. Can
> you
> >> share with us the response json from cloudmonkey's log in
> >> ~/.cloudmonkey/log, you may confirm the keys from the json. Also, check
> if
> >> you're allowed to call the API as different user groups can have access
> to
> >> different set of APIs.
> >>
> >> Cheers.
> >>
> >>
> >> On Fri, Oct 25, 2013 at 2:27 PM, Ryan Lei <ryan...@cht.com.tw> wrote:
> >>
> >>> I'm using Cloudmonkey 5.0.0 under CloudStack 4.2.0 + XenServer 6.2.
> >>> For now, the only way to change the ownership of a VM is by the
> >>> assignVirtualMachine API.
> >>>
> >>> But executing this API using Cloudmonkey leads to the following error
> >> that
> >>> crashes the program:
> >>>
> >>>> assign virtualmachine
> >>> virtualmachineid=7fe548bb-b2a7-4aec-92c5-5012ef9fd4f4
> >> account=domain1-user1
> >>> domainid=cfc19b03-0858-4f39-9058-e0b67685bc2f
> >>> Traceback (most recent call last):
> >>>  File "/usr/bin/cloudmonkey", line 9, in <module>
> >>>    load_entry_point('cloudmonkey==5.0.0', 'console_scripts',
> >>> 'cloudmonkey')()
> >>>  File
> >>>
> >>>
> >>
> "/usr/lib/python2.6/site-packages/cloudmonkey-5.0.0-py2.6.egg/cloudmonkey/cloudmonkey.py",
> >>> line 536, in main
> >>>    shell.cmdloop()
> >>>  File
> >>>
> >>>
> >>
> "/usr/lib/python2.6/site-packages/cloudmonkey-5.0.0-py2.6.egg/cloudmonkey/cloudmonkey.py",
> >>> line 106, in cmdloop
> >>>    super(CloudMonkeyShell, self).cmdloop(intro="")
> >>>  File "/usr/lib64/python2.6/cmd.py", line 142, in cmdloop
> >>>    stop = self.onecmd(line)
> >>>  File "/usr/lib64/python2.6/cmd.py", line 219, in onecmd
> >>>    return func(arg)
> >>>  File
> >>>
> >>>
> >>
> "/usr/lib/python2.6/site-packages/cloudmonkey-5.0.0-py2.6.egg/cloudmonkey/cloudmonkey.py",
> >>> line 134, in grammar_closure
> >>>    self.default("%s %s" % (cmd, args))
> >>>  File
> >>>
> >>>
> >>
> "/usr/lib/python2.6/site-packages/cloudmonkey-5.0.0-py2.6.egg/cloudmonkey/cloudmonkey.py",
> >>> line 303, in default
> >>>    result = self.make_request(apiname, args_dict, isasync)
> >>>  File
> >>>
> >>>
> >>
> "/usr/lib/python2.6/site-packages/cloudmonkey-5.0.0-py2.6.egg/cloudmonkey/cloudmonkey.py",
> >>> line 257, in make_request
> >>>    self.timeout, self.protocol, self.path)
> >>>  File
> >>>
> >>>
> >>
> "/usr/lib/python2.6/site-packages/cloudmonkey-5.0.0-py2.6.egg/cloudmonkey/requester.py",
> >>> line 121, in monkeyrequest
> >>>    responsekey = filter(lambda x: 'response' in x, response.keys())[0]
> >>> IndexError: list index out of range
> >>> [cs42]~#
> >>>
> >>> However, the account of VM DOES change successfully, checked from both
> >> the
> >>> UI and API.
> >>> And after the change, only the new VM owner and their admins and see
> this
> >>> VM.
> >>>
> >>>
> >>>
> >>
> -------------------------------------------------------------------------------------------
> >>> Yu-Heng (Ryan) Lei, Associate Researcher
> >>> Chunghwa Telecom Laboratories / Cloud Computing Laboratory
> >>> ryan...@cht.com.tw<
> >>>
> >>
> https://email.cht.com.tw/owa/redir.aspx?C=-wE1FEC3G0SWYpVkiWo8SsDdf3ZqO9AIuAPTzRnFYCUi-z4YljtI_hyVKkNHfn9F1Bn-vUWJnQ4.&URL=mailto%3aryanlei%40cht.com.tw
> >>>>
> >>> or
> >>> ryanlei750...@gmail.com
> >>>
> >>
>
>

Reply via email to