← Back to team overview

duplicity-team team mailing list archive

[Merge] lp:~okrasz/duplicity/duplicity into lp:duplicity

 

Marcin Okraszewski has proposed merging lp:~okrasz/duplicity/duplicity into lp:duplicity.

Commit message:
Add --azure-blob-tier that specifies storage tier (Hot,Cool,Archive) used for uploaded files.

Requested reviews:
  duplicity-team (duplicity-team)

For more details, see:
https://code.launchpad.net/~okrasz/duplicity/duplicity/+merge/361352

That change was discussed on duplicity-talk. Though, in the master the Azure client was already updated, so that part is gone. Secondly, master code no longer retrieves manifest files during backup process (0.7.18 does so), so there was no need to introduce separate tier settings for manifest and other files. Finally, I've moved it to command line parameter from environment as it seems to fit more this type of setting.

-- 
Your team duplicity-team is requested to review the proposed merge of lp:~okrasz/duplicity/duplicity into lp:duplicity.
=== modified file 'bin/duplicity.1'
--- bin/duplicity.1	2018-07-04 12:21:25 +0000
+++ bin/duplicity.1	2019-01-02 08:37:02 +0000
@@ -830,11 +830,15 @@
 default is 4194304 (4MiB)
 
 .TP
-.BI ""--azure-max-connections"
+.BI "--azure-max-connections"
 Specify the number of maximum connections to transfer one blob to Azure
 blob size exceeds 64MB. The default values is 2.
 
 .TP
+.BI "--azure-blob-tier"
+Standard storage tier used for storring backup files (Hot|Cool|Archive).
+
+.TP
 .BI "--scp-command " command
 .B (only ssh pexpect backend with --use-scp enabled)
 The

=== modified file 'duplicity/backends/azurebackend.py'
--- duplicity/backends/azurebackend.py	2018-11-29 19:00:15 +0000
+++ duplicity/backends/azurebackend.py	2019-01-02 08:37:02 +0000
@@ -102,7 +102,7 @@
             # fallback for azure-storage<0.30.0
             except AttributeError:
                 self.blob_service._BLOB_MAX_CHUNK_DATA_SIZE = globals.azure_max_block_size
-
+                
     def _create_container(self):
         try:
             self.blob_service.create_container(self.container, fail_on_exist=True)
@@ -124,7 +124,16 @@
             self.blob_service.create_blob_from_path(self.container, remote_filename, source_path.name, **kwargs)
         except AttributeError:  # Old versions use a different method name
             self.blob_service.put_block_blob_from_path(self.container, remote_filename, source_path.name, **kwargs)
-
+        
+        self._set_tier(remote_filename)
+            
+    def _set_tier(self, remote_filename):
+        if globals.azure_blob_tier is not None:
+            try:
+                self.blob_service.set_standard_blob_tier(self.container, remote_filename, globals.azure_blob_tier)
+            except AttributeError:  # might not be available in old API
+                pass
+            
     def _get(self, remote_filename, local_path):
         # https://azure.microsoft.com/en-us/documentation/articles/storage-python-how-to-use-blob-storage/#download-blobs
         self.blob_service.get_blob_to_path(self.container, remote_filename, local_path.name)

=== modified file 'duplicity/commandline.py'
--- duplicity/commandline.py	2018-11-29 19:00:15 +0000
+++ duplicity/commandline.py	2019-01-02 08:37:02 +0000
@@ -590,6 +590,9 @@
     # max_connections (int) - Maximum number of parallel connections to use when the blob size exceeds 64MB.
     parser.add_option(u"--azure-max-connections", type=u"int", metavar=_(u"number"))
 
+    # Standard storage tier used for storring backup files (Hot|Cool|Archive).
+    parser.add_option(u"--azure-blob-tier", type=u"string", metavar=_(u"Hot|Cool|Archive"))
+
     # scp command to use (ssh pexpect backend)
     parser.add_option(u"--scp-command", metavar=_(u"command"))
 

=== modified file 'duplicity/globals.py'
--- duplicity/globals.py	2018-11-29 19:00:15 +0000
+++ duplicity/globals.py	2019-01-02 08:37:02 +0000
@@ -232,6 +232,9 @@
 # Maximum number of parallel connections to use when the blob size for azure exceeds 64MB
 azure_max_connections = None
 
+# Standard storage tier used for storring backup blobs (Hot|Cool|Archive).
+azure_blob_tier = None
+
 # Whether to use the full email address as the user name when
 # logging into an imap server. If false just the user name
 # part of the email address is used.


Follow ups