libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anthonys...@apache.org
Subject [03/26] libcloud git commit: Added container (object based store) as a backup type.
Date Tue, 05 Jan 2016 10:19:21 GMT
Added container (object based store) as a backup type.


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

Branch: refs/heads/trunk
Commit: 20bec600064e28c2bc20eae57f564d62e8a0f94a
Parents: 121cceb
Author: Anthony Shaw <anthony.p.shaw@gmail.com>
Authored: Mon Nov 9 11:48:03 2015 +1100
Committer: Anthony Shaw <anthony.p.shaw@gmail.com>
Committed: Mon Nov 9 11:48:03 2015 +1100

----------------------------------------------------------------------
 libcloud/backup/base.py  | 31 ++++++++++++++++++++++++++-----
 libcloud/backup/types.py |  3 +++
 2 files changed, 29 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/20bec600/libcloud/backup/base.py
----------------------------------------------------------------------
diff --git a/libcloud/backup/base.py b/libcloud/backup/base.py
index 4e51365..74f49cb 100644
--- a/libcloud/backup/base.py
+++ b/libcloud/backup/base.py
@@ -31,7 +31,7 @@ class BackupTarget(object):
 
     def __init__(self, id, name, address, type, driver, extra=None):
         """
-        :param id: Record id
+        :param id: Target id
         :type id: ``str``
 
         :param name: Name of the target
@@ -286,7 +286,28 @@ class BackupDriver(BaseDriver):
         """
         return self.create_target(name=node.name,
                                   address=node.public_ips[0],
-                                  type=BackupTargetType.VIRTUAL,
+                                  type=type,
+                                  extra=None)
+
+    def create_target_from_container(self, container, type=BackupTargetType.OBJECT,
+                                extra=None):
+        """
+        Creates a new backup target from an existing storage container
+
+        :param node: The Container to backup
+        :type  node: ``Container``
+
+        :param type: Backup target type (Physical, Virtual, ...).
+        :type type: :class:`BackupTargetType`
+
+        :param extra: (optional) Extra attributes (driver specific).
+        :type extra: ``dict``
+
+        :rtype: Instance of :class:`BackupTarget`
+        """
+        return self.create_target(name=container.name,
+                                  address=container.get_cdn_url(),
+                                  type=type,
                                   extra=None)
 
     def update_target(self, target, name, address, extra):
@@ -422,7 +443,7 @@ class BackupDriver(BaseDriver):
 
     def suspend_target_job(self, target, job):
         """
-        List the backup jobs on a target
+        Suspend a running backup job on a target
 
         :param target: Backup target with the backup data
         :type  target: Instance of :class:`BackupTarget`
@@ -437,12 +458,12 @@ class BackupDriver(BaseDriver):
 
     def cancel_target_job(self, target, job):
         """
-        List the backup jobs on a target
+        Cancel a backup job on a target
 
         :param target: Backup target with the backup data
         :type  target: Instance of :class:`BackupTarget`
 
-        :param job: Backup target job to suspend
+        :param job: Backup target job to cancel
         :type  job: Instance of :class:`BackupTargetJob`
 
         :rtype: ``bool``

http://git-wip-us.apache.org/repos/asf/libcloud/blob/20bec600/libcloud/backup/types.py
----------------------------------------------------------------------
diff --git a/libcloud/backup/types.py b/libcloud/backup/types.py
index 56e32ab..1550ff9 100644
--- a/libcloud/backup/types.py
+++ b/libcloud/backup/types.py
@@ -41,6 +41,9 @@ class BackupTargetType(object):
     """ Denotes a database target """
     DATABASE = 'Database'
 
+    """ Denotes an object based file system """
+    OBJECT = 'Object'
+
 
 class BackupTargetJobStatus(object):
     """


Mime
View raw message