From 9b5adcbe92a4f7e0f9b1592be123c58f743def34 Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Tue, 5 Jul 2011 15:55:16 -0700 Subject: pass in dhcp server address, fix a bunch of bugs --- nova/compute/manager.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'nova/compute') diff --git a/nova/compute/manager.py b/nova/compute/manager.py index bbbddde0a..b198adc97 100644 --- a/nova/compute/manager.py +++ b/nova/compute/manager.py @@ -77,8 +77,6 @@ flags.DEFINE_integer('live_migration_retry_count', 30, flags.DEFINE_integer("rescue_timeout", 0, "Automatically unrescue an instance after N seconds." " Set to 0 to disable.") -flags.DEFINE_bool('auto_assign_floating_ip', False, - 'Autoassigning floating ip to VM') flags.DEFINE_integer('host_state_interval', 120, 'Interval in seconds for querying the host status') @@ -268,16 +266,19 @@ class ComputeManager(manager.SchedulerDependentManager): """Launch a new instance with specified options.""" context = context.elevated() instance = self.db.instance_get(context, instance_id) - instance.injected_files = kwargs.get('injected_files', []) - instance.admin_pass = kwargs.get('admin_password', None) if instance['name'] in self.driver.list_instances(): raise exception.Error(_("Instance has already been created")) LOG.audit(_("instance %s: starting..."), instance_id, context=context) - self.db.instance_update(context, - instance_id, - {'host': self.host, 'launched_on': self.host}) - + updates = {} + updates['host'] = self.host + updates['launched_on'] = self.host + # NOTE(vish): used by virt but not in database + updates['injected_files'] = kwargs.get('injected_files', []) + updates['admin_pass'] = kwargs.get('admin_password', None) + instance = self.db.instance_update(context, + instance_id, + updates) self.db.instance_set_state(context, instance_id, power_state.NOSTATE, -- cgit From 1da51f7b07f0080c44063a355c84fafd1fdf02bc Mon Sep 17 00:00:00 2001 From: Ryu Ishimoto Date: Mon, 11 Jul 2011 04:38:27 +0900 Subject: Moved 'setup_compute_network' logic into the virt layer --- nova/compute/manager.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'nova/compute') diff --git a/nova/compute/manager.py b/nova/compute/manager.py index bbbddde0a..753240614 100644 --- a/nova/compute/manager.py +++ b/nova/compute/manager.py @@ -293,8 +293,7 @@ class ComputeManager(manager.SchedulerDependentManager): network_info = self.network_api.allocate_for_instance(context, instance, vpn=is_vpn) LOG.debug(_("instance network_info: |%s|"), network_info) - self.network_manager.setup_compute_network(context, - instance_id) + self.driver.setup_vif_network(context, instance, network_info) else: # TODO(tr3buchet) not really sure how this should be handled. # virt requires network_info to be passed in but stub_network @@ -444,7 +443,6 @@ class ComputeManager(manager.SchedulerDependentManager): instance_id, power_state.NOSTATE, 'rebooting') - self.network_manager.setup_compute_network(context, instance_id) self.driver.reboot(instance_ref) self._update_state(context, instance_id) @@ -635,7 +633,7 @@ class ComputeManager(manager.SchedulerDependentManager): instance_id, power_state.NOSTATE, 'rescuing') - self.network_manager.setup_compute_network(context, instance_id) + self.driver.setup_vif_network(context, instance_id) _update_state = lambda result: self._update_state_callback( self, context, instance_id, result) self.driver.rescue(instance_ref, _update_state) @@ -1176,14 +1174,13 @@ class ComputeManager(manager.SchedulerDependentManager): max_retry = FLAGS.live_migration_retry_count for cnt in range(max_retry): try: - self.network_manager.setup_compute_network(context, - instance_id) + self.driver.setup_vif_network(context, instance_id) break except exception.ProcessExecutionError: if cnt == max_retry - 1: raise else: - LOG.warn(_("setup_compute_network() failed %(cnt)d." + LOG.warn(_("setup_vif_network() failed %(cnt)d." "Retry up to %(max_retry)d for %(hostname)s.") % locals()) time.sleep(1) -- cgit From 4c779a87651a37f9acf05f1101859a1ce4c288c1 Mon Sep 17 00:00:00 2001 From: "matt.dietz@rackspace.com" <> Date: Thu, 14 Jul 2011 17:49:29 -0500 Subject: First pass --- nova/compute/api.py | 15 ++++++---- nova/compute/manager.py | 74 ++++++++++++++++++++++++++----------------------- 2 files changed, 48 insertions(+), 41 deletions(-) (limited to 'nova/compute') diff --git a/nova/compute/api.py b/nova/compute/api.py index 432658bbb..7857f06a5 100644 --- a/nova/compute/api.py +++ b/nova/compute/api.py @@ -822,6 +822,7 @@ class API(base.Base): instance_id, params=rebuild_params) + @scheduler_api.reroute_compute("revert_resize") def revert_resize(self, context, instance_id): """Reverts a resize, deleting the 'new' instance in the process.""" context = context.elevated() @@ -832,11 +833,12 @@ class API(base.Base): status='finished') params = {'migration_id': migration_ref['id']} - self._cast_compute_message('revert_resize', context, instance_id, + self._cast_compute_message('revert_resize', context, migration_ref['dest_compute'], params=params) self.db.migration_update(context, migration_ref['id'], {'status': 'reverted'}) + @scheduler_api.reroute_compute("confirm_resize") def confirm_resize(self, context, instance_id): """Confirms a migration/resize and deletes the 'old' instance.""" context = context.elevated() @@ -845,9 +847,8 @@ class API(base.Base): if not migration_ref: raise exception.MigrationNotFoundByStatus(instance_id=instance_id, status='finished') - instance_ref = self.db.instance_get(context, instance_id) params = {'migration_id': migration_ref['id']} - self._cast_compute_message('confirm_resize', context, instance_id, + self._cast_compute_message('confirm_resize', context, migration_ref['source_compute'], params=params) self.db.migration_update(context, migration_ref['id'], @@ -855,6 +856,7 @@ class API(base.Base): self.db.instance_update(context, instance_id, {'host': migration_ref['dest_compute'], }) + @scheduler_api.reroute_compute("resize") def resize(self, context, instance_id, flavor_id=None): """Resize (ie, migrate) a running instance. @@ -862,8 +864,8 @@ class API(base.Base): the original flavor_id. If flavor_id is not None, the instance should be migrated to a new host and resized to the new flavor_id. """ - instance = self.db.instance_get(context, instance_id) - current_instance_type = instance['instance_type'] + instance_ref = self._get_instance(context, instance_id, 'resize') + current_instance_type = instance_ref['instance_type'] # If flavor_id is not provided, only migrate the instance. if not flavor_id: @@ -891,10 +893,11 @@ class API(base.Base): raise exception.ApiError(_("Invalid flavor: cannot use" "the same flavor. ")) + instance_ref = self._get_instance(context, instance_id, 'resize') self._cast_scheduler_message(context, {"method": "prep_resize", "args": {"topic": FLAGS.compute_topic, - "instance_id": instance_id, + "instance_uuid": instance_ref['uuid'], "flavor_id": new_instance_type['id']}}) @scheduler_api.reroute_compute("add_fixed_ip") diff --git a/nova/compute/manager.py b/nova/compute/manager.py index c627d2985..e00e3d0ab 100644 --- a/nova/compute/manager.py +++ b/nova/compute/manager.py @@ -664,10 +664,12 @@ class ComputeManager(manager.SchedulerDependentManager): @exception.wrap_exception @checks_instance_lock - def confirm_resize(self, context, instance_id, migration_id): + def confirm_resize(self, context, migration_id): """Destroys the source instance.""" - context = context.elevated() - instance_ref = self.db.instance_get(context, instance_id) + migration_ref = self.db.migration_get(context, migration_id) + instance_ref = self.db.instance_get(context, + migration_ref.instance_uuid) + self.driver.destroy(instance_ref) usage_info = utils.usage_from_instance(instance_ref) notifier_api.notify('compute.%s' % self.host, @@ -677,43 +679,44 @@ class ComputeManager(manager.SchedulerDependentManager): @exception.wrap_exception @checks_instance_lock - def revert_resize(self, context, instance_id, migration_id): + def revert_resize(self, context, migration_id): """Destroys the new instance on the destination machine. Reverts the model changes, and powers on the old instance on the source machine. """ - instance_ref = self.db.instance_get(context, instance_id) migration_ref = self.db.migration_get(context, migration_id) + instance_ref = self.db.instance_get(context, + migration_ref.instance_uuid) self.driver.destroy(instance_ref) topic = self.db.queue_get_for(context, FLAGS.compute_topic, instance_ref['host']) rpc.cast(context, topic, {'method': 'finish_revert_resize', - 'args': { - 'migration_id': migration_ref['id'], - 'instance_id': instance_id, }, + 'args': {'migration_id': migration_ref['id']}, }) @exception.wrap_exception @checks_instance_lock - def finish_revert_resize(self, context, instance_id, migration_id): + def finish_revert_resize(self, context, migration_id): """Finishes the second half of reverting a resize. Power back on the source instance and revert the resized attributes in the database. """ - instance_ref = self.db.instance_get(context, instance_id) migration_ref = self.db.migration_get(context, migration_id) + instance_ref = self.db.instance_get(context, + migration_ref.instance_uuid) + instance_type = self.db.instance_type_get_by_flavor_id(context, migration_ref['old_flavor_id']) # Just roll back the record. There's no need to resize down since # the 'old' VM already has the preferred attributes - self.db.instance_update(context, instance_id, + self.db.instance_update(context, instance_ref.instance_uuid, dict(memory_mb=instance_type['memory_mb'], vcpus=instance_type['vcpus'], local_gb=instance_type['local_gb'])) @@ -729,14 +732,14 @@ class ComputeManager(manager.SchedulerDependentManager): @exception.wrap_exception @checks_instance_lock - def prep_resize(self, context, instance_id, flavor_id): + def prep_resize(self, context, instance_uuid, flavor_id): """Initiates the process of moving a running instance to another host. Possibly changes the RAM and disk size in the process. """ context = context.elevated() - instance_ref = self.db.instance_get(context, instance_id) + instance_ref = self.db.instance_get_by_uuid(context, instance_uuid) if instance_ref['host'] == FLAGS.host: raise exception.Error(_( 'Migration error: destination same as source!')) @@ -744,7 +747,7 @@ class ComputeManager(manager.SchedulerDependentManager): instance_type = self.db.instance_type_get_by_flavor_id(context, flavor_id) migration_ref = self.db.migration_create(context, - {'instance_id': instance_id, + {'instance_uuid': instance_uuid, 'source_compute': instance_ref['host'], 'dest_compute': FLAGS.host, 'dest_host': self.driver.get_host_ip_addr(), @@ -752,15 +755,13 @@ class ComputeManager(manager.SchedulerDependentManager): 'new_flavor_id': flavor_id, 'status': 'pre-migrating'}) - LOG.audit(_('instance %s: migrating to '), instance_id, + LOG.audit(_('instance %s: migrating to '), instance_uuid, context=context) topic = self.db.queue_get_for(context, FLAGS.compute_topic, instance_ref['host']) rpc.cast(context, topic, {'method': 'resize_instance', - 'args': { - 'migration_id': migration_ref['id'], - 'instance_id': instance_id, }, + 'args': {'migration_id': migration_ref['id']}, }) usage_info = utils.usage_from_instance(instance_ref, new_instance_type=instance_type['name'], @@ -772,10 +773,12 @@ class ComputeManager(manager.SchedulerDependentManager): @exception.wrap_exception @checks_instance_lock - def resize_instance(self, context, instance_id, migration_id): + def resize_instance(self, context, migration_id): """Starts the migration of a running instance to another host.""" migration_ref = self.db.migration_get(context, migration_id) - instance_ref = self.db.instance_get(context, instance_id) + instance_ref = self.db.instance_get_by_uuid(context, + migration_ref.instance_uuid) + self.db.migration_update(context, migration_id, {'status': 'migrating'}) @@ -791,14 +794,14 @@ class ComputeManager(manager.SchedulerDependentManager): topic = self.db.queue_get_for(context, FLAGS.compute_topic, migration_ref['dest_compute']) + params = {'migration_id': migration_id, + 'disk_info': disk_info} rpc.cast(context, topic, {'method': 'finish_resize', - 'args': {'migration_id': migration_id, - 'instance_id': instance_id, - 'disk_info': disk_info}}) + 'args': params}) @exception.wrap_exception @checks_instance_lock - def finish_resize(self, context, instance_id, migration_id, disk_info): + def finish_resize(self, context, migration_id, disk_info): """Completes the migration process. Sets up the newly transferred disk and turns on the instance at its @@ -806,24 +809,21 @@ class ComputeManager(manager.SchedulerDependentManager): """ migration_ref = self.db.migration_get(context, migration_id) - instance_ref = self.db.instance_get(context, - migration_ref['instance_id']) - # TODO(mdietz): apply the rest of the instance_type attributes going - # after they're supported + instance_ref = self.db.instance_get_by_uuid(context, + migration_ref.instance_uuid) instance_type = self.db.instance_type_get_by_flavor_id(context, migration_ref['new_flavor_id']) - self.db.instance_update(context, instance_id, + self.db.instance_update(context, instance_ref.uuid, dict(instance_type_id=instance_type['id'], memory_mb=instance_type['memory_mb'], vcpus=instance_type['vcpus'], local_gb=instance_type['local_gb'])) - # reload the updated instance ref - # FIXME(mdietz): is there reload functionality? - instance = self.db.instance_get(context, instance_id) + instance_ref = self.db.instance_get_by_uuid(context, + instance_ref.uuid) network_info = self.network_api.get_instance_nw_info(context, - instance) - self.driver.finish_resize(instance, disk_info, network_info) + instance_ref) + self.driver.finish_resize(instance_ref, disk_info, network_info) self.db.migration_update(context, migration_id, {'status': 'finished', }) @@ -955,7 +955,11 @@ class ComputeManager(manager.SchedulerDependentManager): context = context.elevated() LOG.debug(_('instance %s: getting locked state'), instance_id, context=context) - instance_ref = self.db.instance_get(context, instance_id) + if utils.is_uuid_like(instance_id): + uuid = instance_id + instance_ref = self.db.instance_get_by_uuid(context, uuid) + else: + instance_ref = self.db.instance_get(context, instance_id) return instance_ref['locked'] @checks_instance_lock -- cgit From c8a35349be912bb862789059abc95ccf9f7b8ef5 Mon Sep 17 00:00:00 2001 From: Matt Dietz Date: Fri, 15 Jul 2011 19:07:58 +0000 Subject: Updated with some changes from manual testing --- nova/compute/api.py | 14 +++++++++----- nova/compute/manager.py | 21 +++++++++++++++------ 2 files changed, 24 insertions(+), 11 deletions(-) (limited to 'nova/compute') diff --git a/nova/compute/api.py b/nova/compute/api.py index 7857f06a5..2233b9225 100644 --- a/nova/compute/api.py +++ b/nova/compute/api.py @@ -826,15 +826,16 @@ class API(base.Base): def revert_resize(self, context, instance_id): """Reverts a resize, deleting the 'new' instance in the process.""" context = context.elevated() + instance_ref = self._get_instance(context, instance_id, 'confirm_resize') migration_ref = self.db.migration_get_by_instance_and_status(context, - instance_id, 'finished') + instance_ref['uuid'], 'finished') if not migration_ref: raise exception.MigrationNotFoundByStatus(instance_id=instance_id, status='finished') params = {'migration_id': migration_ref['id']} self._cast_compute_message('revert_resize', context, - migration_ref['dest_compute'], params=params) + instance_ref['uuid'], params=params) self.db.migration_update(context, migration_ref['id'], {'status': 'reverted'}) @@ -842,14 +843,17 @@ class API(base.Base): def confirm_resize(self, context, instance_id): """Confirms a migration/resize and deletes the 'old' instance.""" context = context.elevated() + + instance_ref = self._get_instance(context, instance_id, 'confirm_resize') migration_ref = self.db.migration_get_by_instance_and_status(context, - instance_id, 'finished') + instance_ref['uuid'], 'finished') if not migration_ref: raise exception.MigrationNotFoundByStatus(instance_id=instance_id, status='finished') params = {'migration_id': migration_ref['id']} self._cast_compute_message('confirm_resize', context, - migration_ref['source_compute'], params=params) + instance_ref['uuid'], + params=params) self.db.migration_update(context, migration_ref['id'], {'status': 'confirmed'}) @@ -897,7 +901,7 @@ class API(base.Base): self._cast_scheduler_message(context, {"method": "prep_resize", "args": {"topic": FLAGS.compute_topic, - "instance_uuid": instance_ref['uuid'], + "instance_id": instance_ref['uuid'], "flavor_id": new_instance_type['id']}}) @scheduler_api.reroute_compute("add_fixed_ip") diff --git a/nova/compute/manager.py b/nova/compute/manager.py index e00e3d0ab..55bc1cdcd 100644 --- a/nova/compute/manager.py +++ b/nova/compute/manager.py @@ -89,6 +89,10 @@ def checks_instance_lock(function): """Decorator to prevent action against locked instances for non-admins.""" @functools.wraps(function) def decorated_function(self, context, instance_id, *args, **kwargs): + #TODO(anyone): this being called instance_id is forcing a slightly + # confusing convention of pushing instance_uuids + # through an "instance_id" key in the queue args dict when + # casting through the compute API LOG.info(_("check_instance_lock: decorating: |%s|"), function, context=context) LOG.info(_("check_instance_lock: arguments: |%(self)s| |%(context)s|" @@ -664,10 +668,10 @@ class ComputeManager(manager.SchedulerDependentManager): @exception.wrap_exception @checks_instance_lock - def confirm_resize(self, context, migration_id): + def confirm_resize(self, context, instance_id, migration_id): """Destroys the source instance.""" migration_ref = self.db.migration_get(context, migration_id) - instance_ref = self.db.instance_get(context, + instance_ref = self.db.instance_get_by_uuid(context, migration_ref.instance_uuid) self.driver.destroy(instance_ref) @@ -679,7 +683,7 @@ class ComputeManager(manager.SchedulerDependentManager): @exception.wrap_exception @checks_instance_lock - def revert_resize(self, context, migration_id): + def revert_resize(self, context, instance_id, migration_id): """Destroys the new instance on the destination machine. Reverts the model changes, and powers on the old instance on the @@ -687,7 +691,7 @@ class ComputeManager(manager.SchedulerDependentManager): """ migration_ref = self.db.migration_get(context, migration_id) - instance_ref = self.db.instance_get(context, + instance_ref = self.db.instance_get_by_uuid(context, migration_ref.instance_uuid) self.driver.destroy(instance_ref) @@ -732,14 +736,19 @@ class ComputeManager(manager.SchedulerDependentManager): @exception.wrap_exception @checks_instance_lock - def prep_resize(self, context, instance_uuid, flavor_id): + def prep_resize(self, context, instance_id, flavor_id): """Initiates the process of moving a running instance to another host. Possibly changes the RAM and disk size in the process. """ context = context.elevated() - instance_ref = self.db.instance_get_by_uuid(context, instance_uuid) + + # Because of checks_instance_lock, this must currently be called + # instance_id. However, the compute API is always passing the UUID + # of the instance down + instance_ref = self.db.instance_get_by_uuid(context, instance_id) + if instance_ref['host'] == FLAGS.host: raise exception.Error(_( 'Migration error: destination same as source!')) -- cgit From 435c205ddc04c5d5c33d23a326ade38dab8ed943 Mon Sep 17 00:00:00 2001 From: "matt.dietz@rackspace.com" <> Date: Fri, 15 Jul 2011 14:20:44 -0500 Subject: One last nit --- nova/compute/manager.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'nova/compute') diff --git a/nova/compute/manager.py b/nova/compute/manager.py index 9788f6147..0e41e2a19 100644 --- a/nova/compute/manager.py +++ b/nova/compute/manager.py @@ -712,7 +712,7 @@ class ComputeManager(manager.SchedulerDependentManager): """ migration_ref = self.db.migration_get(context, migration_id) - instance_ref = self.db.instance_get(context, + instance_ref = self.db.instance_get_by_uuid(context, migration_ref.instance_uuid) instance_type = self.db.instance_type_get_by_flavor_id(context, @@ -720,7 +720,7 @@ class ComputeManager(manager.SchedulerDependentManager): # Just roll back the record. There's no need to resize down since # the 'old' VM already has the preferred attributes - self.db.instance_update(context, instance_ref.instance_uuid, + self.db.instance_update(context, instance_ref['uuid'], dict(memory_mb=instance_type['memory_mb'], vcpus=instance_type['vcpus'], local_gb=instance_type['local_gb'])) -- cgit From 8bc0dcc54a7218bd9f567c5719718f540f6ac549 Mon Sep 17 00:00:00 2001 From: Matt Dietz Date: Mon, 18 Jul 2011 22:16:38 +0000 Subject: Some missed instance_id casts --- nova/compute/manager.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'nova/compute') diff --git a/nova/compute/manager.py b/nova/compute/manager.py index 0e41e2a19..1feb96faa 100644 --- a/nova/compute/manager.py +++ b/nova/compute/manager.py @@ -770,7 +770,8 @@ class ComputeManager(manager.SchedulerDependentManager): instance_ref['host']) rpc.cast(context, topic, {'method': 'resize_instance', - 'args': {'migration_id': migration_ref['id']}, + 'args': { 'instance_id': instance_ref['uuid'], + 'migration_id': migration_ref['id']}, }) usage_info = utils.usage_from_instance(instance_ref, new_instance_type=instance_type['name'], @@ -782,7 +783,7 @@ class ComputeManager(manager.SchedulerDependentManager): @exception.wrap_exception @checks_instance_lock - def resize_instance(self, context, migration_id): + def resize_instance(self, context, instance_id, migration_id): """Starts the migration of a running instance to another host.""" migration_ref = self.db.migration_get(context, migration_id) instance_ref = self.db.instance_get_by_uuid(context, @@ -804,13 +805,14 @@ class ComputeManager(manager.SchedulerDependentManager): FLAGS.compute_topic, migration_ref['dest_compute']) params = {'migration_id': migration_id, - 'disk_info': disk_info} + 'disk_info': disk_info, + 'instance_id': instance_ref['uuid']} rpc.cast(context, topic, {'method': 'finish_resize', 'args': params}) @exception.wrap_exception @checks_instance_lock - def finish_resize(self, context, migration_id, disk_info): + def finish_resize(self, context, instance_id, migration_id, disk_info): """Completes the migration process. Sets up the newly transferred disk and turns on the instance at its -- cgit From 115727a7cd41e703b35b6b061b64d097b9bbbf1d Mon Sep 17 00:00:00 2001 From: "matt.dietz@rackspace.com" <> Date: Mon, 18 Jul 2011 17:58:33 -0500 Subject: Fixed the broken tests again --- nova/compute/manager.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'nova/compute') diff --git a/nova/compute/manager.py b/nova/compute/manager.py index 1feb96faa..595e2e334 100644 --- a/nova/compute/manager.py +++ b/nova/compute/manager.py @@ -770,9 +770,8 @@ class ComputeManager(manager.SchedulerDependentManager): instance_ref['host']) rpc.cast(context, topic, {'method': 'resize_instance', - 'args': { 'instance_id': instance_ref['uuid'], - 'migration_id': migration_ref['id']}, - }) + 'args': {'instance_id': instance_ref['uuid'], + 'migration_id': migration_ref['id']}}) usage_info = utils.usage_from_instance(instance_ref, new_instance_type=instance_type['name'], new_instance_type_id=instance_type['id']) -- cgit From 7e4a23c489946eb5e6a1568d197cab34367d8078 Mon Sep 17 00:00:00 2001 From: Dan Wendlandt Date: Tue, 19 Jul 2011 00:26:58 -0700 Subject: merge of ovs L2 branch --- nova/compute/manager.py | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'nova/compute') diff --git a/nova/compute/manager.py b/nova/compute/manager.py index 753240614..863e6bc18 100644 --- a/nova/compute/manager.py +++ b/nova/compute/manager.py @@ -293,7 +293,7 @@ class ComputeManager(manager.SchedulerDependentManager): network_info = self.network_api.allocate_for_instance(context, instance, vpn=is_vpn) LOG.debug(_("instance network_info: |%s|"), network_info) - self.driver.setup_vif_network(context, instance, network_info) + self.driver.setup_vif_network(context, instance) else: # TODO(tr3buchet) not really sure how this should be handled. # virt requires network_info to be passed in but stub_network @@ -348,7 +348,10 @@ class ComputeManager(manager.SchedulerDependentManager): {'action_str': action_str, 'instance_id': instance_id}, context=context) + network_info = None if not FLAGS.stub_network: + network_info = self.network_api.get_instance_nw_info(context, + instance) self.network_api.deallocate_for_instance(context, instance) volumes = instance.get('volumes') or [] @@ -360,7 +363,7 @@ class ComputeManager(manager.SchedulerDependentManager): self.db.instance_destroy(context, instance_id) raise exception.Error(_('trying to destroy already destroyed' ' instance: %s') % instance_id) - self.driver.destroy(instance) + self.driver.destroy(instance,network_info) if action_str == 'Terminating': terminate_volumes(self.db, context, instance_id) @@ -406,7 +409,9 @@ class ComputeManager(manager.SchedulerDependentManager): self._update_state(context, instance_id, power_state.BUILDING) - self.driver.destroy(instance_ref) + network_info = self.network_api.get_instance_nw_info(context, + instance_ref) + self.driver.destroy(instance_ref,network_info) image_ref = kwargs.get('image_ref') instance_ref.image_ref = image_ref instance_ref.injected_files = kwargs.get('injected_files', []) @@ -666,7 +671,10 @@ class ComputeManager(manager.SchedulerDependentManager): """Destroys the source instance.""" context = context.elevated() instance_ref = self.db.instance_get(context, instance_id) - self.driver.destroy(instance_ref) + + network_info = self.network_api.get_instance_nw_info(context, + instance_ref) + self.driver.destroy(instance_ref,network_info) usage_info = utils.usage_from_instance(instance_ref) notifier_api.notify('compute.%s' % self.host, 'compute.instance.resize.confirm', @@ -685,7 +693,9 @@ class ComputeManager(manager.SchedulerDependentManager): instance_ref = self.db.instance_get(context, instance_id) migration_ref = self.db.migration_get(context, migration_id) - self.driver.destroy(instance_ref) + network_info = self.network_api.get_instance_nw_info(context, + instance_ref) + self.driver.destroy(instance_ref,network_info) topic = self.db.queue_get_for(context, FLAGS.compute_topic, instance_ref['host']) rpc.cast(context, topic, -- cgit From 9fe72ac7b0ed0f8e294b97e267393f352c4af97f Mon Sep 17 00:00:00 2001 From: Dan Wendlandt Date: Tue, 19 Jul 2011 00:40:05 -0700 Subject: cleanup --- nova/compute/manager.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'nova/compute') diff --git a/nova/compute/manager.py b/nova/compute/manager.py index 863e6bc18..8670465c4 100644 --- a/nova/compute/manager.py +++ b/nova/compute/manager.py @@ -363,7 +363,7 @@ class ComputeManager(manager.SchedulerDependentManager): self.db.instance_destroy(context, instance_id) raise exception.Error(_('trying to destroy already destroyed' ' instance: %s') % instance_id) - self.driver.destroy(instance,network_info) + self.driver.destroy(instance, network_info) if action_str == 'Terminating': terminate_volumes(self.db, context, instance_id) @@ -411,7 +411,7 @@ class ComputeManager(manager.SchedulerDependentManager): network_info = self.network_api.get_instance_nw_info(context, instance_ref) - self.driver.destroy(instance_ref,network_info) + self.driver.destroy(instance_ref, network_info) image_ref = kwargs.get('image_ref') instance_ref.image_ref = image_ref instance_ref.injected_files = kwargs.get('injected_files', []) @@ -674,7 +674,7 @@ class ComputeManager(manager.SchedulerDependentManager): network_info = self.network_api.get_instance_nw_info(context, instance_ref) - self.driver.destroy(instance_ref,network_info) + self.driver.destroy(instance_ref, network_info) usage_info = utils.usage_from_instance(instance_ref) notifier_api.notify('compute.%s' % self.host, 'compute.instance.resize.confirm', @@ -695,7 +695,7 @@ class ComputeManager(manager.SchedulerDependentManager): network_info = self.network_api.get_instance_nw_info(context, instance_ref) - self.driver.destroy(instance_ref,network_info) + self.driver.destroy(instance_ref, network_info) topic = self.db.queue_get_for(context, FLAGS.compute_topic, instance_ref['host']) rpc.cast(context, topic, -- cgit From f55a362c0893c464055b125f6ef2853a8d26a4b5 Mon Sep 17 00:00:00 2001 From: Ryu Ishimoto Date: Wed, 20 Jul 2011 00:57:35 +0900 Subject: Fixed bad parameters to setup_vif_networks --- nova/compute/manager.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'nova/compute') diff --git a/nova/compute/manager.py b/nova/compute/manager.py index 753240614..2bda5b409 100644 --- a/nova/compute/manager.py +++ b/nova/compute/manager.py @@ -293,7 +293,7 @@ class ComputeManager(manager.SchedulerDependentManager): network_info = self.network_api.allocate_for_instance(context, instance, vpn=is_vpn) LOG.debug(_("instance network_info: |%s|"), network_info) - self.driver.setup_vif_network(context, instance, network_info) + self.driver.setup_vif_network(context, instance['id']) else: # TODO(tr3buchet) not really sure how this should be handled. # virt requires network_info to be passed in but stub_network -- cgit From 7e204b9df840c597a137b605a0d640222a5b97b6 Mon Sep 17 00:00:00 2001 From: "matt.dietz@rackspace.com" <> Date: Tue, 19 Jul 2011 11:25:33 -0500 Subject: Beginnings of the patch --- nova/compute/manager.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'nova/compute') diff --git a/nova/compute/manager.py b/nova/compute/manager.py index 960dfea54..0c82b155b 100644 --- a/nova/compute/manager.py +++ b/nova/compute/manager.py @@ -743,6 +743,8 @@ class ComputeManager(manager.SchedulerDependentManager): raise exception.Error(_( 'Migration error: destination same as source!')) + old_instance_type = self.db.instance_type_get_by_flavor_id(context, + instance_ref['instance_type_id']) instance_type = self.db.instance_type_get_by_flavor_id(context, flavor_id) migration_ref = self.db.migration_create(context, @@ -750,7 +752,7 @@ class ComputeManager(manager.SchedulerDependentManager): 'source_compute': instance_ref['host'], 'dest_compute': FLAGS.host, 'dest_host': self.driver.get_host_ip_addr(), - 'old_flavor_id': instance_type['flavorid'], + 'old_flavor_id': old_instance_type['flavorid'], 'new_flavor_id': flavor_id, 'status': 'pre-migrating'}) -- cgit From b2637c282fba3d542c4e157e3e5e22046d28bb29 Mon Sep 17 00:00:00 2001 From: "matt.dietz@rackspace.com" <> Date: Tue, 19 Jul 2011 15:21:39 -0500 Subject: Functionality fixed and new test passing --- nova/compute/manager.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'nova/compute') diff --git a/nova/compute/manager.py b/nova/compute/manager.py index b91e6b9af..eb3996d29 100644 --- a/nova/compute/manager.py +++ b/nova/compute/manager.py @@ -720,7 +720,8 @@ class ComputeManager(manager.SchedulerDependentManager): self.db.instance_update(context, instance_id, dict(memory_mb=instance_type['memory_mb'], vcpus=instance_type['vcpus'], - local_gb=instance_type['local_gb'])) + local_gb=instance_type['local_gb'], + instance_type_id=instance_type['id'])) self.driver.revert_resize(instance_ref) self.db.migration_update(context, migration_id, @@ -741,14 +742,14 @@ class ComputeManager(manager.SchedulerDependentManager): """ context = context.elevated() instance_ref = self.db.instance_get(context, instance_id) + if instance_ref['host'] == FLAGS.host: raise exception.Error(_( 'Migration error: destination same as source!')) - old_instance_type = self.db.instance_type_get_by_flavor_id(context, + old_instance_type = self.db.instance_type_get_by_id(context, instance_ref['instance_type_id']) - instance_type = self.db.instance_type_get_by_flavor_id(context, - flavor_id) + migration_ref = self.db.migration_create(context, {'instance_id': instance_id, 'source_compute': instance_ref['host'], @@ -768,6 +769,9 @@ class ComputeManager(manager.SchedulerDependentManager): 'migration_id': migration_ref['id'], 'instance_id': instance_id, }, }) + + instance_type = self.db.instance_type_get_by_flavor_id(context, + flavor_id) usage_info = utils.usage_from_instance(instance_ref, new_instance_type=instance_type['name'], new_instance_type_id=instance_type['id']) -- cgit From 45bdf5cc27c9389255d32ad189a561b967b8f89e Mon Sep 17 00:00:00 2001 From: "matt.dietz@rackspace.com" <> Date: Tue, 19 Jul 2011 16:25:16 -0500 Subject: Fixes lp813006 - inconsistent DB API naming --- nova/compute/instance_types.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'nova/compute') diff --git a/nova/compute/instance_types.py b/nova/compute/instance_types.py index 1d246e445..c13a629a9 100644 --- a/nova/compute/instance_types.py +++ b/nova/compute/instance_types.py @@ -112,7 +112,7 @@ def get_instance_type(id): return get_default_instance_type() try: ctxt = context.get_admin_context() - return db.instance_type_get_by_id(ctxt, id) + return db.instance_type_get(ctxt, id) except exception.DBError: raise exception.ApiError(_("Unknown instance type: %s") % id) -- cgit From 6fafda1ffbf2838ef33a4948303f24ed075c292d Mon Sep 17 00:00:00 2001 From: Ryu Ishimoto Date: Wed, 20 Jul 2011 06:42:49 +0900 Subject: Renamed setup_vif_network to plug_vif --- nova/compute/manager.py | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'nova/compute') diff --git a/nova/compute/manager.py b/nova/compute/manager.py index eb52995be..0894052ce 100644 --- a/nova/compute/manager.py +++ b/nova/compute/manager.py @@ -299,7 +299,7 @@ class ComputeManager(manager.SchedulerDependentManager): network_info = self.network_api.allocate_for_instance(context, instance, vpn=is_vpn) LOG.debug(_("instance network_info: |%s|"), network_info) - self.driver.setup_vif_network(context, instance['id']) + self.driver.plug_vifs(context, instance, network_info) else: # TODO(tr3buchet) not really sure how this should be handled. # virt requires network_info to be passed in but stub_network @@ -356,7 +356,7 @@ class ComputeManager(manager.SchedulerDependentManager): network_info = None if not FLAGS.stub_network: network_info = self.network_api.get_instance_nw_info(context, - instance) + instance) self.network_api.deallocate_for_instance(context, instance) volumes = instance.get('volumes') or [] @@ -414,7 +414,7 @@ class ComputeManager(manager.SchedulerDependentManager): self._update_state(context, instance_id, power_state.BUILDING) network_info = self.network_api.get_instance_nw_info(context, - instance_ref) + instance_ref) self.driver.destroy(instance_ref, network_info) image_ref = kwargs.get('image_ref') instance_ref.image_ref = image_ref @@ -642,7 +642,9 @@ class ComputeManager(manager.SchedulerDependentManager): instance_id, power_state.NOSTATE, 'rescuing') - self.driver.setup_vif_network(context, instance_id) + network_info = self.network_api.get_instance_nw_info(context, + instance_ref) + self.driver.plug_vifs(context, instance_ref, network_info) _update_state = lambda result: self._update_state_callback( self, context, instance_id, result) self.driver.rescue(instance_ref, _update_state) @@ -677,7 +679,7 @@ class ComputeManager(manager.SchedulerDependentManager): instance_ref = self.db.instance_get(context, instance_id) network_info = self.network_api.get_instance_nw_info(context, - instance_ref) + instance_ref) self.driver.destroy(instance_ref, network_info) usage_info = utils.usage_from_instance(instance_ref) notifier.notify('compute.%s' % self.host, @@ -698,7 +700,7 @@ class ComputeManager(manager.SchedulerDependentManager): migration_ref = self.db.migration_get(context, migration_id) network_info = self.network_api.get_instance_nw_info(context, - instance_ref) + instance_ref) self.driver.destroy(instance_ref, network_info) topic = self.db.queue_get_for(context, FLAGS.compute_topic, instance_ref['host']) @@ -1203,16 +1205,18 @@ class ComputeManager(manager.SchedulerDependentManager): # # Retry operation is necessary because continuously request comes, # concorrent request occurs to iptables, then it complains. + network_info = self.network_api.get_instance_nw_info(context, + instance_ref) max_retry = FLAGS.live_migration_retry_count for cnt in range(max_retry): try: - self.driver.setup_vif_network(context, instance_id) + self.driver.plug_vifs(context, instance_ref, network_info) break except exception.ProcessExecutionError: if cnt == max_retry - 1: raise else: - LOG.warn(_("setup_vif_network() failed %(cnt)d." + LOG.warn(_("plug_vifs() failed %(cnt)d." "Retry up to %(max_retry)d for %(hostname)s.") % locals()) time.sleep(1) -- cgit From 798a5e31b304df1c59e226f9426c07cb250dae16 Mon Sep 17 00:00:00 2001 From: Ryu Ishimoto Date: Wed, 20 Jul 2011 20:21:44 +0900 Subject: Added network_info parameter to all the appropriate places in virt layers and compute manager --- nova/compute/manager.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'nova/compute') diff --git a/nova/compute/manager.py b/nova/compute/manager.py index 0894052ce..98f3cc86f 100644 --- a/nova/compute/manager.py +++ b/nova/compute/manager.py @@ -419,7 +419,7 @@ class ComputeManager(manager.SchedulerDependentManager): image_ref = kwargs.get('image_ref') instance_ref.image_ref = image_ref instance_ref.injected_files = kwargs.get('injected_files', []) - self.driver.spawn(instance_ref) + self.driver.spawn(instance_ref, network_info) self._update_image_ref(context, instance_id, image_ref) self._update_launched_at(context, instance_id) @@ -452,7 +452,9 @@ class ComputeManager(manager.SchedulerDependentManager): instance_id, power_state.NOSTATE, 'rebooting') - self.driver.reboot(instance_ref) + network_info = self.network_api.get_instance_nw_info(context, + instance_ref) + self.driver.reboot(instance_ref, network_info) self._update_state(context, instance_id) @exception.wrap_exception(notifier=notifier, publisher_id=publisher_id()) @@ -647,7 +649,7 @@ class ComputeManager(manager.SchedulerDependentManager): self.driver.plug_vifs(context, instance_ref, network_info) _update_state = lambda result: self._update_state_callback( self, context, instance_id, result) - self.driver.rescue(instance_ref, _update_state) + self.driver.rescue(instance_ref, _update_state, network_info) self._update_state(context, instance_id) @exception.wrap_exception(notifier=notifier, publisher_id=publisher_id()) @@ -663,7 +665,9 @@ class ComputeManager(manager.SchedulerDependentManager): 'unrescuing') _update_state = lambda result: self._update_state_callback( self, context, instance_id, result) - self.driver.unrescue(instance_ref, _update_state) + network_info = self.network_api.get_instance_nw_info(context, + instance_ref) + self.driver.unrescue(instance_ref, _update_state, network_info) self._update_state(context, instance_id) @staticmethod -- cgit From 0c66b0b8caad7437fa2afd64a2038bcb166c83a5 Mon Sep 17 00:00:00 2001 From: Ryu Ishimoto Date: Wed, 20 Jul 2011 21:34:30 +0900 Subject: Merged get_configurations and plug of VIF drivers --- nova/compute/manager.py | 2 -- 1 file changed, 2 deletions(-) (limited to 'nova/compute') diff --git a/nova/compute/manager.py b/nova/compute/manager.py index 98f3cc86f..2ade43503 100644 --- a/nova/compute/manager.py +++ b/nova/compute/manager.py @@ -299,7 +299,6 @@ class ComputeManager(manager.SchedulerDependentManager): network_info = self.network_api.allocate_for_instance(context, instance, vpn=is_vpn) LOG.debug(_("instance network_info: |%s|"), network_info) - self.driver.plug_vifs(context, instance, network_info) else: # TODO(tr3buchet) not really sure how this should be handled. # virt requires network_info to be passed in but stub_network @@ -646,7 +645,6 @@ class ComputeManager(manager.SchedulerDependentManager): 'rescuing') network_info = self.network_api.get_instance_nw_info(context, instance_ref) - self.driver.plug_vifs(context, instance_ref, network_info) _update_state = lambda result: self._update_state_callback( self, context, instance_id, result) self.driver.rescue(instance_ref, _update_state, network_info) -- cgit From 27d8dc42120d3cefc91bf6510f215dfdef7f23d2 Mon Sep 17 00:00:00 2001 From: Ryu Ishimoto Date: Wed, 20 Jul 2011 22:21:48 +0900 Subject: Removed unnecessary context parameter --- nova/compute/manager.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'nova/compute') diff --git a/nova/compute/manager.py b/nova/compute/manager.py index 2ade43503..cc5cf747c 100644 --- a/nova/compute/manager.py +++ b/nova/compute/manager.py @@ -1212,7 +1212,7 @@ class ComputeManager(manager.SchedulerDependentManager): max_retry = FLAGS.live_migration_retry_count for cnt in range(max_retry): try: - self.driver.plug_vifs(context, instance_ref, network_info) + self.driver.plug_vifs(instance_ref, network_info) break except exception.ProcessExecutionError: if cnt == max_retry - 1: -- cgit From 2bf85d9151771aa4ca5c1201cadbb255db85643f Mon Sep 17 00:00:00 2001 From: Ryu Ishimoto Date: Thu, 21 Jul 2011 02:26:31 +0900 Subject: Created _get_instance_nw_info method to clean up duplicate code --- nova/compute/manager.py | 41 ++++++++++++++++++++--------------------- 1 file changed, 20 insertions(+), 21 deletions(-) (limited to 'nova/compute') diff --git a/nova/compute/manager.py b/nova/compute/manager.py index cc5cf747c..326880b1c 100644 --- a/nova/compute/manager.py +++ b/nova/compute/manager.py @@ -212,6 +212,15 @@ class ComputeManager(manager.SchedulerDependentManager): """This call passes straight through to the virtualization driver.""" return self.driver.refresh_provider_fw_rules() + def _get_instance_nw_info(self, context, instance): + """Get a list of dictionaries of network data of an instance. + Returns an empty list if stub_network flag is set.""" + network_info = [] + if not FLAGS.stub_network: + network_info = self.network_api.get_instance_nw_info(context, + instance) + return network_info + def _setup_block_device_mapping(self, context, instance_id): """setup volumes for block device mapping""" self.db.instance_set_state(context, @@ -352,10 +361,8 @@ class ComputeManager(manager.SchedulerDependentManager): {'action_str': action_str, 'instance_id': instance_id}, context=context) - network_info = None + network_info = self._get_instance_nw_info(context, instance) if not FLAGS.stub_network: - network_info = self.network_api.get_instance_nw_info(context, - instance) self.network_api.deallocate_for_instance(context, instance) volumes = instance.get('volumes') or [] @@ -412,8 +419,8 @@ class ComputeManager(manager.SchedulerDependentManager): self._update_state(context, instance_id, power_state.BUILDING) - network_info = self.network_api.get_instance_nw_info(context, - instance_ref) + network_info = self._get_instance_nw_info(context, instance_ref) + self.driver.destroy(instance_ref, network_info) image_ref = kwargs.get('image_ref') instance_ref.image_ref = image_ref @@ -451,8 +458,7 @@ class ComputeManager(manager.SchedulerDependentManager): instance_id, power_state.NOSTATE, 'rebooting') - network_info = self.network_api.get_instance_nw_info(context, - instance_ref) + network_info = self._get_instance_nw_info(context, instance_ref) self.driver.reboot(instance_ref, network_info) self._update_state(context, instance_id) @@ -643,10 +649,9 @@ class ComputeManager(manager.SchedulerDependentManager): instance_id, power_state.NOSTATE, 'rescuing') - network_info = self.network_api.get_instance_nw_info(context, - instance_ref) _update_state = lambda result: self._update_state_callback( self, context, instance_id, result) + network_info = self._get_instance_nw_info(context, instance_ref) self.driver.rescue(instance_ref, _update_state, network_info) self._update_state(context, instance_id) @@ -663,8 +668,7 @@ class ComputeManager(manager.SchedulerDependentManager): 'unrescuing') _update_state = lambda result: self._update_state_callback( self, context, instance_id, result) - network_info = self.network_api.get_instance_nw_info(context, - instance_ref) + network_info = self._get_instance_nw_info(context, instance_ref) self.driver.unrescue(instance_ref, _update_state, network_info) self._update_state(context, instance_id) @@ -680,8 +684,7 @@ class ComputeManager(manager.SchedulerDependentManager): context = context.elevated() instance_ref = self.db.instance_get(context, instance_id) - network_info = self.network_api.get_instance_nw_info(context, - instance_ref) + network_info = self._get_instance_nw_info(context, instance_ref) self.driver.destroy(instance_ref, network_info) usage_info = utils.usage_from_instance(instance_ref) notifier.notify('compute.%s' % self.host, @@ -701,8 +704,7 @@ class ComputeManager(manager.SchedulerDependentManager): instance_ref = self.db.instance_get(context, instance_id) migration_ref = self.db.migration_get(context, migration_id) - network_info = self.network_api.get_instance_nw_info(context, - instance_ref) + network_info = self._get_instance_nw_info(context, instance_ref) self.driver.destroy(instance_ref, network_info) topic = self.db.queue_get_for(context, FLAGS.compute_topic, instance_ref['host']) @@ -837,8 +839,7 @@ class ComputeManager(manager.SchedulerDependentManager): # reload the updated instance ref # FIXME(mdietz): is there reload functionality? instance = self.db.instance_get(context, instance_id) - network_info = self.network_api.get_instance_nw_info(context, - instance) + network_info = self._get_instance_nw_info(context, instance) self.driver.finish_resize(instance, disk_info, network_info) self.db.migration_update(context, migration_id, @@ -988,8 +989,7 @@ class ComputeManager(manager.SchedulerDependentManager): LOG.debug(_('instance %s: inject network info'), instance_id, context=context) instance = self.db.instance_get(context, instance_id) - network_info = self.network_api.get_instance_nw_info(context, - instance) + network_info = self._get_instance_nw_info(context, instance) LOG.debug(_("network_info to inject: |%s|"), network_info) self.driver.inject_network_info(instance, network_info) @@ -1207,8 +1207,7 @@ class ComputeManager(manager.SchedulerDependentManager): # # Retry operation is necessary because continuously request comes, # concorrent request occurs to iptables, then it complains. - network_info = self.network_api.get_instance_nw_info(context, - instance_ref) + network_info = self._get_instance_nw_info(context, instance_ref) max_retry = FLAGS.live_migration_retry_count for cnt in range(max_retry): try: -- cgit From a497d2e8f6beb667c73f66bef756fd955b9d6d69 Mon Sep 17 00:00:00 2001 From: "matt.dietz@rackspace.com" <> Date: Wed, 20 Jul 2011 12:26:50 -0500 Subject: Host fix --- nova/compute/api.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'nova/compute') diff --git a/nova/compute/api.py b/nova/compute/api.py index 207a3d27b..9cc517345 100644 --- a/nova/compute/api.py +++ b/nova/compute/api.py @@ -836,7 +836,10 @@ class API(base.Base): params = {'migration_id': migration_ref['id']} self._cast_compute_message('revert_resize', context, - instance_ref['uuid'], params=params) + instance_ref['uuid'], + migration_ref['source_compute'], + params=params) + self.db.migration_update(context, migration_ref['id'], {'status': 'reverted'}) @@ -853,6 +856,7 @@ class API(base.Base): status='finished') params = {'migration_id': migration_ref['id']} self._cast_compute_message('confirm_resize', context, + migration_ref['dest_compute'], instance_ref['uuid'], params=params) -- cgit From 9fc4cfaafceb3b96c51bc49aec020f89068544a0 Mon Sep 17 00:00:00 2001 From: "matt.dietz@rackspace.com" <> Date: Wed, 20 Jul 2011 12:39:37 -0500 Subject: Stupid merge and fixed broken test --- nova/compute/manager.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'nova/compute') diff --git a/nova/compute/manager.py b/nova/compute/manager.py index 85a60e413..bfc7694e7 100644 --- a/nova/compute/manager.py +++ b/nova/compute/manager.py @@ -708,7 +708,7 @@ class ComputeManager(manager.SchedulerDependentManager): @exception.wrap_exception(notifier=notifier, publisher_id=publisher_id()) @checks_instance_lock - def finish_revert_resize(self, context, migration_id): + def finish_revert_resize(self, context, instance_id, migration_id): """Finishes the second half of reverting a resize. Power back on the source instance and revert the resized attributes -- cgit From e2eff68dbe78d8639d4cb212ab48240ebf045f73 Mon Sep 17 00:00:00 2001 From: "matt.dietz@rackspace.com" <> Date: Wed, 20 Jul 2011 14:25:23 -0500 Subject: Whoops --- nova/compute/api.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'nova/compute') diff --git a/nova/compute/api.py b/nova/compute/api.py index e25a9eeb3..67aa3c20f 100644 --- a/nova/compute/api.py +++ b/nova/compute/api.py @@ -902,8 +902,8 @@ class API(base.Base): status='finished') params = {'migration_id': migration_ref['id']} self._cast_compute_message('confirm_resize', context, - migration_ref['dest_compute'], instance_ref['uuid'], + migration_ref['dest_compute'], params=params) self.db.migration_update(context, migration_ref['id'], -- cgit From 1230d93f6154d73fcd8ce1c30c629d8a04c1c874 Mon Sep 17 00:00:00 2001 From: "matt.dietz@rackspace.com" <> Date: Thu, 21 Jul 2011 11:52:58 -0500 Subject: Some broken tests from my other merge --- nova/compute/manager.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'nova/compute') diff --git a/nova/compute/manager.py b/nova/compute/manager.py index c9afa8072..893727f38 100644 --- a/nova/compute/manager.py +++ b/nova/compute/manager.py @@ -748,7 +748,7 @@ class ComputeManager(manager.SchedulerDependentManager): raise exception.Error(_( 'Migration error: destination same as source!')) - old_instance_type = self.db.instance_type_get_by_id(context, + old_instance_type = self.db.instance_type_get(context, instance_ref['instance_type_id']) migration_ref = self.db.migration_create(context, -- cgit From 5913e537ceb352ec4e5999cdadb1d826771d5d72 Mon Sep 17 00:00:00 2001 From: Dan Prince Date: Thu, 21 Jul 2011 14:21:27 -0400 Subject: Updated the compute API so that has_finished_migration uses instance_uuid. Fixes some regressions with 1295-1296. --- nova/compute/api.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'nova/compute') diff --git a/nova/compute/api.py b/nova/compute/api.py index 67aa3c20f..9994e5724 100644 --- a/nova/compute/api.py +++ b/nova/compute/api.py @@ -467,10 +467,10 @@ class API(base.Base): return [dict(x.iteritems()) for x in instances] - def has_finished_migration(self, context, instance_id): + def has_finished_migration(self, context, instance_uuid): """Returns true if an instance has a finished migration.""" try: - db.migration_get_by_instance_and_status(context, instance_id, + db.migration_get_by_instance_and_status(context, instance_uuid, 'finished') return True except exception.NotFound: -- cgit From 93ffbbb234df486a1adb558a5228a7f23ea3451b Mon Sep 17 00:00:00 2001 From: Ryu Ishimoto Date: Fri, 22 Jul 2011 22:12:15 +0900 Subject: Added network_info to unfilter_instance to avoid exceptions when shutting down instances --- nova/compute/manager.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'nova/compute') diff --git a/nova/compute/manager.py b/nova/compute/manager.py index aeecdecfa..da84b98cb 100644 --- a/nova/compute/manager.py +++ b/nova/compute/manager.py @@ -1314,8 +1314,9 @@ class ComputeManager(manager.SchedulerDependentManager): # Releasing vlan. # (not necessary in current implementation?) + network_info = self._get_instance_nw_info(ctxt, instance_ref) # Releasing security group ingress rule. - self.driver.unfilter_instance(instance_ref) + self.driver.unfilter_instance(instance_ref, network_info=network_info) # Database updating. i_name = instance_ref.name -- cgit From 348dcb39f879926c20ed87256b149aeeaa4c6832 Mon Sep 17 00:00:00 2001 From: Ryu Ishimoto Date: Sat, 23 Jul 2011 05:11:39 +0900 Subject: Add i18n for logging, changed create_bridge/vlan to should_create_bridge/vlan, changed unfilter_instance's keyword param to positional, and added Dan's alternate ID to .mailmap --- nova/compute/manager.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'nova/compute') diff --git a/nova/compute/manager.py b/nova/compute/manager.py index da84b98cb..31627fe3b 100644 --- a/nova/compute/manager.py +++ b/nova/compute/manager.py @@ -1316,7 +1316,7 @@ class ComputeManager(manager.SchedulerDependentManager): network_info = self._get_instance_nw_info(ctxt, instance_ref) # Releasing security group ingress rule. - self.driver.unfilter_instance(instance_ref, network_info=network_info) + self.driver.unfilter_instance(instance_ref, network_info) # Database updating. i_name = instance_ref.name -- cgit From 22c1d1c0e146a7e7987c01a9bbf343b2ae9f9db6 Mon Sep 17 00:00:00 2001 From: Brian Waldon Date: Mon, 25 Jul 2011 10:07:32 -0400 Subject: fixing typos --- nova/compute/api.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'nova/compute') diff --git a/nova/compute/api.py b/nova/compute/api.py index 9994e5724..c49c0d95c 100644 --- a/nova/compute/api.py +++ b/nova/compute/api.py @@ -127,7 +127,7 @@ class API(base.Base): quota_metadata = quota.allowed_metadata_items(context, num_metadata) if quota_metadata < num_metadata: pid = context.project_id - msg = _("Quota exceeeded for %(pid)s, tried to set " + msg = _("Quota exceeded for %(pid)s, tried to set " "%(num_metadata)s metadata properties") % locals() LOG.warn(msg) raise quota.QuotaError(msg, "MetadataLimitExceeded") @@ -138,7 +138,7 @@ class API(base.Base): for k, v in metadata.iteritems(): if len(k) > 255 or len(v) > 255: pid = context.project_id - msg = _("Quota exceeeded for %(pid)s, metadata property " + msg = _("Quota exceeded for %(pid)s, metadata property " "key or value too long") % locals() LOG.warn(msg) raise quota.QuotaError(msg, "MetadataLimitExceeded") @@ -165,7 +165,7 @@ class API(base.Base): instance_type) if num_instances < min_count: pid = context.project_id - LOG.warn(_("Quota exceeeded for %(pid)s," + LOG.warn(_("Quota exceeded for %(pid)s," " tried to run %(min_count)s instances") % locals()) if num_instances <= 0: message = _("Instance quota exceeded. You cannot run any " -- cgit