Uploaded image for project: 'Libcloud'
  1. Libcloud
  2. LIBCLOUD-707

CloudSigma driver throws exception when parsing response in list_nodes

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 0.14.0-beta3, 0.13.3, 0.15.0, 0.15.1
    • Fix Version/s: None
    • Component/s: Compute
    • Labels:
      None

      Description

      While attempting to parse the IPs from a node's NICs in CloudSigma's API response, libcloud throws an exception when the node's IP is static:

      TypeError: unhashable type: 'dict'
      File "/home/dbs_support/dev/libcloudsigma/test.py", line 55, in <module>
        instances = deployer.getInstances()
      File "/home/dbs_support/dev/libcloudsigma/test.py", line 44, in getInstances
        return self.driver.list_nodes()
      File "/home/dbs_support/lib/libcloud/compute/drivers/cloudsigma.py", line 1026, in list_nodes
        nodes = [self._to_node(data=item) for item in response['objects']]
      File "/home/dbs_support/lib/libcloud/compute/drivers/cloudsigma.py", line 1910, in _to_node
        _public_ips, _private_ips = self._parse_ips_from_nic(nic=nic)
      File "/home/dbs_support/lib/libcloud/compute/drivers/cloudsigma.py", line 1888, in _parse_ips_from_nic
        ips = set(ips)
      

      It seems that libcloud doesn't account for CloudSigma's response for static IPs containing the 'uuid' as a subobject of 'ip' in the 'ip_v4_conf' for a NIC.
      For example, a NIC with a static IP belonging to a server:

      {
          "firewall_policy":null,
          "boot_order":null,
          "vlan":null,
          "ip_v4_conf":{
              "ip":{
                  "uuid":"178.22.68.44",
                  "resource_uri":"/api/2.0/ips/178.22.68.44/"
              },
              "conf":"static"
          },
          "mac":"22:9d:42:9d:30:2f",
          "model":"virtio",
          "runtime":{
              "interface_type":"public",
              "ip_v4":{
                  "uuid":"178.22.68.44",
                  "resource_uri":"/api/2.0/ips/178.22.68.44/"
              },
              "io":{
                  "bytes_sent":403849752,
                  "packets_sent":6089897,
                  "bytes_recv":1348149166,
                  "packets_recv":1144445
              },
              "ip_v6":null
          },
          "ip_v6_conf":null
      }
      

      The NIC's ['ip_v4_conf']['ip'] object (which is a dict) gets put into a list (ips) with other strings (representing IPs). It chokes when attempting to convert this list containing both dicts and strings into a set.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              chrisob Chris O'Brien
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: