summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorSandy Walsh <sandy.walsh@rackspace.com>2011-08-08 09:12:56 -0700
committerSandy Walsh <sandy.walsh@rackspace.com>2011-08-08 09:12:56 -0700
commit7730d4d1ebda5c88ae83f1f5e6dbd6b0a5c82ee4 (patch)
treec3c14f81db733971791a03ef8d5e6b66a634c13d /bin
parent19e50320e36f02ce11a6aaae8f88a6ddbc132859 (diff)
parentec57e2a27ebfc8eba84d82f5372408e3d85a9272 (diff)
another trunk merge
Diffstat (limited to 'bin')
-rwxr-xr-xbin/nova-manage30
1 files changed, 28 insertions, 2 deletions
diff --git a/bin/nova-manage b/bin/nova-manage
index f272351c2..40f22c19c 100755
--- a/bin/nova-manage
+++ b/bin/nova-manage
@@ -592,6 +592,31 @@ class FixedIpCommands(object):
fixed_ip['address'],
mac_address, hostname, host)
+ @args('--address', dest="address", metavar='<ip address>',
+ help='IP address')
+ def reserve(self, address):
+ """Mark fixed ip as reserved
+ arguments: address"""
+ self._set_reserved(address, True)
+
+ @args('--address', dest="address", metavar='<ip address>',
+ help='IP address')
+ def unreserve(self, address):
+ """Mark fixed ip as free to use
+ arguments: address"""
+ self._set_reserved(address, False)
+
+ def _set_reserved(self, address, reserved):
+ ctxt = context.get_admin_context()
+
+ try:
+ fixed_ip = db.fixed_ip_get_by_address(ctxt, address)
+ db.fixed_ip_update(ctxt, fixed_ip['address'],
+ {'reserved': reserved})
+ except exception.NotFound as ex:
+ print "error: %s" % ex
+ sys.exit(2)
+
class FloatingIpCommands(object):
"""Class for managing floating ip."""
@@ -1235,11 +1260,12 @@ class ImageCommands(object):
is_public, architecture)
def _lookup(self, old_image_id):
+ elevated = context.get_admin_context()
try:
internal_id = ec2utils.ec2_id_to_id(old_image_id)
- image = self.image_service.show(context, internal_id)
+ image = self.image_service.show(elevated, internal_id)
except (exception.InvalidEc2Id, exception.ImageNotFound):
- image = self.image_service.show_by_name(context, old_image_id)
+ image = self.image_service.show_by_name(elevated, old_image_id)
return image['id']
def _old_to_new(self, old):