Description
I am using libcloud from trunk and here is what I get when I try to create a node:
Creating node Bigtop-4-test-13 Traceback (most recent call last): File "/home/bruno/cloudstack.py", line 35, in <module> main() File "/home/bruno/cloudstack.py", line 32, in main node = cs.create_node( 'Bigtop-4-test-' + str(num), sizes[image_size], images[image_name]) File "/home/bruno/freesoftware/libcloud/libcloud/compute/drivers/cloudstack.py", line 239, in create_node **extra_args File "/home/bruno/freesoftware/libcloud/libcloud/common/cloudstack.py", line 122, in _async_request return self.connection._async_request(command, **kwargs) File "/home/bruno/freesoftware/libcloud/libcloud/common/cloudstack.py", line 70, in _async_request context=context) File "/home/bruno/freesoftware/libcloud/libcloud/common/base.py", line 690, in async_request response = request(**kwargs) File "/home/bruno/freesoftware/libcloud/libcloud/common/cloudstack.py", line 96, in _sync_request result = self.request(self.driver.path, params=kwargs) File "/home/bruno/freesoftware/libcloud/libcloud/common/base.py", line 583, in request connection=self) File "/home/bruno/freesoftware/libcloud/libcloud/common/base.py", line 76, in __init__ raise Exception(self.parse_error()) Exception: {'deployvirtualmachineresponse': {'errorcode': 431, 'uuidList': [], 'errortext': "Can't specify network Ids in Basic zone"}}
But when doing the following modification, I can get it working:
diff --git a/libcloud/compute/drivers/cloudstack.py b/libcloud/compute/drivers/cloudstack.py index e8a0012..f80ab56 100644 --- a/libcloud/compute/drivers/cloudstack.py +++ b/libcloud/compute/drivers/cloudstack.py @@ -222,12 +222,7 @@ class CloudStackNodeDriver(CloudStackDriverMixIn, NodeDriver): location = self.list_locations()[0] network_id = kwargs.pop('network_id', None) - if network_id is None: - networks = self._sync_request('listNetworks') - - if networks: - extra_args['networkids'] = networks['network'][0]['id'] - else: + if network_id is not None: extra_args['networkids'] = network_id result = self._async_request('deployVirtualMachine',
I am not familiar enough with cloudstack to tell when the network_id should or should not be passed.