Merge lp:~vishvananda/nova/fix-state-description into lp:~hudson-openstack/nova/trunk

Proposed by Vish Ishaya
Status: Merged
Approved by: Devin Carlen
Approved revision: 1522
Merged at revision: 1522
Proposed branch: lp:~vishvananda/nova/fix-state-description
Merge into: lp:~hudson-openstack/nova/trunk
Diff against target: 107 lines (+12/-11)
4 files modified
bin/nova-manage (+3/-3)
nova/api/ec2/admin.py (+2/-3)
nova/api/openstack/contrib/simple_tenant_usage.py (+1/-1)
nova/tests/test_libvirt.py (+6/-4)
To merge this branch: bzr merge lp:~vishvananda/nova/fix-state-description
Reviewer Review Type Date Requested Status
Devin Carlen (community) Approve
Brian Waldon (community) Approve
Alex Meade (community) Approve
Brian Lamar (community) Approve
Review via email: mp+73715@code.launchpad.net

Description of the change

Fix a few references to state_description that slipped through.

To post a comment you must log in.
Revision history for this message
Brian Lamar (blamar) wrote :

Arg! Sorry about this Vish. ack-grep the tool I used to search for state and state_description evidently doesn't search non-.py files and the ec2/admin.py changes must have slipped in between the time I merge propped and getting it accepted.

Thanks for cleaning this up.

review: Approve
Revision history for this message
Alex Meade (alex-meade) wrote :

simple enough

review: Approve
Revision history for this message
Brian Waldon (bcwaldon) wrote :

Fantastic.

review: Approve
Revision history for this message
Devin Carlen (devcamcar) wrote :

lgtm

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bin/nova-manage'
2--- bin/nova-manage 2011-08-26 22:07:34 +0000
3+++ bin/nova-manage 2011-09-01 19:32:25 +0000
4@@ -166,7 +166,7 @@
5 print address,
6 print vpn['host'],
7 print ec2utils.id_to_ec2_id(vpn['id']),
8- print vpn['state_description'],
9+ print vpn['vm_state'],
10 print state
11 else:
12 print None
13@@ -869,7 +869,7 @@
14 instance['hostname'],
15 instance['host'],
16 instance['instance_type'].name,
17- instance['state_description'],
18+ instance['vm_state'],
19 instance['launched_at'],
20 instance['image_ref'],
21 instance['kernel_id'],
22@@ -1223,7 +1223,7 @@
23 type=vc['instance_type']['name'],
24 fl_ip=floating_addr,
25 fx_ip=fixed_addr,
26- stat=vc['state_description'],
27+ stat=vc['vm_state'],
28 host=vc['host'],
29 time=str(vc['created_at']))
30
31
32=== modified file 'nova/api/ec2/admin.py'
33--- nova/api/ec2/admin.py 2011-08-18 02:31:01 +0000
34+++ nova/api/ec2/admin.py 2011-09-01 19:32:25 +0000
35@@ -21,7 +21,6 @@
36 """
37
38 import base64
39-import datetime
40 import netaddr
41 import urllib
42
43@@ -33,6 +32,7 @@
44 from nova import utils
45 from nova.api.ec2 import ec2utils
46 from nova.auth import manager
47+from nova.compute import vm_states
48
49
50 FLAGS = flags.FLAGS
51@@ -273,8 +273,7 @@
52 """Get the VPN instance for a project ID."""
53 for instance in db.instance_get_all_by_project(context, project_id):
54 if (instance['image_id'] == str(FLAGS.vpn_image_id)
55- and not instance['state_description'] in
56- ['shutting_down', 'shutdown']):
57+ and not instance['vm_state'] in [vm_states.DELETED]):
58 return instance
59
60 def start_vpn(self, context, project):
61
62=== modified file 'nova/api/openstack/contrib/simple_tenant_usage.py'
63--- nova/api/openstack/contrib/simple_tenant_usage.py 2011-08-30 19:41:30 +0000
64+++ nova/api/openstack/contrib/simple_tenant_usage.py 2011-09-01 19:32:25 +0000
65@@ -116,7 +116,7 @@
66 if info['ended_at']:
67 info['state'] = 'terminated'
68 else:
69- info['state'] = instance['state_description']
70+ info['state'] = instance['vm_state']
71
72 now = datetime.utcnow()
73
74
75=== modified file 'nova/tests/test_libvirt.py'
76--- nova/tests/test_libvirt.py 2011-08-24 23:48:04 +0000
77+++ nova/tests/test_libvirt.py 2011-09-01 19:32:25 +0000
78@@ -34,6 +34,7 @@
79 from nova import utils
80 from nova.api.ec2 import cloud
81 from nova.compute import power_state
82+from nova.compute import vm_states
83 from nova.virt.libvirt import connection
84 from nova.virt.libvirt import firewall
85
86@@ -674,8 +675,9 @@
87
88 # Preparing data
89 self.compute = utils.import_object(FLAGS.compute_manager)
90- instance_dict = {'host': 'fake', 'state': power_state.RUNNING,
91- 'state_description': 'running'}
92+ instance_dict = {'host': 'fake',
93+ 'power_state': power_state.RUNNING,
94+ 'vm_state': vm_states.ACTIVE}
95 instance_ref = db.instance_create(self.context, self.test_instance)
96 instance_ref = db.instance_update(self.context, instance_ref['id'],
97 instance_dict)
98@@ -713,8 +715,8 @@
99 self.compute.rollback_live_migration)
100
101 instance_ref = db.instance_get(self.context, instance_ref['id'])
102- self.assertTrue(instance_ref['state_description'] == 'running')
103- self.assertTrue(instance_ref['state'] == power_state.RUNNING)
104+ self.assertTrue(instance_ref['vm_state'] == vm_states.ACTIVE)
105+ self.assertTrue(instance_ref['power_state'] == power_state.RUNNING)
106 volume_ref = db.volume_get(self.context, volume_ref['id'])
107 self.assertTrue(volume_ref['status'] == 'in-use')
108