cloudstack-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sebgoa <run...@gmail.com>
Subject Re: [Cloudmonkey] assignVirtualMachine API causes index out of range error
Date Fri, 08 Nov 2013 09:40:40 GMT

On Nov 8, 2013, at 10:29 AM, Ryan Lei <ryanlei@cht.com.tw> wrote:

> Super. The Cloudmonkey crash is fixed now. Thanks a a lot, Sebastien!!
> 
> You are right about this line:
> - response.setResponseName(DeployVMCmd.getResultObjectName());
> + response.setResponseName(getCommandName());
> 
> Please also commit this change to master.
> 

great thanks for testing it, I applied it to master.
Can you close the bug please.

> -------------------------------------------------------------------------------------------
> Yu-Heng (Ryan) Lei, Associate Researcher
> Chunghwa Telecom Laboratories / Cloud Computing Laboratory
> ryanlei@cht.com.tw or ryanlei750328@gmail.com
> 
> 
> 
> On Fri, Nov 8, 2013 at 4:50 PM, Sebastien Goasguen <runseb@gmail.com> wrote:
> 
>> Ryan,
>> 
>> I found another bug in that class, can you try again with a fresh pull of
>> 4.2 branch ?
>> 
>> thanks
>> 
>> On Nov 8, 2013, at 3:40 AM, Sebastien Goasguen <runseb@gmail.com> wrote:
>> 
>>> Can you get on IRC ?
>>> 
>>> On Nov 8, 2013, at 3:27 AM, Ryan Lei <ryanlei@cht.com.tw> wrote:
>>> 
>>>> Finally got a new environment to build from source code (4.2 branch).
>>>> Unfortunately, it still crashes Cloudmonkey. The error messages are
>> exactly
>>>> the same. Here's the new Cloudmonkey log:
>>>> 
>>>> 2013-11-08 16:15:34,242 - requester.py:45 - [DEBUG] ======== START
>> Request
>>>> ========
>>>> 2013-11-08 16:15:34,242 - requester.py:45 - [DEBUG] Requesting
>>>> command=assignVirtualMachine, args={'account': 'user', 'domainid':
>>>> 'e55f7756-4842-11e3-a696-f6180bef7a51', 'virtualmachineid':
>>>> 'd4da5cd7-9f68-4fd0-beda-c285e432911d'}
>>>> 2013-11-08 16:15:34,243 - requester.py:45 - [DEBUG] Request sent:
>>>> 
>> http://localhost:8080/client/api?account=user&apiKey=Jxqh9fiJhBVaXHoBKSvNvqhYl3j-qNW_04kDoyW27RgZMiJe0pduFfUuRP8cPnOEAFZnyIrrGoZaVUubWk9JQQ&command=assignVirtualMachine&domainid=e55f7756-4842-11e3-a696-f6180bef7a51&response=json&virtualmachineid=d4da5cd7-9f68-4fd0-beda-c285e432911d&signature=opZc9bQmW34AN1OcVps%2Fxb%2BKtVU%3D
>>>> 2013-11-08 16:15:34,488 - requester.py:45 - [DEBUG] Response received: {
>>>> "virtualmachine" :  { "virtualmachine" :
>>>> 
>> {"id":"d4da5cd7-9f68-4fd0-beda-c285e432911d","name":"assignVM-API","displayname":"assignVM-API","account":"user","domainid":"e55f7756-4842-11e3-a696-f6180bef7a51","domain":"ROOT","created":"2013-11-08T16:08:58+0800","state":"Stopping","haenable":false,"zoneid":"0c1268f1-efda-42a8-80a7-5e7d2a6aaf0a","zonename":"Zone","hostid":"24f982b3-3a9a-4fb5-ba78-9e44c04a2e39","hostname":"xenserver-205-15","templateid":"91050f5c-3212-4412-85d1-0035a0f754ef","templatename":"CentOS-6.4-x86_64-XS62","templatedisplaytext":"CentOS-6.4-x86_64-XS62","passwordenabled":false,"serviceofferingid":"1c081f6f-fa14-4db3-b5ec-34c203f6b9b5","serviceofferingname":"Medium
>>>> 
>> Instance","cpunumber":1,"cpuspeed":1000,"memory":1024,"cpuused":"0.01%","networkkbsread":0,"networkkbswrite":1,"diskkbsread":0,"diskkbswrite":0,"diskioread":0,"diskiowrite":0,"guestosid":"e4f94c9c-4842-11e3-a696-f6180bef7a51","rootdeviceid":0,"rootdevicetype":"ROOT","securitygroup":[],"nic":[{"id":"c18c7ef0-061f-404c-baab-4ffd585cbfec","networkid":"26642bfa-a037-40a0-bcaf-81aded2a4cf4","networkname":"user-1","netmask":"255.255.255.0","gateway":"10.1.1.1","ipaddress":"10.1.1.228","isolationuri":"vlan://850","broadcasturi":"vlan://850","traffictype":"Guest","type":"Isolated","isdefault":true,"macaddress":"02:00:47:3e:00:03"}],"hypervisor":"XenServer","instancename":"i-2-8-VM","tags":[],"affinitygroup":[],"displayvm":true,"isdynamicallyscalable":true,"details":{"hypervisortoolsversion":"xenserver56"},"jobid":"d9368add-bc64-45f7-83a7-de498cef730b","jobstatus":0}
>>>> }  }
>>>> 2013-11-08 16:15:34,488 - requester.py:45 - [DEBUG] ======== END Request
>>>> ========
>>>> 
>>>> Hence, I'm reopening the ticket:
>>>> https://issues.apache.org/jira/browse/CLOUDSTACK-4998
>>>> 
>>>> 
>>>> 
>> -------------------------------------------------------------------------------------------
>>>> Yu-Heng (Ryan) Lei, Associate Researcher
>>>> Chunghwa Telecom Laboratories / Cloud Computing Laboratory
>>>> ryanlei@cht.com.tw or ryanlei750328@gmail.com
>>>> 
>>>> 
>>>> 
>>>> On Wed, Oct 30, 2013 at 4:11 PM, Sebastien Goasguen <runseb@gmail.com
>>> wrote:
>>>> 
>>>>> 
>>>>> On Oct 30, 2013, at 2:40 AM, Ryan Lei <ryanlei@cht.com.tw> wrote:
>>>>> 
>>>>>> Ticket created:
>>>>>> https://issues.apache.org/jira/browse/CLOUDSTACK-4998
>>>>>> 
>>>>> 
>>>>> Ryan, I fixed it in master and 4.2. Any chance you can compile from
>> source
>>>>> and check again ?
>>>>> 
>>>>> thanks
>>>>> 
>>>>> 
>>>>>> 
>>>>> 
>> -------------------------------------------------------------------------------------------
>>>>>> Yu-Heng (Ryan) Lei, Associate Researcher
>>>>>> Chunghwa Telecom Laboratories / Cloud Computing Laboratory
>>>>>> ryanlei@cht.com.tw<
>>>>> 
>> https://email.cht.com.tw/owa/redir.aspx?C=-wE1FEC3G0SWYpVkiWo8SsDdf3ZqO9AIuAPTzRnFYCUi-z4YljtI_hyVKkNHfn9F1Bn-vUWJnQ4.&URL=mailto%3aryanlei%40cht.com.tw
>>>>>> 
>>>>>> or
>>>>>> ryanlei750328@gmail.com
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> On Wed, Oct 30, 2013 at 2:04 PM, Rohit Yadav <bhaisaab@apache.org>
>>>>> wrote:
>>>>>> 
>>>>>>> On Mon, Oct 28, 2013 at 1:52 PM, Sebastien Goasguen <
>> runseb@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 <ryanlei@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
>>>>>>>>> ryanlei@cht.com.tw<
>>>>>>>> 
>>>>>>> 
>>>>> 
>> https://email.cht.com.tw/owa/redir.aspx?C=-wE1FEC3G0SWYpVkiWo8SsDdf3ZqO9AIuAPTzRnFYCUi-z4YljtI_hyVKkNHfn9F1Bn-vUWJnQ4.&URL=mailto%3aryanlei%40cht.com.tw
>>>>>>>>> 
>>>>>>>>> or
>>>>>>>>> ryanlei750328@gmail.com
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> On Fri, Oct 25, 2013 at 7:02 PM, Rohit Yadav <bhaisaab@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 <ryanlei@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
>>>>>>>>>>> ryanlei@cht.com.tw<
>>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>> 
>>>>>>> 
>>>>> 
>> https://email.cht.com.tw/owa/redir.aspx?C=-wE1FEC3G0SWYpVkiWo8SsDdf3ZqO9AIuAPTzRnFYCUi-z4YljtI_hyVKkNHfn9F1Bn-vUWJnQ4.&URL=mailto%3aryanlei%40cht.com.tw
>>>>>>>>>>>> 
>>>>>>>>>>> or
>>>>>>>>>>> ryanlei750328@gmail.com
>>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>> 
>>>>>>>> 
>>>>>>> 
>>>>> 
>>>>> 
>>> 
>> 
>> 


Mime
View raw message