Merge lp:~tpatil/nova/os-availability-zone into lp:~hudson-openstack/nova/trunk

Proposed by Tushar Patil
Status: Merged
Approved by: Josh Kearney
Approved revision: 1415
Merged at revision: 1428
Proposed branch: lp:~tpatil/nova/os-availability-zone
Merge into: lp:~hudson-openstack/nova/trunk
Diff against target: 53 lines (+14/-4)
2 files modified
bin/nova-manage (+11/-3)
nova/api/openstack/create_instance_helper.py (+3/-1)
To merge this branch: bzr merge lp:~tpatil/nova/os-availability-zone
Reviewer Review Type Date Requested Status
Jesse Andrews (community) Approve
Devin Carlen (community) Approve
Review via email: mp+71253@code.launchpad.net

Description of the change

Currently OS API doesn't accept availability zone parameter so there is no way to instruct scheduler (SimpleScheduler) to launch VM instance on specific host of specified zone.

Now changes have been made in the create_instance_helper to read the availability zone and pass it to the compute create API. Any OS extensions can take a advantage of it.
Also changes have been made in the nova-manage ServiceCommands class to expose zone information to the admin users. Only admin users will be allowed to launch VM instance on specific host.

To post a comment you must log in.
Revision history for this message
Devin Carlen (devcamcar) wrote :

lgtm

review: Approve
Revision history for this message
Jesse Andrews (anotherjesse) 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-09 15:41:55 +0000
3+++ bin/nova-manage 2011-08-11 18:30:27 +0000
4@@ -882,6 +882,14 @@
5 services = [s for s in services if s['host'] == host]
6 if service:
7 services = [s for s in services if s['binary'] == service]
8+ print_format = "%-16s %-36s %-16s %-10s %-5s %-10s"
9+ print print_format % (
10+ _('Binary'),
11+ _('Host'),
12+ _('Zone'),
13+ _('Status'),
14+ _('State'),
15+ _('Updated_At'))
16 for svc in services:
17 delta = now - (svc['updated_at'] or svc['created_at'])
18 alive = (delta.seconds <= 15)
19@@ -889,9 +897,9 @@
20 active = 'enabled'
21 if svc['disabled']:
22 active = 'disabled'
23- print "%-10s %-10s %-8s %s %s" % (svc['host'], svc['binary'],
24- active, art,
25- svc['updated_at'])
26+ print print_format % (svc['binary'], svc['host'],
27+ svc['availability_zone'], active, art,
28+ svc['updated_at'])
29
30 @args('--host', dest='host', metavar='<host>', help='Host')
31 @args('--service', dest='service', metavar='<service>',
32
33=== modified file 'nova/api/openstack/create_instance_helper.py'
34--- nova/api/openstack/create_instance_helper.py 2011-08-09 22:46:57 +0000
35+++ nova/api/openstack/create_instance_helper.py 2011-08-11 18:30:27 +0000
36@@ -122,6 +122,7 @@
37 raise exc.HTTPBadRequest(explanation=msg)
38
39 zone_blob = server_dict.get('blob')
40+ availability_zone = server_dict.get('availability_zone')
41 name = server_dict['name']
42 self._validate_server_name(name)
43 name = name.strip()
44@@ -161,7 +162,8 @@
45 zone_blob=zone_blob,
46 reservation_id=reservation_id,
47 min_count=min_count,
48- max_count=max_count))
49+ max_count=max_count,
50+ availability_zone=availability_zone))
51 except quota.QuotaError as error:
52 self._handle_quota_error(error)
53 except exception.ImageNotFound as error: