Return-Path: X-Original-To: apmail-cloudstack-dev-archive@www.apache.org Delivered-To: apmail-cloudstack-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 5CC6E105AB for ; Mon, 28 Oct 2013 03:02:41 +0000 (UTC) Received: (qmail 72855 invoked by uid 500); 28 Oct 2013 03:02:37 -0000 Delivered-To: apmail-cloudstack-dev-archive@cloudstack.apache.org Received: (qmail 72820 invoked by uid 500); 28 Oct 2013 03:02:36 -0000 Mailing-List: contact dev-help@cloudstack.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cloudstack.apache.org Delivered-To: mailing list dev@cloudstack.apache.org Received: (qmail 72801 invoked by uid 99); 28 Oct 2013 03:02:35 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 28 Oct 2013 03:02:35 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of ryanleicloudstack@gmail.com designates 209.85.220.169 as permitted sender) Received: from [209.85.220.169] (HELO mail-vc0-f169.google.com) (209.85.220.169) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 28 Oct 2013 03:02:31 +0000 Received: by mail-vc0-f169.google.com with SMTP id hu8so1746331vcb.28 for ; Sun, 27 Oct 2013 20:02:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:content-type; bh=Rje1f46Iz9hILjHu1b622dmt2NcPsxFJ54cJDewpUwU=; b=fg/czn/aeiK49nB11xbeYnPsfqTBP5xsQ2Cofoa3U4qL7j9B9plzMReS7TNCxQUR/L h0Wv5cKrtJN2ozMW/OsBlwyS70jKt0VdhJtgDX4Q2ADSfjKypcD+sW2ktUHN5YRDih+O VrpYUe/RefifQg1+m6HQIumvz9knN6GYZsduWBeuWYC5Mj0zMb20WkEH8F+fzdeN843j Wej65aPd9aBRKLvnTcv0RgWo4AdNQRHq8ssL0hgPQ7wM8sDu29neMt0IP5PoVt+yyvWk oKmDovF/HBFPHzRLT8nXqu+MFS92jw838RZxenVm/5OlUcKY+gWQRdxDlWEi7evuYd/b 11WQ== MIME-Version: 1.0 X-Received: by 10.58.208.130 with SMTP id me2mr11689687vec.13.1382929330028; Sun, 27 Oct 2013 20:02:10 -0700 (PDT) Sender: ryanlei750328@gmail.com X-Google-Sender-Delegation: ryanlei750328@gmail.com Received: by 10.58.252.10 with HTTP; Sun, 27 Oct 2013 20:02:09 -0700 (PDT) In-Reply-To: References: Date: Mon, 28 Oct 2013 11:02:09 +0800 X-Google-Sender-Auth: fsIP3gOL2xY3SgaFRzpm3p1bVWY Message-ID: Subject: Re: [Cloudmonkey] assignVirtualMachine API causes index out of range error From: Ryan Lei To: "dev@cloudstack.apache.org" Content-Type: multipart/alternative; boundary=047d7bdc192c77490504e9c45376 X-Virus-Checked: Checked by ClamAV on apache.org --047d7bdc192c77490504e9c45376 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Here's the assignVirtualMachine response json from log: 2013-10-25 17:02:54,107 - cloudmonkey.py:83 - [DEBUG] Loaded config fields: ['cache_file=3D/root/.cloudmonkey/cache', 'log_file=3D/root/.cloudmonkey/log', 'asyncblock=3Dtrue', 'paramcompletion=3Dfalse', 'history_file=3D/root/.cloudmonkey/history', 'color=3Dtrue', 'prompt=3D> ', 'display=3Dtable', 'secretkey=3DwOV6_F8BZXxXV0zfX_DLVscCtbGrZgV3h8AcWfQLIa-OBCddLJimXTIQaM9hFH= 5ggItwwIFcivjJ77zn7LjWCQ', 'apikey=3DKbvOOFTETTNL8RbmSmA0d-zOw8BxRW1msmKTVj_2T8b42KrpMb5DoVwNrc2aKRonF= FTZ7W6GsSeL2hvReek4WA', 'path=3D/client/api', 'host=3Dlocalhost', 'protocol=3Dhttp', 'port=3D8080', 'timeout=3D3600'] 2013-10-25 17:03:19,839 - requester.py:45 - [DEBUG] =3D=3D=3D=3D=3D=3D=3D= =3D START Request =3D=3D=3D=3D=3D=3D=3D=3D 2013-10-25 17:03:19,840 - requester.py:45 - [DEBUG] Requesting command=3DassignVirtualMachine, args=3D{'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=3Ddomain1-user2&apiKey=3DKbvOOFTET= TNL8RbmSmA0d-zOw8BxRW1msmKTVj_2T8b42KrpMb5DoVwNrc2aKRonFFTZ7W6GsSeL2hvReek4= WA&command=3DassignVirtualMachine&domainid=3Dcfc19b03-0858-4f39-9058-e0b676= 85bc2f&response=3Djson&virtualmachineid=3D939f1c53-91e8-47a1-92d1-9ec9c2c18= 02c&signature=3Dgcqky6emSpV08QHZuavLZFS6Pcg%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","displa= yname":"domain1-admin","account":"domain1-user2","domainid":"cfc19b03-0858-= 4f39-9058-e0b67685bc2f","domain":"domain1","created":"2013-10-25T15:15:03+0= 800","state":"Stopped","haenable":false,"zoneid":"6e0b2791-513e-49be-bbd8-6= 2c2597640ef","zonename":"Zone-Xen","templateid":"855b7915-9739-4ad7-945e-8b= 8514040198","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%","network= kbsread":0,"networkkbswrite":1,"diskkbsread":0,"diskkbswrite":0,"diskioread= ":0,"diskiowrite":0,"guestosid":"f70b6aaa-37da-11e3-9cb9-46ca9f9b4d97","roo= tdeviceid":0,"rootdevicetype":"ROOT","securitygroup":[],"nic":[{"id":"2f2a6= ff3-ab11-4127-8991-2813a9a1c3ba","networkid":"aad53b98-3a6c-4cd3-a1e3-cbb84= 834d8c1","networkname":"domain1-user2-network","netmask":"255.255.255.0","g= ateway":"10.1.1.1","ipaddress":"10.1.1.204","traffictype":"Guest","type":"I= solated","isdefault":true,"macaddress":"02:00:17:61:00:01"}],"hypervisor":"= XenServer","tags":[],"affinitygroup":[],"displayvm":true,"isdynamicallyscal= able":true} } } 2013-10-25 17:03:20,108 - requester.py:45 - [DEBUG] =3D=3D=3D=3D=3D=3D=3D= =3D END Request =3D=3D=3D=3D=3D=3D=3D=3D 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 or ryanlei750328@gmail.com On Fri, Oct 25, 2013 at 7:02 PM, Rohit Yadav 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 i= f > you're allowed to call the API as different user groups can have access t= o > different set of APIs. > > Cheers. > > > On Fri, Oct 25, 2013 at 2:27 PM, Ryan Lei 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=3D7fe548bb-b2a7-4aec-92c5-5012ef9fd4f4 > account=3Ddomain1-user1 > > domainid=3Dcfc19b03-0858-4f39-9058-e0b67685bc2f > > Traceback (most recent call last): > > File "/usr/bin/cloudmonkey", line 9, in > > load_entry_point('cloudmonkey=3D=3D5.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=3D"") > > File "/usr/lib64/python2.6/cmd.py", line 142, in cmdloop > > stop =3D 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 =3D 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 =3D 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 th= is > > 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=3D-wE1FEC3G0SWYpVkiWo8SsDdf3ZqO= 9AIuAPTzRnFYCUi-z4YljtI_hyVKkNHfn9F1Bn-vUWJnQ4.&URL=3Dmailto%3aryanlei%40ch= t.com.tw > > > > > or > > ryanlei750328@gmail.com > > > --047d7bdc192c77490504e9c45376--