Repository: libcloud
Updated Branches:
  refs/heads/trunk d960e651f -> 2ffa00053


Libvirt/lookup domain by uuid and name

Signed-off-by: wuyuewen <suhup...@126.com>

Update libvrit_driver.py

Signed-off-by: wuyuewen <suhup...@126.com>

Update libvirt_driver.py

Signed-off-by: wuyuewen <suhup...@126.com>

Update libvirt_driver.py

Signed-off-by: wuyuewen <suhup...@126.com>

tox check

Signed-off-by: wuyuewen <suhup...@126.com>

tox check

Signed-off-by: wuyuewen <suhup...@126.com>


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

Branch: refs/heads/trunk
Commit: 5969c74d545c7d5fb11c333c8ed4dd2f4f243e80
Parents: d960e65
Author: wuyuewen <suhup...@126.com>
Authored: Fri Jun 24 14:26:29 2016 +0800
Committer: Anthony Shaw <anthonys...@apache.org>
Committed: Sat Jun 25 16:44:16 2016 +1000

----------------------------------------------------------------------
 libcloud/compute/drivers/libvirt_driver.py | 34 +++++++++++++++++++++++++
 1 file changed, 34 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/5969c74d/libcloud/compute/drivers/libvirt_driver.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/libvirt_driver.py 
b/libcloud/compute/drivers/libvirt_driver.py
index 9d4e1a0..bba0da7 100644
--- a/libcloud/compute/drivers/libvirt_driver.py
+++ b/libcloud/compute/drivers/libvirt_driver.py
@@ -176,6 +176,26 @@ class LibvirtNodeDriver(NodeDriver):
         domain = self._get_domain_for_node(node=node)
         return domain.resume() == 0
 
+    def ex_get_node_by_uuid(self, uuid):
+        """
+        Retrieve Node object for a domain with a provided uuid.
+
+        :type uuid: ``str``
+        """
+        domain = self._get_domain_for_uuid(uuid=uuid)
+        node = self._to_node(domain=domain)
+        return node
+
+    def ex_get_node_by_name(self, name):
+        """
+        Retrieve Node object for a domain with a provided name.
+
+        :type name: ``str``
+        """
+        domain = self._get_domain_for_name(name=name)
+        node = self._to_node(domain=domain)
+        return node
+
     def ex_take_node_screenshot(self, node, directory, screen=0):
         """
         Take a screenshot of a monitoring of a running instance.
@@ -344,6 +364,20 @@ class LibvirtNodeDriver(NodeDriver):
         domain = self.connection.lookupByUUIDString(node.uuid)
         return domain
 
+    def _get_domain_for_uuid(self, uuid):
+        """
+        Return libvirt domain object for the provided uuid.
+        """
+        domain = self.connection.lookupByUUIDString(uuid)
+        return domain
+
+    def _get_domain_for_name(self, name):
+        """
+        Return libvirt domain object for the provided name.
+        """
+        domain = self.connection.lookupByName(name)
+        return domain
+
     def _get_entries(self, element):
         """
         Parse entries dictionary.

Reply via email to