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.

        Activity

        Hide
        githubbot ASF GitHub Bot added a comment -

        Github user asfgit closed the pull request at:

        https://github.com/apache/libcloud/pull/514

        Show
        githubbot ASF GitHub Bot added a comment - Github user asfgit closed the pull request at: https://github.com/apache/libcloud/pull/514
        Hide
        githubbot ASF GitHub Bot added a comment -

        GitHub user chrisob opened a pull request:

        https://github.com/apache/libcloud/pull/514

        LIBCLOUD-707 Fixed exception when parsing CloudSigma static IPs

        Fixes issue with CloudSigma compute driver: https://issues.apache.org/jira/browse/LIBCLOUD-707

        You can merge this pull request into a Git repository by running:

        $ git pull https://github.com/chrisob/libcloud LIBCLOUD-707_cloudsigma_response_parsing_fix

        Alternatively you can review and apply these changes as the patch at:

        https://github.com/apache/libcloud/pull/514.patch

        To close this pull request, make a commit to your master/trunk branch
        with (at least) the following in the commit message:

        This closes #514


        commit 2a48a10f262f18c9e107b050dee464a9bae73886
        Author: Chris O'Brien <chrisob91@gmail.com>
        Date: 2015-05-13T11:14:07Z

        LIBCLOUD-707 Fixed exception when parsing CloudSigma static IPs


        Show
        githubbot ASF GitHub Bot added a comment - GitHub user chrisob opened a pull request: https://github.com/apache/libcloud/pull/514 LIBCLOUD-707 Fixed exception when parsing CloudSigma static IPs Fixes issue with CloudSigma compute driver: https://issues.apache.org/jira/browse/LIBCLOUD-707 You can merge this pull request into a Git repository by running: $ git pull https://github.com/chrisob/libcloud LIBCLOUD-707 _cloudsigma_response_parsing_fix Alternatively you can review and apply these changes as the patch at: https://github.com/apache/libcloud/pull/514.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #514 commit 2a48a10f262f18c9e107b050dee464a9bae73886 Author: Chris O'Brien <chrisob91@gmail.com> Date: 2015-05-13T11:14:07Z LIBCLOUD-707 Fixed exception when parsing CloudSigma static IPs

          People

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

            Dates

            • Created:
              Updated:
              Resolved:

              Development