]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Fix pep8 violation in backup
authorVictor Rodionov <vito.ordaz@gmail.com>
Tue, 27 Aug 2013 21:50:55 +0000 (01:50 +0400)
committerVictor Rodionov <vito.ordaz@gmail.com>
Fri, 30 Aug 2013 15:08:15 +0000 (19:08 +0400)
Change-Id: I0bbc7923c3bea9b918c243d2c7b59510fd26deb5

cinder/backup/api.py
cinder/backup/driver.py
cinder/backup/manager.py
cinder/backup/rpcapi.py

index 18dc57c2f32a9edf2530662a157a059f382975c5..16c9c6dd44ae0303f069989296401a913d59e72f 100644 (file)
@@ -37,12 +37,12 @@ LOG = logging.getLogger(__name__)
 
 
 def check_policy(context, action):
-        target = {
-            'project_id': context.project_id,
-            'user_id': context.user_id,
-        }
-        _action = 'backup:%s' % action
-        cinder.policy.enforce(context, _action, target)
+    target = {
+        'project_id': context.project_id,
+        'user_id': context.user_id,
+    }
+    _action = 'backup:%s' % action
+    cinder.policy.enforce(context, _action, target)
 
 
 class API(base.Base):
@@ -59,9 +59,7 @@ class API(base.Base):
         return dict(rv.iteritems())
 
     def delete(self, context, backup_id):
-        """
-        Make the RPC call to delete a volume backup.
-        """
+        """Make the RPC call to delete a volume backup."""
         check_policy(context, 'delete')
         backup = self.get(context, backup_id)
         if backup['status'] not in ['available', 'error']:
@@ -74,7 +72,9 @@ class API(base.Base):
                                          backup['id'])
 
     # TODO(moorehef): Add support for search_opts, discarded atm
-    def get_all(self, context, search_opts={}):
+    def get_all(self, context, search_opts=None):
+        if search_opts is None:
+            search_opts = {}
         check_policy(context, 'get_all')
         if context.is_admin:
             backups = self.db.backup_get_all(context)
@@ -85,9 +85,7 @@ class API(base.Base):
         return backups
 
     def _check_backup_service(self, volume):
-        """
-        Check if there is an backup service available
-        """
+        """Check if there is an backup service available"""
         topic = CONF.backup_topic
         ctxt = context.get_admin_context()
         services = self.db.service_get_all_by_topic(ctxt, topic)
@@ -100,9 +98,7 @@ class API(base.Base):
 
     def create(self, context, name, description, volume_id,
                container, availability_zone=None):
-        """
-        Make the RPC call to create a volume backup.
-        """
+        """Make the RPC call to create a volume backup."""
         check_policy(context, 'create')
         volume = self.volume_api.get(context, volume_id)
         if volume['status'] != "available":
@@ -137,9 +133,7 @@ class API(base.Base):
         return backup
 
     def restore(self, context, backup_id, volume_id=None):
-        """
-        Make the RPC call to restore a volume backup.
-        """
+        """Make the RPC call to restore a volume backup."""
         check_policy(context, 'restore')
         backup = self.get(context, backup_id)
         if backup['status'] != 'available':
index c158954d0be856abe3a822acf548a0feef17ebbe..59525d07ebb2375e5c2732adb87b083547bb1ea8 100644 (file)
@@ -12,7 +12,7 @@
 #    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 #    License for the specific language governing permissions and limitations
 #    under the License.
-#
+
 """Base class for all backup drivers."""
 
 from cinder.db import base
index b4eba2eac55410631f86afeadcd3b6c5410eba35..5ff6c44b0e68c249d736b9650c1f46e1472e6a2c 100644 (file)
@@ -132,9 +132,7 @@ class BackupManager(manager.SchedulerDependentManager):
                 self.delete_backup(ctxt, backup['id'])
 
     def create_backup(self, context, backup_id):
-        """
-        Create volume backups using configured backup service.
-        """
+        """Create volume backups using configured backup service."""
         backup = self.db.backup_get(context, backup_id)
         volume_id = backup['volume_id']
         volume = self.db.volume_get(context, volume_id)
@@ -189,9 +187,7 @@ class BackupManager(manager.SchedulerDependentManager):
         LOG.info(_('create_backup finished. backup: %s'), backup_id)
 
     def restore_backup(self, context, backup_id, volume_id):
-        """
-        Restore volume backups from configured backup service.
-        """
+        """Restore volume backups from configured backup service."""
         LOG.info(_('restore_backup started, restoring backup: %(backup_id)s'
                    ' to volume: %(volume_id)s') %
                  {'backup_id': backup_id, 'volume_id': volume_id})
@@ -261,9 +257,7 @@ class BackupManager(manager.SchedulerDependentManager):
                  {'backup_id': backup_id, 'volume_id': volume_id})
 
     def delete_backup(self, context, backup_id):
-        """
-        Delete volume backup from configured backup service.
-        """
+        """Delete volume backup from configured backup service."""
         backup = self.db.backup_get(context, backup_id)
         LOG.info(_('delete_backup started, backup: %s'), backup_id)
         self.db.backup_update(context, backup_id, {'host': self.host})
index cc6c2493fec05b183f10671c61b6b94cace1c230..62a8ccb965b68054417dad5d2f2653abe8b2db19 100644 (file)
@@ -33,12 +33,12 @@ LOG = logging.getLogger(__name__)
 
 
 class BackupAPI(cinder.openstack.common.rpc.proxy.RpcProxy):
-    '''Client side of the volume rpc API.
+    """Client side of the volume rpc API.
 
     API version history:
 
         1.0 - Initial version.
-    '''
+    """
 
     BASE_RPC_API_VERSION = '1.0'