

def _to_node(self, element):
    started = findtext(element, 'started', TYPES_URN)
    status = self._to_status(element.find(fixxpath('progress', TYPES_URN)))
    dd_state = findtext(element, 'state', TYPES_URN)
    node_state = self._get_node_state(dd_state, started, status.action)
    has_network_info = (element.find(fixxpath('networkInfo', TYPES_URN)) is not None)
    cpu_spec = self._to_cpu_spec(element.find(fixxpath('cpu', TYPES_URN)))
    disks = self._to_disks(element)
    vmware_tools = self._to_vmware_tools(element.find(fixxpath('vmwareTools', TYPES_URN)))
    extra = {
        'description': findtext(element, 'description', TYPES_URN),
        'sourceImageId': findtext(element, 'sourceImageId', TYPES_URN),
        'networkId': findtext(element, 'networkId', TYPES_URN),
        'networkDomainId': (element.find(fixxpath('networkInfo', TYPES_URN)).get('networkDomainId') if has_network_info else None),
        'datacenterId': element.get('datacenterId'),
        'deployedTime': findtext(element, 'createTime', TYPES_URN),
        'cpu': cpu_spec,
        'memoryMb': (int(findtext(element, 'memoryGb', TYPES_URN)) * 1024),
        'OS_id': element.find(fixxpath('operatingSystem', TYPES_URN)).get('id'),
        'OS_type': element.find(fixxpath('operatingSystem', TYPES_URN)).get('family'),
        'OS_displayName': element.find(fixxpath('operatingSystem', TYPES_URN)).get('displayName'),
        'status': status,
        'disks': disks,
        'vmWareTools': vmware_tools,
    }
    public_ip = findtext(element, 'publicIpAddress', TYPES_URN)
    private_ip = (element.find(fixxpath('networkInfo/primaryNic', TYPES_URN)).get('privateIpv4') if has_network_info else element.find(fixxpath('nic', TYPES_URN)).get('privateIpv4'))
    extra['ipv6'] = (element.find(fixxpath('networkInfo/primaryNic', TYPES_URN)).get('ipv6') if has_network_info else element.find(fixxpath('nic', TYPES_URN)).get('ipv6'))
    n = Node(id=element.get('id'), name=findtext(element, 'name', TYPES_URN), state=node_state, public_ips=([public_ip] if (public_ip is not None) else []), private_ips=([private_ip] if (private_ip is not None) else []), driver=self.connection.driver, extra=extra)
    return n

dataset/ETHPy150Open apache/libcloud/libcloud/compute/drivers/dimensiondata.py DimensionDataNodeDriver._to_node/original