From 18e43e6b4dffba73dd35afb797dfa4e1d6cd00fe Mon Sep 17 00:00:00 2001 From: Mark Washenberger Date: Mon, 24 Oct 2011 14:28:47 -0400 Subject: Support server uuids with security groups Change-Id: I15dd5a5e26b2d22fa3def75fa950f1155e6911ac --- nova/compute/api.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'nova/compute') diff --git a/nova/compute/api.py b/nova/compute/api.py index 57e0d9edd..1ca466291 100644 --- a/nova/compute/api.py +++ b/nova/compute/api.py @@ -699,7 +699,11 @@ class API(base.Base): context.project_id, security_group_name) # check if the server exists - inst = self.db.instance_get(context, instance_id) + if utils.is_uuid_like(instance_id): + inst = self.db.instance_get_by_uuid(context, instance_id) + else: + inst = self.db.instance_get(context, instance_id) + instance_id = inst['id'] #check if the security group is associated with the server if self._is_security_group_associated_with_server(security_group, instance_id): @@ -725,7 +729,11 @@ class API(base.Base): context.project_id, security_group_name) # check if the server exists - inst = self.db.instance_get(context, instance_id) + if utils.is_uuid_like(instance_id): + inst = self.db.instance_get_by_uuid(context, instance_id) + else: + inst = self.db.instance_get(context, instance_id) + instance_id = inst['id'] #check if the security group is associated with the server if not self._is_security_group_associated_with_server(security_group, instance_id): -- cgit