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

CloudStack driver does not take extra args in the deployVirtualMachine call

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 0.13.0
    • Component/s: Compute
    • Labels:
      None
    • Environment:

      latest libcloud trunk

      Description

      the extra args in the create_node() is an empty dictionary, therefore things like keypairs cannot be passed.

        Activity

        Hide
        sebgoa sebastien goasguen added a comment -

        Here is a "patch:

        From 2e0ab5433e78fabd150263bdf0c11e43f21e9354 Mon Sep 17 00:00:00 2001
        From: Sebastien Goasguen <runseb@gmail.com>
        Date: Thu, 23 May 2013 16:44:15 -0400
        Subject: [PATCH 2/2] LIBCLOUD-330: Fix empty extra_args dictionary in the
        create_node()


        libcloud/compute/drivers/cloudstack.py | 2 +-
        1 file changed, 1 insertion, 1 deletion

        diff --git libcloud/compute/drivers/cloudstack.py libcloud/compute/drivers/cloudstack.py
        index b64e6b8..feb59da 100644
        — libcloud/compute/drivers/cloudstack.py
        +++ libcloud/compute/drivers/cloudstack.py
        @@ -230,7 +230,7 @@ class CloudStackNodeDriver(CloudStackDriverMixIn, NodeDriver):
        @inherits: L

        {NodeDriver.create_node}

        @rtype: L

        {CloudStackNode}

        """

        • extra_args = {}
          + extra_args = kwargs
          if location is None:
          location = self.list_locations()[0]


        1.8.1.3

        Show
        sebgoa sebastien goasguen added a comment - Here is a "patch: From 2e0ab5433e78fabd150263bdf0c11e43f21e9354 Mon Sep 17 00:00:00 2001 From: Sebastien Goasguen <runseb@gmail.com> Date: Thu, 23 May 2013 16:44:15 -0400 Subject: [PATCH 2/2] LIBCLOUD-330 : Fix empty extra_args dictionary in the create_node() — libcloud/compute/drivers/cloudstack.py | 2 +- 1 file changed, 1 insertion , 1 deletion diff --git libcloud/compute/drivers/cloudstack.py libcloud/compute/drivers/cloudstack.py index b64e6b8..feb59da 100644 — libcloud/compute/drivers/cloudstack.py +++ libcloud/compute/drivers/cloudstack.py @@ -230,7 +230,7 @@ class CloudStackNodeDriver(CloudStackDriverMixIn, NodeDriver): @inherits: L {NodeDriver.create_node} @rtype: L {CloudStackNode} """ extra_args = {} + extra_args = kwargs if location is None: location = self.list_locations() [0] – 1.8.1.3
        Hide
        kami Tomaz Muraus added a comment -

        I don't like this kwargs method too much. It's not explicitly and user doesn't know what is going on and which arguments are actually being used.

        I would prefer to do one of the following:

        1. Add extra_args argument (dictionary) to the method and document which are the valid keys for this dictionary
        1. Explicitly define additional arguments which this method can take (e.g. eg_foo1=None, ex_foo1=None, ..) and build extra_args dictionary inside the method

        Show
        kami Tomaz Muraus added a comment - I don't like this kwargs method too much. It's not explicitly and user doesn't know what is going on and which arguments are actually being used. I would prefer to do one of the following: 1. Add extra_args argument (dictionary) to the method and document which are the valid keys for this dictionary 1. Explicitly define additional arguments which this method can take (e.g. eg_foo1=None, ex_foo1=None, ..) and build extra_args dictionary inside the method
        Hide
        sebgoa sebastien goasguen added a comment -

        Ok I understand, I just set it like this because extra_args was empty and never set, and kwargs never used.
        Indeed one would need to know what the valid keys are.

        Show
        sebgoa sebastien goasguen added a comment - Ok I understand, I just set it like this because extra_args was empty and never set, and kwargs never used. Indeed one would need to know what the valid keys are.
        Hide
        sebgoa sebastien goasguen added a comment -

        Do you prefer something like this:

        From a459d73477da21fe54c2c44fee1109aa800e7817 Mon Sep 17 00:00:00 2001
        From: Sebastien Goasguen <runseb@gmail.com>
        Date: Fri, 24 May 2013 05:07:14 -0400
        Subject: [PATCH] LIBCLOUD-330: handles kwargs for deploy


        libcloud/compute/drivers/cloudstack.py | 1 +
        1 file changed, 1 insertion

        diff --git libcloud/compute/drivers/cloudstack.py libcloud/compute/drivers/cloudstack.py
        index c2f2ad7..29d26d6 100644
        — libcloud/compute/drivers/cloudstack.py
        +++ libcloud/compute/drivers/cloudstack.py
        @@ -265,6 +265,7 @@ class CloudStackNodeDriver(CloudStackDriverMixIn, NodeDriver):
        'zoneid': location.id,
        'ip_addresses': [],
        'forwarding_rules': [],
        + 'keypair': kwargs.get('keypair','None'),
        }
        )


        1.8.1.3

        The deployVirtualMachine call in CloudStack has over 20 parameters: http://cloudstack.apache.org/docs/api/apidocs-4.0.0/root_admin/deployVirtualMachine.html
        I don't know if you want me to list them all explicitly.

        Show
        sebgoa sebastien goasguen added a comment - Do you prefer something like this: From a459d73477da21fe54c2c44fee1109aa800e7817 Mon Sep 17 00:00:00 2001 From: Sebastien Goasguen <runseb@gmail.com> Date: Fri, 24 May 2013 05:07:14 -0400 Subject: [PATCH] LIBCLOUD-330 : handles kwargs for deploy — libcloud/compute/drivers/cloudstack.py | 1 + 1 file changed, 1 insertion diff --git libcloud/compute/drivers/cloudstack.py libcloud/compute/drivers/cloudstack.py index c2f2ad7..29d26d6 100644 — libcloud/compute/drivers/cloudstack.py +++ libcloud/compute/drivers/cloudstack.py @@ -265,6 +265,7 @@ class CloudStackNodeDriver(CloudStackDriverMixIn, NodeDriver): 'zoneid': location.id, 'ip_addresses': [], 'forwarding_rules': [], + 'keypair': kwargs.get('keypair','None'), } ) – 1.8.1.3 The deployVirtualMachine call in CloudStack has over 20 parameters: http://cloudstack.apache.org/docs/api/apidocs-4.0.0/root_admin/deployVirtualMachine.html I don't know if you want me to list them all explicitly.
        Hide
        kami Tomaz Muraus added a comment -

        sebastien goasguen In this case I would prefer to just take extra_args argument for now which is a dictionary.

        I'll look into making this change and getting it into trunk shortly.

        Show
        kami Tomaz Muraus added a comment - sebastien goasguen In this case I would prefer to just take extra_args argument for now which is a dictionary. I'll look into making this change and getting it into trunk shortly.
        Hide
        jira-bot ASF subversion and git services added a comment -

        Commit 1486282 from Tomaz Muraus
        [ https://svn.apache.org/r1486282 ]

        Allow user to pass extra arguments via "extra_args" argument which are
        then passed to the "deployVirtualMachine" call in the CloudStack driver
        create_node method.

        Part of LIBCLOUD-330.

        Show
        jira-bot ASF subversion and git services added a comment - Commit 1486282 from Tomaz Muraus [ https://svn.apache.org/r1486282 ] Allow user to pass extra arguments via "extra_args" argument which are then passed to the "deployVirtualMachine" call in the CloudStack driver create_node method. Part of LIBCLOUD-330 .
        Hide
        kami Tomaz Muraus added a comment -

        sebastien goasguen I've merged the change we talked about into trunk.

        It's not ideal, but it's better than **kwargs.

        Show
        kami Tomaz Muraus added a comment - sebastien goasguen I've merged the change we talked about into trunk. It's not ideal, but it's better than **kwargs.
        Hide
        sebgoa sebastien goasguen added a comment -

        this was committed.

        Show
        sebgoa sebastien goasguen added a comment - this was committed.

          People

          • Assignee:
            Unassigned
            Reporter:
            sebgoa sebastien goasguen
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development