Bruno Mahé created LIBCLOUD-219:
-----------------------------------

             Summary: Libcloud should not always set up a network id when 
creating a node
                 Key: LIBCLOUD-219
                 URL: https://issues.apache.org/jira/browse/LIBCLOUD-219
             Project: Libcloud
          Issue Type: Bug
          Components: Compute
            Reporter: Bruno Mahé


I am using libcloud from trunk and here is what I get when I try to create a 
node:
{noformat}
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"}}        
{noformat}

But when doing the following modification, I can get it working:
{noformat}
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',
{noformat}

I am not familiar enough with cloudstack to tell when the network_id should or 
should not be passed.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira


Reply via email to