dimgal1 commented on a change in pull request #1558:
URL: https://github.com/apache/libcloud/pull/1558#discussion_r628925818



##########
File path: libcloud/compute/drivers/cloudsigma.py
##########
@@ -1914,15 +2124,47 @@ def _parse_ips_from_nic(self, nic):
         return public_ips, private_ips
 
     def _to_node(self, data):
-        extra_keys = ['cpu', 'mem', 'nics', 'vnc_password', 'meta']
-
         id = data['uuid']
         name = data['name']
         state = self.NODE_STATE_MAP.get(data['status'], NodeState.UNKNOWN)
 
         public_ips = []
         private_ips = []
-        extra = self._extract_values(obj=data, keys=extra_keys)
+        extra = {
+            'cpus': data['cpu'] / 2000,
+            'memory': data['mem'] / 1024 / 1024,
+            'nics': data['nics'],
+            'vnc_password': data['vnc_password'],
+            'meta': data['meta'],
+            'runtime': data['runtime'],
+            'drives': data['drives'],
+        }
+        # find image name and boot drive size
+        image = None
+        drive_size = 0
+        for item in extra['drives']:
+            if item['boot_order'] == 1:
+                drive = self.ex_get_drive(item['drive']['uuid'])
+                drive_size = drive.size
+                image = '{} {}'.format(drive.extra.get('distribution', ''),
+                                       drive.extra.get('version', ''))
+                break
+        # try to find if node size is from example sizes given by CloudSigma

Review comment:
       I used a dictionary as you said, now we could remove completely 
`INSTANCE_TYPES` and use only the new dictionary's values to list sizes as they 
are basically the same. Let me know what you think.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to