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 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 4b4bebad3b44e7b55e55a005a3629aebf50ecfa2 Mon Sep 17 00:00:00 2001 From: Dan Prince Date: Tue, 19 Jul 2011 15:51:45 -0400 Subject: Updates to the compute API and manager so that rebuild, reboot, snapshots, and password resets work with the most recent versions of novaclient. --- nova/compute/api.py | 6 ++++++ nova/compute/manager.py | 5 ++++- 2 files changed, 10 insertions(+), 1 deletion(-) (limited to 'nova/compute') diff --git a/nova/compute/api.py b/nova/compute/api.py index acafc7760..b13bd5013 100644 --- a/nova/compute/api.py +++ b/nova/compute/api.py @@ -561,6 +561,7 @@ class API(base.Base): self.db.queue_get_for(context, FLAGS.compute_topic, host), {'method': 'refresh_provider_fw_rules', 'args': {}}) + @scheduler_api.reroute_compute("update") def update(self, context, instance_id, **kwargs): """Updates the instance in the datastore. @@ -776,6 +777,7 @@ class API(base.Base): raise exception.Error(_("Unable to find host for Instance %s") % instance_id) + @scheduler_api.reroute_compute("backup") def backup(self, context, instance_id, name, backup_type, rotation, extra_properties=None): """Backup the given instance @@ -792,6 +794,7 @@ class API(base.Base): extra_properties=extra_properties) return recv_meta + @scheduler_api.reroute_compute("snapshot") def snapshot(self, context, instance_id, name, extra_properties=None): """Snapshot the given instance. @@ -834,10 +837,12 @@ class API(base.Base): params=params) return recv_meta + @scheduler_api.reroute_compute("reboot") def reboot(self, context, instance_id): """Reboot the given instance.""" self._cast_compute_message('reboot_instance', context, instance_id) + @scheduler_api.reroute_compute("rebuild") def rebuild(self, context, instance_id, image_href, name=None, metadata=None, files_to_inject=None): """Rebuild the given instance with the provided metadata.""" @@ -1012,6 +1017,7 @@ class API(base.Base): """Unrescue the given instance.""" self._cast_compute_message('unrescue_instance', context, instance_id) + @scheduler_api.reroute_compute("set_admin_password") def set_admin_password(self, context, instance_id, password=None): """Set the root/admin password for the given instance.""" host = self._find_host(context, instance_id) diff --git a/nova/compute/manager.py b/nova/compute/manager.py index 47becdcc6..04609d7c5 100644 --- a/nova/compute/manager.py +++ b/nova/compute/manager.py @@ -415,7 +415,10 @@ 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) + network_info = self.network_api.get_instance_nw_info(context, + instance_ref) + bd_mapping = self._setup_block_device_mapping(context, instance_id) + self.driver.spawn(instance_ref, network_info, bd_mapping) self._update_image_ref(context, instance_id, image_ref) self._update_launched_at(context, instance_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 76aab6d65fa35ae88f9b16acd4ee2968dfe049ce Mon Sep 17 00:00:00 2001 From: "matt.dietz@rackspace.com" <> Date: Wed, 20 Jul 2011 16:56:45 -0500 Subject: CHanges based on feedback --- 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 eb3996d29..01a7d195f 100644 --- a/nova/compute/manager.py +++ b/nova/compute/manager.py @@ -820,20 +820,24 @@ class ComputeManager(manager.SchedulerDependentManager): migration_ref['instance_id']) # TODO(mdietz): apply the rest of the instance_type attributes going # after they're supported - instance_type = self.db.instance_type_get_by_flavor_id(context, - migration_ref['new_flavor_id']) - self.db.instance_update(context, instance_id, - dict(instance_type_id=instance_type['id'], - memory_mb=instance_type['memory_mb'], - vcpus=instance_type['vcpus'], - local_gb=instance_type['local_gb'])) + resize_instance = False + if migration_ref['old_flavor_id'] != migration_ref['new_flavor_id']: + instance_type = self.db.instance_type_get_by_flavor_id(context, + migration_ref['new_flavor_id']) + self.db.instance_update(context, instance_id, + dict(instance_type_id=instance_type['id'], + memory_mb=instance_type['memory_mb'], + vcpus=instance_type['vcpus'], + local_gb=instance_type['local_gb'])) + resize_instance = True # 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) - self.driver.finish_resize(instance, disk_info, network_info) + self.driver.finish_resize(instance, disk_info, network_info, + resize_instance) self.db.migration_update(context, migration_id, {'status': 'finished', }) -- cgit From 806be42000cf54e5b2ff9fb03446e8e6924bd38b Mon Sep 17 00:00:00 2001 From: "matt.dietz@rackspace.com" <> Date: Thu, 21 Jul 2011 12:46:58 -0500 Subject: Renamed the virt driver resize methods to migration for marginally more understandable code --- 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 01a7d195f..78d7f6479 100644 --- a/nova/compute/manager.py +++ b/nova/compute/manager.py @@ -723,7 +723,7 @@ class ComputeManager(manager.SchedulerDependentManager): local_gb=instance_type['local_gb'], instance_type_id=instance_type['id'])) - self.driver.revert_resize(instance_ref) + self.driver.revert_migration(instance_ref) self.db.migration_update(context, migration_id, {'status': 'reverted'}) usage_info = utils.usage_from_instance(instance_ref) @@ -836,7 +836,7 @@ class ComputeManager(manager.SchedulerDependentManager): instance = self.db.instance_get(context, instance_id) network_info = self.network_api.get_instance_nw_info(context, instance) - self.driver.finish_resize(instance, disk_info, network_info, + self.driver.finish_migration(instance, disk_info, network_info, resize_instance) self.db.migration_update(context, migration_id, -- cgit From 5f75097eb46fa03814fe53c5d9fda84f0000fdd4 Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Thu, 21 Jul 2011 22:46:57 +0000 Subject: start removing references to AuthManager --- 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 67aa3c20f..51a903d40 100644 --- a/nova/compute/api.py +++ b/nova/compute/api.py @@ -688,7 +688,7 @@ class API(base.Base): raise instances = None elif project_id or not context.is_admin: - if not context.project: + if not context.project_id: instances = self.db.instance_get_all_by_user( context, context.user_id) else: -- 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 44d1024a53b8150cf9542d08d5886f430365f161 Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Fri, 22 Jul 2011 19:47:41 +0000 Subject: fix all tests --- nova/compute/api.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'nova/compute') diff --git a/nova/compute/api.py b/nova/compute/api.py index 51a903d40..9a1ce7452 100644 --- a/nova/compute/api.py +++ b/nova/compute/api.py @@ -676,6 +676,7 @@ class API(base.Base): all instances in the system. """ + LOG.info(locals()) if reservation_id is not None: recurse_zones = True instances = self.db.instance_get_all_by_reservation( @@ -688,6 +689,7 @@ class API(base.Base): raise instances = None elif project_id or not context.is_admin: + LOG.info(context.project_id) if not context.project_id: instances = self.db.instance_get_all_by_user( context, context.user_id) -- 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 From 8de3c0fcaee546fae3d415ef5ddcbb51fb1db6d7 Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Mon, 25 Jul 2011 17:49:09 +0000 Subject: fix for reviews --- nova/compute/api.py | 1 - 1 file changed, 1 deletion(-) (limited to 'nova/compute') diff --git a/nova/compute/api.py b/nova/compute/api.py index d1c3fd6fd..487d23b0d 100644 --- a/nova/compute/api.py +++ b/nova/compute/api.py @@ -676,7 +676,6 @@ class API(base.Base): all instances in the system. """ - LOG.info(locals()) if reservation_id is not None: recurse_zones = True instances = self.db.instance_get_all_by_reservation( -- cgit From 79c06e6f9597a83ec172451eb2622927f5b9accd Mon Sep 17 00:00:00 2001 From: Trey Morris Date: Tue, 26 Jul 2011 14:42:56 -0500 Subject: passing host from the compute manager for add_fixed_ip_to_instance() --- 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 c79abd696..173469bc3 100644 --- a/nova/compute/manager.py +++ b/nova/compute/manager.py @@ -871,7 +871,7 @@ class ComputeManager(manager.SchedulerDependentManager): """ self.network_api.add_fixed_ip_to_instance(context, instance_id, - network_id) + self.host, network_id) self.inject_network_info(context, instance_id) self.reset_network(context, instance_id) -- cgit From 1e8a7f2846ce0a3fb3d9e31fc7d4dbf27d54fac2 Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Thu, 28 Jul 2011 19:06:48 -0700 Subject: remove extra log statement --- nova/compute/api.py | 1 - 1 file changed, 1 deletion(-) (limited to 'nova/compute') diff --git a/nova/compute/api.py b/nova/compute/api.py index 51c5ae155..8f7b3c3ef 100644 --- a/nova/compute/api.py +++ b/nova/compute/api.py @@ -689,7 +689,6 @@ class API(base.Base): raise instances = None elif project_id or not context.is_admin: - LOG.info(context.project_id) if not context.project_id: instances = self.db.instance_get_all_by_user( context, context.user_id) -- cgit From 7a165843aa5c1a98b1dbf13dedf556878a3d0435 Mon Sep 17 00:00:00 2001 From: Brian Lamar Date: Fri, 29 Jul 2011 11:06:02 -0400 Subject: Updated resize to call compute API with instance_type identifiers instead of flavor identifiers. Updated tests. --- nova/compute/instance_types.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'nova/compute') diff --git a/nova/compute/instance_types.py b/nova/compute/instance_types.py index c13a629a9..824416514 100644 --- a/nova/compute/instance_types.py +++ b/nova/compute/instance_types.py @@ -132,11 +132,8 @@ def get_instance_type_by_name(name): # flavors. def get_instance_type_by_flavor_id(flavor_id): """Retrieve instance type by flavor_id.""" - if flavor_id is None: - return get_default_instance_type() + ctxt = context.get_admin_context() try: - ctxt = context.get_admin_context() return db.instance_type_get_by_flavor_id(ctxt, flavor_id) - except exception.DBError, e: - LOG.exception(_('DB error: %s') % e) - raise exception.ApiError(_("Unknown flavor: %s") % flavor_id) + except ValueError: + raise exception.FlavorNotFound(flavor_id=flavor_id) -- cgit