[ https://issues.apache.org/jira/browse/CLOUDSTACK-4998?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Ryan Lei updated CLOUDSTACK-4998: --------------------------------- Description: >From mailing list discussion: @Ryan Lei says: 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]~# Here's the assignVirtualMachine response json from log: http://apaste.info/9f1H @Sebastien Goasguen says: 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" ? was: >From mailing list discussion: [~ryanleitaiwan] says: 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]~# Here's the assignVirtualMachine response json from log: http://apaste.info/9f1H [~sebgoa] says: 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" ? > assignVirtualMachine API has wrong response string, causing Cloudmonkey to > crash > -------------------------------------------------------------------------------- > > Key: CLOUDSTACK-4998 > URL: https://issues.apache.org/jira/browse/CLOUDSTACK-4998 > Project: CloudStack > Issue Type: Bug > Security Level: Public(Anyone can view this level - this is the > default.) > Components: API, Cloudmonkey > Affects Versions: 4.2.0 > Environment: CloudStack 4.2.0, XenServer 6.2, Cloudmonkey 5.0.0 > Reporter: Ryan Lei > Fix For: 4.2.1, 4.3.0 > > > From mailing list discussion: > @Ryan Lei says: > 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]~# > Here's the assignVirtualMachine response json from log: > http://apaste.info/9f1H > @Sebastien Goasguen says: > 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" ? -- This message was sent by Atlassian JIRA (v6.1#6144)