diff options
| author | MORITA Kazutaka <morita.kazutaka@gmail.com> | 2011-05-27 13:36:59 +0900 |
|---|---|---|
| committer | MORITA Kazutaka <morita.kazutaka@gmail.com> | 2011-05-27 13:36:59 +0900 |
| commit | 8b4c91b9f2c28e4809659f199affddbd66482dbb (patch) | |
| tree | 0d0d1603d29889868ca40f5a4403f92202747cb3 | |
| parent | 6b0ed0cb61838d01b15df26fc32df0de90f1cfbe (diff) | |
| download | nova-8b4c91b9f2c28e4809659f199affddbd66482dbb.tar.gz nova-8b4c91b9f2c28e4809659f199affddbd66482dbb.tar.xz nova-8b4c91b9f2c28e4809659f199affddbd66482dbb.zip | |
Fix pep8 violations.
| -rw-r--r-- | nova/api/ec2/cloud.py | 13 | ||||
| -rw-r--r-- | nova/db/sqlalchemy/migrate_repo/versions/019_add_volume_snapshot_support.py | 3 | ||||
| -rw-r--r-- | nova/db/sqlalchemy/models.py | 1 | ||||
| -rw-r--r-- | nova/tests/test_volume.py | 5 | ||||
| -rw-r--r-- | nova/volume/driver.py | 6 | ||||
| -rw-r--r-- | nova/volume/manager.py | 3 |
6 files changed, 19 insertions, 12 deletions
diff --git a/nova/api/ec2/cloud.py b/nova/api/ec2/cloud.py index 6927d6774..403b7ab40 100644 --- a/nova/api/ec2/cloud.py +++ b/nova/api/ec2/cloud.py @@ -285,7 +285,9 @@ class CloudController(object): snapshots = [] for ec2_id in snapshot_id: internal_id = ec2utils.ec2_id_to_id(ec2_id) - snapshot = self.volume_api.get_snapshot(context, snapshot_id=internal_id) + snapshot = self.volume_api.get_snapshot( + context, + snapshot_id=internal_id) snapshots.append(snapshot) else: snapshots = self.volume_api.get_all_snapshots(context) @@ -295,7 +297,8 @@ class CloudController(object): def _format_snapshot(self, context, snapshot): s = {} s['snapshotId'] = ec2utils.id_to_ec2_id(snapshot['id'], 'snap-%08x') - s['volumeId'] = ec2utils.id_to_ec2_id(snapshot['volume_id'], 'vol-%08x') + s['volumeId'] = ec2utils.id_to_ec2_id(snapshot['volume_id'], + 'vol-%08x') s['status'] = snapshot['status'] s['startTime'] = snapshot['created_at'] s['progress'] = snapshot['progress'] @@ -308,7 +311,8 @@ class CloudController(object): return s def create_snapshot(self, context, volume_id, **kwargs): - LOG.audit(_("Create snapshot of volume %s"), volume_id, context=context) + LOG.audit(_("Create snapshot of volume %s"), volume_id, + context=context) volume_id = ec2utils.ec2_id_to_id(volume_id) snapshot = self.volume_api.create_snapshot( context, @@ -629,7 +633,8 @@ class CloudController(object): else: v['attachmentSet'] = [{}] if volume.get('snapshot_id') != None: - v['snapshotId'] = ec2utils.id_to_ec2_id(volume['snapshot_id'], 'snap-%08x') + v['snapshotId'] = ec2utils.id_to_ec2_id(volume['snapshot_id'], + 'snap-%08x') else: v['snapshotId'] = None diff --git a/nova/db/sqlalchemy/migrate_repo/versions/019_add_volume_snapshot_support.py b/nova/db/sqlalchemy/migrate_repo/versions/019_add_volume_snapshot_support.py index 5a44bac16..f16d6db56 100644 --- a/nova/db/sqlalchemy/migrate_repo/versions/019_add_volume_snapshot_support.py +++ b/nova/db/sqlalchemy/migrate_repo/versions/019_add_volume_snapshot_support.py @@ -48,8 +48,7 @@ snapshots = Table('snapshots', meta, unicode_error=None, _warn_on_bytestring=False)), Column('display_description', String(length=255, convert_unicode=False, assert_unicode=None, - unicode_error=None, _warn_on_bytestring=False)) - ) + unicode_error=None, _warn_on_bytestring=False))) def upgrade(migrate_engine): diff --git a/nova/db/sqlalchemy/models.py b/nova/db/sqlalchemy/models.py index b887c5bad..480f62399 100644 --- a/nova/db/sqlalchemy/models.py +++ b/nova/db/sqlalchemy/models.py @@ -353,6 +353,7 @@ class Snapshot(BASE, NovaBase): display_name = Column(String(255)) display_description = Column(String(255)) + class ExportDevice(BASE, NovaBase): """Represates a shelf and blade that a volume can be exported on.""" __tablename__ = 'export_devices' diff --git a/nova/tests/test_volume.py b/nova/tests/test_volume.py index c66b66959..3472b1f59 100644 --- a/nova/tests/test_volume.py +++ b/nova/tests/test_volume.py @@ -193,8 +193,9 @@ class VolumeTestCase(test.TestCase): self.volume.create_volume(self.context, volume_id) snapshot_id = self._create_snapshot(volume_id) self.volume.create_snapshot(self.context, volume_id, snapshot_id) - self.assertEqual(snapshot_id, db.snapshot_get(context.get_admin_context(), - snapshot_id).id) + self.assertEqual(snapshot_id, + db.snapshot_get(context.get_admin_context(), + snapshot_id).id) self.volume.delete_snapshot(self.context, snapshot_id) self.assertRaises(exception.NotFound, diff --git a/nova/volume/driver.py b/nova/volume/driver.py index e0e18b9bf..21cc228c9 100644 --- a/nova/volume/driver.py +++ b/nova/volume/driver.py @@ -97,7 +97,7 @@ class VolumeDriver(object): def _copy_volume(self, srcstr, deststr, size_in_g): self._execute('sudo', 'dd', 'if=%s' % srcstr, 'of=%s' % deststr, 'count=%d' % (size_in_g * 1024), 'bs=1M') - + def _volume_not_present(self, volume_name): path_name = '%s/%s' % (FLAGS.volume_group, volume_name) try: @@ -115,7 +115,7 @@ class VolumeDriver(object): self._try_execute('sudo', 'lvremove', '-f', "%s/%s" % (FLAGS.volume_group, self._escape_snapshot(volume['name']))) - + def _sizestr(self, size_in_g): if int(size_in_g) == 0: return '100M' @@ -150,7 +150,7 @@ class VolumeDriver(object): out = out.strip() if (out[0] == 'o') or (out[0] == 'O'): raise exception.VolumeIsBusy(volume_name=volume['name']) - + self._delete_volume(volume, volume['size']) def create_snapshot(self, snapshot): diff --git a/nova/volume/manager.py b/nova/volume/manager.py index fd889633d..40a104d35 100644 --- a/nova/volume/manager.py +++ b/nova/volume/manager.py @@ -169,7 +169,8 @@ class VolumeManager(manager.SchedulerDependentManager): LOG.debug(_("snapshot %(snap_name)s: creating") % locals()) model_update = self.driver.create_snapshot(snapshot_ref) if model_update: - self.db.snapshot_update(context, snapshot_ref['id'], model_update) + self.db.snapshot_update(context, snapshot_ref['id'], + model_update) except Exception: self.db.snapshot_update(context, |
