You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by to...@apache.org on 2015/05/07 23:01:06 UTC

libcloud git commit: Add virtualmachine_id to CloudStackAddress

Repository: libcloud
Updated Branches:
  refs/heads/trunk cfd815eb8 -> 2fb4e6b46


Add virtualmachine_id to CloudStackAddress

Closes #485

Signed-off-by: Tomaz Muraus <to...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/2fb4e6b4
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/2fb4e6b4
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/2fb4e6b4

Branch: refs/heads/trunk
Commit: 2fb4e6b462fac4a5408cac51fd6c389fde137c49
Parents: cfd815e
Author: Atsushi Sasaki <at...@gmail.com>
Authored: Tue Mar 10 17:24:49 2015 +0900
Committer: Tomaz Muraus <to...@apache.org>
Committed: Thu May 7 22:54:24 2015 +0200

----------------------------------------------------------------------
 CHANGES.rst                              |  5 +++++
 libcloud/compute/drivers/cloudstack.py   | 11 +++++++++--
 libcloud/test/compute/test_cloudstack.py |  1 +
 3 files changed, 15 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/2fb4e6b4/CHANGES.rst
----------------------------------------------------------------------
diff --git a/CHANGES.rst b/CHANGES.rst
index 06f61fa..a25f890 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -157,6 +157,11 @@ Compute
   (LIBCLOUD-698, GITHUB-507)
   [Anthony Shaw]
 
+- Add "virtualmachine_id" attribute to the ``CloudStackAddress`` class in the
+  CloudStack driver.
+  (LIBCLOUD-679, GITHUB-485)
+  [Atsushi Sasaki]
+
 Storage
 ~~~~~~~
 

http://git-wip-us.apache.org/repos/asf/libcloud/blob/2fb4e6b4/libcloud/compute/drivers/cloudstack.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/cloudstack.py b/libcloud/compute/drivers/cloudstack.py
index db89f27..8462188 100644
--- a/libcloud/compute/drivers/cloudstack.py
+++ b/libcloud/compute/drivers/cloudstack.py
@@ -474,15 +474,20 @@ class CloudStackAddress(object):
 
     :param      vpc_id: VPC the ip belongs to
     :type       vpc_id: ``str``
+
+    :param      virtualmachine_id: The ID of virutal machine this address
+                                   is assigned to
+    :type       virtualmachine_id: ``str``
     """
 
     def __init__(self, id, address, driver, associated_network_id=None,
-                 vpc_id=None):
+                 vpc_id=None, virtualmachine_id=None):
         self.id = id
         self.address = address
         self.driver = driver
         self.associated_network_id = associated_network_id
         self.vpc_id = vpc_id
+        self.virtualmachine_id = virtualmachine_id
 
     def release(self):
         self.driver.ex_release_public_ip(address=self)
@@ -2226,7 +2231,9 @@ class CloudStackNodeDriver(CloudStackDriverMixIn, NodeDriver):
             ips.append(CloudStackAddress(ip['id'],
                                          ip['ipaddress'],
                                          self,
-                                         ip.get('associatednetworkid', [])))
+                                         ip.get('associatednetworkid', []),
+                                         ip.get('vpcid'),
+                                         ip.get('virtualmachineid')))
 
         return ips
 

http://git-wip-us.apache.org/repos/asf/libcloud/blob/2fb4e6b4/libcloud/test/compute/test_cloudstack.py
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/test_cloudstack.py b/libcloud/test/compute/test_cloudstack.py
index 2e4930f..979b0b7 100644
--- a/libcloud/test/compute/test_cloudstack.py
+++ b/libcloud/test/compute/test_cloudstack.py
@@ -774,6 +774,7 @@ class CloudStackCommonTestCase(TestCaseMixin):
     def test_ex_list_public_ips(self):
         ips = self.driver.ex_list_public_ips()
         self.assertEqual(ips[0].address, '1.1.1.116')
+        self.assertEqual(ips[0].virtualmachine_id, '2600')
 
     def test_ex_allocate_public_ip(self):
         addr = self.driver.ex_allocate_public_ip()