summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Lamar <brian.lamar@rackspace.com>2011-08-23 10:57:47 -0400
committerBrian Lamar <brian.lamar@rackspace.com>2011-08-23 10:57:47 -0400
commit2fbaac5e07b558d7829253915523f073b07e24d4 (patch)
tree7195e20495570f47d28ebc9968f8b6eab9ac31af
parentfb6a2543fd97116daa8688a9f696cf0781562e3b (diff)
PEP8 fixes
-rw-r--r--nova/api/ec2/cloud.py18
-rw-r--r--nova/compute/task_states.py63
-rw-r--r--nova/compute/vm_states.py24
-rw-r--r--nova/tests/test_compute.py15
4 files changed, 63 insertions, 57 deletions
diff --git a/nova/api/ec2/cloud.py b/nova/api/ec2/cloud.py
index a7a343938..c5a360426 100644
--- a/nova/api/ec2/cloud.py
+++ b/nova/api/ec2/cloud.py
@@ -93,7 +93,7 @@ _STATE_DESCRIPTION_MAP = {
vm_states.VERIFY_RESIZE: 'verify_resize',
vm_states.PAUSED: 'pause',
vm_states.SUSPENDED: 'suspend',
- vm_states.RESCUED: 'rescue'
+ vm_states.RESCUED: 'rescue',
}
@@ -104,10 +104,12 @@ def state_description_from_vm_state(vm_state):
# TODO(yamahata): hypervisor dependent default device name
_DEFAULT_ROOT_DEVICE_NAME = '/dev/sda1'
-_DEFAULT_MAPPINGS = {'ami': 'sda1',
- 'ephemeral0': 'sda2',
- 'root': _DEFAULT_ROOT_DEVICE_NAME,
- 'swap': 'sda3'}
+_DEFAULT_MAPPINGS = {
+ 'ami': 'sda1',
+ 'ephemeral0': 'sda2',
+ 'root': _DEFAULT_ROOT_DEVICE_NAME,
+ 'swap': 'sda3',
+}
def _parse_block_device_mapping(bdm):
@@ -1064,8 +1066,10 @@ class CloudController(object):
def _format_attr_instance_initiated_shutdown_behavior(instance,
result):
vm_state = instance['vm_state']
- state_to_value = {vm_states.STOPPED: 'stop',
- vm_states.DELETED: 'terminate'}
+ state_to_value = {
+ vm_states.STOPPED: 'stop',
+ vm_states.DELETED: 'terminate',
+ }
value = state_to_value.get(vm_state)
if value:
result['instanceInitiatedShutdownBehavior'] = value
diff --git a/nova/compute/task_states.py b/nova/compute/task_states.py
index d186edc3f..5f78495ea 100644
--- a/nova/compute/task_states.py
+++ b/nova/compute/task_states.py
@@ -17,35 +17,34 @@
"""Possible task states for instances"""
-SCHEDULING='scheduling'
-BLOCK_DEVICE_MAPPING='block_device_mapping'
-NETWORKING='networking'
-SPAWN='spawn'
-
-SNAPSHOTTING='snapshotting'
-BACKING_UP='backing_up'
-PASSWORD='password'
-
-RESIZE_PREP='resize_prep'
-RESIZE_MIGRATING='resize_migrating'
-RESIZE_MIGRATED='resize_migrated'
-RESIZE_FINISH='resize_finish'
-RESIZE_REVERTING='resize_reverting'
-RESIZE_CONFIRMING='resize_confirming'
-
-REBUILDING='rebuilding'
-
-REBOOTING='rebooting'
-HARD_REBOOTING='hard_rebooting'
-PAUSING='pausing'
-UNPAUSING='unpausing'
-SUSPENDING='suspending'
-RESUMING='resuming'
-
-RESCUING='rescuing'
-RESCUED='rescued'
-UNRESCUING='unrescuing'
-
-DELETING='deleting'
-STOPPING='stopping'
-STARTING='starting'
+SCHEDULING = 'scheduling'
+BLOCK_DEVICE_MAPPING = 'block_device_mapping'
+NETWORKING = 'networking'
+SPAWN = 'spawn'
+
+SNAPSHOTTING = 'snapshotting'
+BACKING_UP = 'backing_up'
+PASSWORD = 'password'
+
+RESIZE_PREP = 'resize_prep'
+RESIZE_MIGRATING = 'resize_migrating'
+RESIZE_MIGRATED = 'resize_migrated'
+RESIZE_FINISH = 'resize_finish'
+RESIZE_REVERTING = 'resize_reverting'
+RESIZE_CONFIRMING = 'resize_confirming'
+
+REBUILDING = 'rebuilding'
+
+REBOOTING = 'rebooting'
+HARD_REBOOTING = 'hard_rebooting'
+PAUSING = 'pausing'
+UNPAUSING = 'unpausing'
+SUSPENDING = 'suspending'
+RESUMING = 'resuming'
+
+RESCUING = 'rescuing'
+UNRESCUING = 'unrescuing'
+
+DELETING = 'deleting'
+STOPPING = 'stopping'
+STARTING = 'starting'
diff --git a/nova/compute/vm_states.py b/nova/compute/vm_states.py
index 342fa905e..560e6d688 100644
--- a/nova/compute/vm_states.py
+++ b/nova/compute/vm_states.py
@@ -17,18 +17,18 @@
"""Possible vm states for instances"""
-ACTIVE='active'
-BUILDING='building'
-REBUILDING='rebuilding'
+ACTIVE = 'active'
+BUILDING = 'building'
+REBUILDING = 'rebuilding'
-PAUSED='paused'
-SUSPENDED='suspended'
-RESCUED='rescued'
-DELETED='deleted'
-STOPPED='stopped'
+PAUSED = 'paused'
+SUSPENDED = 'suspended'
+RESCUED = 'rescued'
+DELETED = 'deleted'
+STOPPED = 'stopped'
-MIGRATING='migrating'
-RESIZING='resizing'
-VERIFY_RESIZE='verify_resize'
+MIGRATING = 'migrating'
+RESIZING = 'resizing'
+VERIFY_RESIZE = 'verify_resize'
-ERROR='error'
+ERROR = 'error'
diff --git a/nova/tests/test_compute.py b/nova/tests/test_compute.py
index 2cf694d2c..11e1fd540 100644
--- a/nova/tests/test_compute.py
+++ b/nova/tests/test_compute.py
@@ -1308,14 +1308,17 @@ class ComputeTestCase(test.TestCase):
"""Test searching instances by state"""
c = context.get_admin_context()
- instance_id1 = self._create_instance({'power_state': power_state.SHUTDOWN})
+ instance_id1 = self._create_instance({
+ 'power_state': power_state.SHUTDOWN,
+ })
instance_id2 = self._create_instance({
- 'id': 2,
- 'power_state': power_state.RUNNING})
+ 'id': 2,
+ 'power_state': power_state.RUNNING,
+ })
instance_id3 = self._create_instance({
- 'id': 10,
- 'power_state': power_state.RUNNING})
-
+ 'id': 10,
+ 'power_state': power_state.RUNNING,
+ })
instances = self.compute_api.get_all(c,
search_opts={'power_state': power_state.SUSPENDED})
self.assertEqual(len(instances), 0)