From 7c8096384507908a5e583f4554d0fc765ae5f2eb Mon Sep 17 00:00:00 2001 From: Kei Masumoto Date: Thu, 27 Jan 2011 20:39:33 +0900 Subject: adding testcode --- nova/compute/manager.py | 66 ++++++++++++++++++++++++------------------------- 1 file changed, 33 insertions(+), 33 deletions(-) (limited to 'nova/compute') diff --git a/nova/compute/manager.py b/nova/compute/manager.py index efb5753aa..4acba7153 100644 --- a/nova/compute/manager.py +++ b/nova/compute/manager.py @@ -125,12 +125,12 @@ class ComputeManager(manager.Manager): """Insert compute node specific information to DB.""" try: - service_ref = db.service_get_by_args(ctxt, - host, - binary) + service_ref = self.db.service_get_by_args(ctxt, + host, + binary) except exception.NotFound: - msg = _(("""Cannot insert compute manager specific info""" - """Because no service record found.""")) + msg = _(("""Cannot insert compute manager specific info,""" + """ Because no service record found.""")) raise exception.Invalid(msg) # Updating host information @@ -141,14 +141,14 @@ class ComputeManager(manager.Manager): version = self.driver.get_hypervisor_version() cpu_info = self.driver.get_cpu_info() - db.service_update(ctxt, - service_ref['id'], - {'vcpus': vcpu, - 'memory_mb': memory_mb, - 'local_gb': local_gb, - 'hypervisor_type': hypervisor, - 'hypervisor_version': version, - 'cpu_info': cpu_info}) + self.db.service_update(ctxt, + service_ref['id'], + {'vcpus': vcpu, + 'memory_mb': memory_mb, + 'local_gb': local_gb, + 'hypervisor_type': hypervisor, + 'hypervisor_version': version, + 'cpu_info': cpu_info}) def _update_state(self, context, instance_id): """Update the state of an instance from the driver info.""" @@ -596,22 +596,22 @@ class ComputeManager(manager.Manager): """ Check the host cpu is compatible to a cpu given by xml.""" return self.driver.compare_cpu(cpu_info) - def pre_live_migration(self, context, instance_id, dest): + def pre_live_migration(self, context, instance_id): """Any preparation for live migration at dst host.""" # Getting instance info - instance_ref = db.instance_get(context, instance_id) + instance_ref = self.db.instance_get(context, instance_id) ec2_id = instance_ref['hostname'] # Getting fixed ips - fixed_ip = db.instance_get_fixed_address(context, instance_id) + fixed_ip = self.db.instance_get_fixed_address(context, instance_id) if not fixed_ip: msg = _('%s(%s) doesnt have fixed_ip') % (instance_id, ec2_id) raise exception.NotFound(msg) # If any volume is mounted, prepare here. if len(instance_ref['volumes']) == 0: - logging.info(_("%s has no volume.") % ec2_id) + LOG.info(_("%s has no volume."), ec2_id) else: for v in instance_ref['volumes']: self.volume_manager.setup_compute_volume(context, v['id']) @@ -634,7 +634,7 @@ class ComputeManager(manager.Manager): """executes live migration.""" # Get instance for error handling. - instance_ref = db.instance_get(context, instance_id) + instance_ref = self.db.instance_get(context, instance_id) ec2_id = instance_ref['hostname'] try: @@ -647,27 +647,27 @@ class ComputeManager(manager.Manager): "args": {'instance_id': instance_id}}) # Asking dest host to preparing live migration. - compute_topic = db.queue_get_for(context, - FLAGS.compute_topic, - dest) + compute_topic = self.db.queue_get_for(context, + FLAGS.compute_topic, + dest) rpc.call(context, - compute_topic, - {"method": "pre_live_migration", - "args": {'instance_id': instance_id, - 'dest': dest}}) + compute_topic, + {"method": "pre_live_migration", + "args": {'instance_id': instance_id}}) except Exception, e: + print e msg = _('Pre live migration for %s failed at %s') - logging.error(msg, ec2_id, dest) - db.instance_set_state(context, - instance_id, - power_state.RUNNING, - 'running') + LOG.error(msg, ec2_id, dest) + self.db.instance_set_state(context, + instance_id, + power_state.RUNNING, + 'running') for v in instance_ref['volumes']: - db.volume_update(context, - v['id'], - {'status': 'in-use'}) + self.db.volume_update(context, + v['id'], + {'status': 'in-use'}) # e should be raised. just calling "raise" may raise NotFound. raise e -- cgit From 09f2c4729456443c4874a8cadc53299817d6371a Mon Sep 17 00:00:00 2001 From: Kei Masumoto Date: Mon, 31 Jan 2011 18:41:10 +0900 Subject: 1. Discard nova-manage host list Reason: nova-manage service list can be replacement. Changes: nova-manage 2. Fix resource checking inappropriate design. Reason: nova.scheduler.driver.has_enough_resource has inappropriate design, so fix it. This method didnt check free memory but check total memory. We need to register free memory onto databases(periodically). But periodically updating may causes flooding request to db in case of many compute-node. Currently, since memory information is only used in this feature, we take the choice that administrators manually has to execute nova-manage to let compute node update their own memory information. Changes: nova.db.sqlalchemy.models - Adding memory_mb_used, local_gb_used, vcpu_used column to Service. (local_gb and vcpu is just for reference to admins for now) nova.compute.manager - Changing nova.compute.manager.update_service Service table column is changed, so updating method must be changed. - Adding nova.compute.manager.update_available_resource a responder to admin's request to let compute nodes update their memory infomation nova.virt.libvirt_conn nova.virt.xenapi_conn nova.virt.fake - Adding getter method for memory_mb_used/local_gb_used/vcpu_used. nova-manage - request method to let compute nodes update their own memory info. --- nova/compute/manager.py | 54 ++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 51 insertions(+), 3 deletions(-) (limited to 'nova/compute') diff --git a/nova/compute/manager.py b/nova/compute/manager.py index 4acba7153..e3c5d24b6 100644 --- a/nova/compute/manager.py +++ b/nova/compute/manager.py @@ -134,9 +134,12 @@ class ComputeManager(manager.Manager): raise exception.Invalid(msg) # Updating host information - vcpu = self.driver.get_vcpu_number() - memory_mb = self.driver.get_memory_mb() - local_gb = self.driver.get_local_gb() + vcpu = self.driver.get_vcpu_total() + memory_mb = self.driver.get_memory_mb_total() + local_gb = self.driver.get_local_gb_total() + vcpu_u = self.driver.get_vcpu_used() + memory_mb_u = self.driver.get_memory_mb_used() + local_gb_u = self.driver.get_local_gb_used() hypervisor = self.driver.get_hypervisor_type() version = self.driver.get_hypervisor_version() cpu_info = self.driver.get_cpu_info() @@ -146,10 +149,42 @@ class ComputeManager(manager.Manager): {'vcpus': vcpu, 'memory_mb': memory_mb, 'local_gb': local_gb, + 'vcpus_used':vcpu_u, + 'memory_mb_used': memory_mb_u, + 'local_gb_used': local_gb_u, 'hypervisor_type': hypervisor, 'hypervisor_version': version, 'cpu_info': cpu_info}) + def update_available_resource(self, context): + """ + update compute node specific info to DB. + Alghough this might be subset of update_service, + udpate_service() is used only nova-compute is lauched. + On the other hand, this method is used whenever administrators + request comes. + """ + try: + service_ref = self.db.service_get_by_args(context, + self.host, + 'nova-compute') + except exception.NotFound: + msg = _(("""Cannot update resource info.""" + """ Because no service record found.""")) + raise exception.Invalid(msg) + + # Updating host information + vcpu_u = self.driver.get_vcpu_used() + memory_mb_u = self.driver.get_memory_mb_used() + local_gb_u = self.driver.get_local_gb_used() + + self.db.service_update(context, + service_ref['id'], + {'vcpus_used':vcpu_u, + 'memory_mb_used': memory_mb_u, + 'local_gb_used': local_gb_u}) + return + def _update_state(self, context, instance_id): """Update the state of an instance from the driver info.""" # FIXME(ja): include other fields from state? @@ -596,6 +631,19 @@ class ComputeManager(manager.Manager): """ Check the host cpu is compatible to a cpu given by xml.""" return self.driver.compare_cpu(cpu_info) + def mktmpfile(self, context): + """make tmpfile under FLAGS.instance_path.""" + return utils.mktmpfile(FLAGS.instances_path) + + def exists(self, context, path): + """Confirm existence of the tmpfile given by path.""" + if not utils.exists(path): + raise exception.NotFound(_('%s not found') % path) + + def remove(self, context, path): + """remove the tmpfile given by path.""" + return utils.remove(path) + def pre_live_migration(self, context, instance_id): """Any preparation for live migration at dst host.""" -- cgit From d88d74c9a0a28e0ebd6cedf694753b9ee9decdac Mon Sep 17 00:00:00 2001 From: Kei Masumoto Date: Fri, 18 Feb 2011 14:15:04 +0900 Subject: fixed based on reviewer's comment. 1. erase wrapper function(remove/exists/mktempfile) from nova.utils. 2. nova-manage service describeresource(->describe_resource) 3. nova-manage service updateresource(->update_resource) 4. erase "my mistake print" statement Additional changes are made at: 1. nova.image.s3.show 2. nova.compute.api.create that's because instances cannot launched without this changes. --- nova/compute/api.py | 4 ++-- nova/compute/manager.py | 15 ++++++++++----- 2 files changed, 12 insertions(+), 7 deletions(-) (limited to 'nova/compute') diff --git a/nova/compute/api.py b/nova/compute/api.py index ac02dbcfa..740dd3935 100644 --- a/nova/compute/api.py +++ b/nova/compute/api.py @@ -103,9 +103,9 @@ class API(base.Base): if not is_vpn: image = self.image_service.show(context, image_id) if kernel_id is None: - kernel_id = image.get('kernelId', None) + kernel_id = image.get('kernel_id', None) if ramdisk_id is None: - ramdisk_id = image.get('ramdiskId', None) + ramdisk_id = image.get('ramdisk_id', None) # No kernel and ramdisk for raw images if kernel_id == str(FLAGS.null_kernel): kernel_id = None diff --git a/nova/compute/manager.py b/nova/compute/manager.py index cae95dd93..47dd5fd5e 100644 --- a/nova/compute/manager.py +++ b/nova/compute/manager.py @@ -38,6 +38,8 @@ import datetime import random import string import socket +import os +import tempfile import time import functools @@ -577,14 +579,17 @@ class ComputeManager(manager.Manager): @exception.wrap_exception def mktmpfile(self, context): """make tmpfile under FLAGS.instance_path.""" - return utils.mktmpfile(FLAGS.instances_path) + fd, name = tempfile.mkstemp(dir=FLAGS.instances_path) + # No essential reason to write dateinfo. just for debugging reason. + os.fdopen(fd, 'w').write(str(datetime.datetime.utcnow())) + return name @exception.wrap_exception def confirm_tmpfile(self, context, path): """Confirm existence of the tmpfile given by path.""" - if not utils.exists(path): + if not os.path.exists(path): raise exception.NotFound(_('%s not found') % path) - return utils.remove(path) + return os.remove(path) @exception.wrap_exception def update_available_resource(self, context): @@ -683,7 +688,7 @@ class ComputeManager(manager.Manager): Post operations for live migration. Mainly, database updating. """ - LOG.info('post_live_migration() is started..') + LOG.info(_('post_live_migration() is started..')) instance_id = instance_ref['id'] # Detaching volumes. @@ -705,7 +710,7 @@ class ComputeManager(manager.Manager): # Not return if fixed_ip is not found, otherwise, # instance never be accessible.. if None == fixed_ip: - logging.warn('fixed_ip is not found for %s ' % i_name) + LOG.warn(_('fixed_ip is not found for %s.') % i_name) self.db.fixed_ip_update(ctxt, fixed_ip, {'host': dest}) try: -- cgit From c32e57999be09368b18f5a89315465e629ed4819 Mon Sep 17 00:00:00 2001 From: Kei Masumoto Date: Tue, 22 Feb 2011 23:55:03 +0900 Subject: Fixed based on reviewer's comment. 1. Change docstrings format 2. Fix comment grammer mistake, etc --- nova/compute/manager.py | 123 +++++++++++++++++++++++++++++++++--------------- 1 file changed, 85 insertions(+), 38 deletions(-) (limited to 'nova/compute') diff --git a/nova/compute/manager.py b/nova/compute/manager.py index d548cef6f..5b6e9082e 100644 --- a/nova/compute/manager.py +++ b/nova/compute/manager.py @@ -36,10 +36,10 @@ terminating it. import base64 import datetime +import os import random import string import socket -import os import tempfile import time import functools @@ -65,8 +65,8 @@ flags.DEFINE_string('console_host', socket.gethostname(), 'Console proxy host to use to connect to instances on' 'this host.') flags.DEFINE_string('live_migration_retry_count', 30, - ("""Retry count needed in live_migration.""" - """ sleep 1 sec for each count""")) + ("Retry count needed in live_migration." + " sleep 1 sec for each count")) LOG = logging.getLogger('nova.compute.manager') @@ -602,31 +602,66 @@ class ComputeManager(manager.Manager): @exception.wrap_exception def compare_cpu(self, context, cpu_info): - """ Check the host cpu is compatible to a cpu given by xml.""" + """Checks the host cpu is compatible to a cpu given by xml. + + :param context: security context + :param cpu_info: json string obtained from virConnect.getCapabilities + :returns: See driver.compare_cpu + + """ return self.driver.compare_cpu(cpu_info) @exception.wrap_exception def mktmpfile(self, context): - """make tmpfile under FLAGS.instance_path.""" - fd, name = tempfile.mkstemp(dir=FLAGS.instances_path) - # No essential reason to write dateinfo. just for debugging reason. - os.fdopen(fd, 'w').write(str(datetime.datetime.utcnow())) + """Makes tmpfile under FLAGS.instance_path. + + This method enables compute nodes to recognize that they mounts + same shared storage. mktmpfile()/confirm_tmpfile is a pair. + + :param context: security context + :returns: tmpfile name + + """ + + dirpath = FLAGS.instances_path + fd, name = tempfile.mkstemp(dir=dirpath) + LOG.debug(_("Creating tmpfile %s to notify to other " + "compute node that they mounts same storage.") % name) + os.fdopen(fd, 'w+').close() return name @exception.wrap_exception def confirm_tmpfile(self, context, path): - """Confirm existence of the tmpfile given by path.""" + """Confirms existence of the tmpfile given by path. + + :param context: security context + :param path: confirm existence of this path + :returns: depends on os.remove() + + """ + if not os.path.exists(path): raise exception.NotFound(_('%s not found') % path) return os.remove(path) @exception.wrap_exception def update_available_resource(self, context): - """See comments update_resource_info""" + """See comments update_resource_info. + + :param context: security context + :returns: See driver.update_available_resource() + + """ + return self.driver.update_available_resource(context, self.host) def pre_live_migration(self, context, instance_id): - """Any preparation for live migration at dst host.""" + """Preparations for live migration at dest host. + + :param context: security context + :param instance_id: nova.db.sqlalchemy.models.Instance.Id + + """ # Getting instance info instance_ref = self.db.instance_get(context, instance_id) @@ -635,7 +670,7 @@ class ComputeManager(manager.Manager): # Getting fixed ips fixed_ip = self.db.instance_get_fixed_address(context, instance_id) if not fixed_ip: - msg = _("%(instance_id)s(%(ec2_id)s) doesnt have fixed_ip") + msg = _("%(instance_id)s(%(ec2_id)s) does'nt have fixed_ip") raise exception.NotFound(msg % locals()) # If any volume is mounted, prepare here. @@ -645,8 +680,8 @@ class ComputeManager(manager.Manager): for v in instance_ref['volumes']: self.volume_manager.setup_compute_volume(context, v['id']) - # Bridge settings - # call this method prior to ensure_filtering_rules_for_instance, + # Bridge settings. + # Call this method prior to ensure_filtering_rules_for_instance, # since bridge is not set up, ensure_filtering_rules_for instance # fails. # @@ -660,24 +695,29 @@ class ComputeManager(manager.Manager): break except exception.ProcessExecutionError, e: if i == max_retry - 1: - raise e + raise else: - LOG.warn(_("setup_compute_network() fail %(i)d th. " - "Retry up to %(max_retry)d for %(ec2_id)s") + LOG.warn(_("setup_compute_network() failed %(i)d." + "Retry up to %(max_retry)d for %(ec2_id)s.") % locals()) time.sleep(1) # Creating filters to hypervisors and firewalls. # An example is that nova-instance-instance-xxx, - # which is written to libvirt.xml( check "virsh nwfilter-list ) - # On destination host, this nwfilter is necessary. + # which is written to libvirt.xml(Check "virsh nwfilter-list") + # This nwfilter is necessary on the destination host. # In addition, this method is creating filtering rule # onto destination host. self.driver.ensure_filtering_rules_for_instance(instance_ref) - #@exception.wrap_exception def live_migration(self, context, instance_id, dest): - """Executing live migration.""" + """Executing live migration. + + :param context: security context + :param instance_id: nova.db.sqlalchemy.models.Instance.Id + :param dest: destination host + + """ # Get instance for error handling. instance_ref = self.db.instance_get(context, instance_id) @@ -702,7 +742,7 @@ class ComputeManager(manager.Manager): msg = _("Pre live migration for %(i_name)s failed at %(dest)s") LOG.error(msg % locals()) self.recover_live_migration(context, instance_ref) - raise e + raise # Executing live migration # live_migration might raises exceptions, but @@ -712,10 +752,17 @@ class ComputeManager(manager.Manager): self.recover_live_migration) def post_live_migration(self, ctxt, instance_ref, dest): + """Post operations for live migration. + + This method is called from live_migration + and mainly updating database record. + + :param ctxt: security context + :param instance_id: nova.db.sqlalchemy.models.Instance.Id + :param dest: destination host + """ - Post operations for live migration. - Mainly, database updating. - """ + LOG.info(_('post_live_migration() is started..')) instance_id = instance_ref['id'] @@ -734,19 +781,12 @@ class ComputeManager(manager.Manager): # Database updating. i_name = instance_ref.name - #fixed_ip = self.db.instance_get_fixed_address(ctxt, instance_id) - # Not return if fixed_ip is not found, otherwise, - # instance never be accessible.. - #if None == fixed_ip: - # LOG.warn(_('fixed_ip is not found for %s.') % i_name) - #self.db.fixed_ip_update(ctxt, fixed_ip, {'host': dest}) - try: # Not return if floating_ip is not found, otherwise, # instance never be accessible.. floating_ip = self.db.instance_get_floating_address(ctxt, instance_id) - if None == floating_ip: + if not floating_ip: LOG.info(_('floating_ip is not found for %s'), i_name) else: floating_ip_ref = self.db.floating_ip_get_by_address(ctxt, @@ -763,15 +803,23 @@ class ComputeManager(manager.Manager): # Restore instance/volume state self.recover_live_migration(ctxt, instance_ref, dest) - msg = _('Migrating %(i_name)s to %(dest)s finishes successfully.') - LOG.info(msg % locals()) + LOG.info(_('Migrating %(i_name)s to %(dest)s finishes successfully.') + % locals()) LOG.info(_("The below error is normally occurs." "Just check if instance is successfully migrated.\n" "libvir: QEMU error : Domain not found: no domain " "with matching name..")) def recover_live_migration(self, ctxt, instance_ref, host=None): - """Instance/volume state is recovered from migrating -> running.""" + """Recovers Instance/volume state from migrating -> running. + + :param ctxt: security context + :param instance_id: nova.db.sqlalchemy.models.Instance.Id + :param host: + DB column value is updated by this hostname. + if none, the host instance currently running is selected. + + """ if not host: host = instance_ref['host'] @@ -783,5 +831,4 @@ class ComputeManager(manager.Manager): 'host': host}) for v in instance_ref['volumes']: - self.db.volume_update(ctxt, v['id'], {'status': 'in-use', - 'host': host}) + self.db.volume_update(ctxt, v['id'], {'status': 'in-use'}) -- cgit From 1caa7f189827b4721c2e9d3ddf753acd749d7916 Mon Sep 17 00:00:00 2001 From: Kei Masumoto Date: Tue, 1 Mar 2011 17:52:46 +0900 Subject: rename db migration script --- 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 8b90ffbca..d085a0b6a 100644 --- a/nova/compute/manager.py +++ b/nova/compute/manager.py @@ -818,7 +818,7 @@ class ComputeManager(manager.Manager): LOG.info(_('Migrating %(i_name)s to %(dest)s finishes successfully.') % locals()) - LOG.info(_("The below error is normally occurs." + LOG.info(_("The below error is normally occurs. " "Just check if instance is successfully migrated.\n" "libvir: QEMU error : Domain not found: no domain " "with matching name..")) -- cgit From cdb1b16a6019fd68a7969666d754c4007607ae53 Mon Sep 17 00:00:00 2001 From: Cory Wright Date: Tue, 1 Mar 2011 23:18:37 +0000 Subject: * Added ability to launch XenServer instances with per-os vm-params. --- nova/compute/api.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'nova/compute') diff --git a/nova/compute/api.py b/nova/compute/api.py index 625778b66..8bdf712a0 100644 --- a/nova/compute/api.py +++ b/nova/compute/api.py @@ -125,6 +125,8 @@ class API(base.Base): raise quota.QuotaError(msg, "MetadataLimitExceeded") image = self.image_service.show(context, image_id) + os_type = image['properties'].get('os_type', 'linux') + if kernel_id is None: kernel_id = image.get('kernel_id', None) if ramdisk_id is None: @@ -180,7 +182,8 @@ class API(base.Base): 'key_data': key_data, 'locked': False, 'metadata': metadata, - 'availability_zone': availability_zone} + 'availability_zone': availability_zone, + 'os_type': os_type} elevated = context.elevated() instances = [] LOG.debug(_("Going to run %s instances..."), num_instances) -- cgit From 693e4335dbef72317147abd70bdaa10e0d174020 Mon Sep 17 00:00:00 2001 From: Kei Masumoto Date: Thu, 3 Mar 2011 22:54:11 +0900 Subject: Fixed based on reviewer's comments. Main changes are below. 1. Rename nova.compute.manager.ComputeManager.mktmpfile for better naming. 2. Several tests code in tests/test_virt.py are removed. Because it only works in libvirt environment. Only db-related testcode remains. --- nova/compute/manager.py | 53 +++++++++++++++++++++++++++++-------------------- 1 file changed, 32 insertions(+), 21 deletions(-) (limited to 'nova/compute') diff --git a/nova/compute/manager.py b/nova/compute/manager.py index d085a0b6a..7104daa1e 100644 --- a/nova/compute/manager.py +++ b/nova/compute/manager.py @@ -624,11 +624,12 @@ class ComputeManager(manager.Manager): return self.driver.compare_cpu(cpu_info) @exception.wrap_exception - def mktmpfile(self, context): + def create_shared_storage_test_file(self, context): """Makes tmpfile under FLAGS.instance_path. This method enables compute nodes to recognize that they mounts - same shared storage. mktmpfile()/confirm_tmpfile is a pair. + same shared storage. (create|check|creanup)_shared_storage_test_file() + is a pair. :param context: security context :returns: tmpfile name(basename) @@ -636,26 +637,36 @@ class ComputeManager(manager.Manager): """ dirpath = FLAGS.instances_path - fd, name = tempfile.mkstemp(dir=dirpath) + fd, tmp_file = tempfile.mkstemp(dir=dirpath) LOG.debug(_("Creating tmpfile %s to notify to other " - "compute node that they mounts same storage.") % name) + "compute node that they mounts same storage.") % tmp_file) os.fdopen(fd, 'w+').close() - return os.path.basename(name) + return os.path.basename(tmp_file) @exception.wrap_exception - def confirm_tmpfile(self, context, filename): - """Confirms existence of the tmpfile given by path. + def check_shared_storage_test_file(self, context, filename): + """Confirms existence of the tmpfile under FLAGS.instances_path. :param context: security context :param filename: confirm existence of FLAGS.instances_path/thisfile - :returns: depends on os.remove() """ - p = os.path.join(FLAGS.instances_path, filename) - if not os.path.exists(p): - raise exception.NotFound(_('%s not found') % p) - return os.remove(p) + tmp_file = os.path.join(FLAGS.instances_path, filename) + if not os.path.exists(tmp_file): + raise exception.NotFound(_('%s not found') % tmp_file) + + @exception.wrap_exception + def cleanup_shared_storage_test_file(self, context, filename): + """Removes existence of the tmpfile under FLAGS.instances_path. + + :param context: security context + :param filename: remove existence of FLAGS.instances_path/thisfile + + """ + + tmp_file = os.path.join(FLAGS.instances_path, filename) + os.remove(tmp_file) @exception.wrap_exception def update_available_resource(self, context): @@ -687,7 +698,7 @@ class ComputeManager(manager.Manager): raise exception.NotFound(msg % locals()) # If any volume is mounted, prepare here. - if len(instance_ref['volumes']) == 0: + if not instance_ref['volumes']: LOG.info(_("%s has no volume."), ec2_id) else: for v in instance_ref['volumes']: @@ -701,16 +712,16 @@ class ComputeManager(manager.Manager): # Retry operation is necessary because continuously request comes, # concorrent request occurs to iptables, then it complains. max_retry = FLAGS.live_migration_retry_count - for i in range(max_retry): + for cnt in range(max_retry): try: self.network_manager.setup_compute_network(context, instance_id) break - except exception.ProcessExecutionError, e: - if i == max_retry - 1: + except exception.ProcessExecutionError: + if cnt == max_retry - 1: raise else: - LOG.warn(_("setup_compute_network() failed %(i)d." + LOG.warn(_("setup_compute_network() failed %(cnt)d." "Retry up to %(max_retry)d for %(ec2_id)s.") % locals()) time.sleep(1) @@ -739,7 +750,7 @@ class ComputeManager(manager.Manager): try: # Checking volume node is working correctly when any volumes # are attached to instances. - if len(instance_ref['volumes']) != 0: + if instance_ref['volumes']: rpc.call(context, FLAGS.volume_topic, {"method": "check_for_export", @@ -751,7 +762,7 @@ class ComputeManager(manager.Manager): {"method": "pre_live_migration", "args": {'instance_id': instance_id}}) - except Exception, e: + except Exception: msg = _("Pre live migration for %(i_name)s failed at %(dest)s") LOG.error(msg % locals()) self.recover_live_migration(context, instance_ref) @@ -843,5 +854,5 @@ class ComputeManager(manager.Manager): 'state': power_state.RUNNING, 'host': host}) - for v in instance_ref['volumes']: - self.db.volume_update(ctxt, v['id'], {'status': 'in-use'}) + for volume in instance_ref['volumes']: + self.db.volume_update(ctxt, volume['id'], {'status': 'in-use'}) -- cgit From e14f524eb92ae07704a2ec7dac0f97c60940a6ab Mon Sep 17 00:00:00 2001 From: Mark Washenberger Date: Thu, 3 Mar 2011 17:49:41 -0500 Subject: enforce personality quotas --- nova/compute/api.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'nova/compute') diff --git a/nova/compute/api.py b/nova/compute/api.py index 625778b66..44e583cd4 100644 --- a/nova/compute/api.py +++ b/nova/compute/api.py @@ -80,6 +80,26 @@ class API(base.Base): topic, {"method": "get_network_topic", "args": {'fake': 1}}) + def _check_personality_file_quota(self, context, personality_files): + limit = quota.allowed_personality_files(context) + if len(personality_files) > limit: + raise quota.QuotaError(_("Personality limit exceeded. You can " + "only have %d personalities when " + "creating an instance.") % limit, + "PersonalityLimitExceeded") + path_limit = quota.allowed_personality_path_bytes(context) + content_limit = quota.allowed_personality_content_bytes(context) + for path, content in personality_files: + if len(path) > path_limit: + raise quota.QuotaError( + _("Personality file path limit exceeded."), + "PersonalityLimitExceeded") + if len(content) > content_limit: + raise quota.QuotaError( + _("Personality file content limit exceeded."), + "PersonalityLimitExceeded") + return personality_files + def create(self, context, instance_type, image_id, kernel_id=None, ramdisk_id=None, min_count=1, max_count=1, @@ -124,6 +144,10 @@ class API(base.Base): LOG.warn(msg) raise quota.QuotaError(msg, "MetadataLimitExceeded") + if onset_files is not None: + onset_files = \ + self._check_personality_file_quota(context, onset_files) + image = self.image_service.show(context, image_id) if kernel_id is None: kernel_id = image.get('kernel_id', None) -- cgit From 5ae13551990be67e3509ddcd10d1872a91634d83 Mon Sep 17 00:00:00 2001 From: Mark Washenberger Date: Thu, 3 Mar 2011 18:27:57 -0500 Subject: rename onset_files to personality_files all the way down to compute manager --- nova/compute/api.py | 10 +++++----- nova/compute/manager.py | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'nova/compute') diff --git a/nova/compute/api.py b/nova/compute/api.py index 44e583cd4..13938dcde 100644 --- a/nova/compute/api.py +++ b/nova/compute/api.py @@ -106,7 +106,7 @@ class API(base.Base): display_name='', display_description='', key_name=None, key_data=None, security_group='default', availability_zone=None, user_data=None, metadata=[], - onset_files=None): + personality_files=None): """Create the number of instances requested if quota and other arguments check out ok. """ @@ -144,9 +144,9 @@ class API(base.Base): LOG.warn(msg) raise quota.QuotaError(msg, "MetadataLimitExceeded") - if onset_files is not None: - onset_files = \ - self._check_personality_file_quota(context, onset_files) + if personality_files is not None: + personality_files = \ + self._check_personality_file_quota(context, personality_files) image = self.image_service.show(context, image_id) if kernel_id is None: @@ -242,7 +242,7 @@ class API(base.Base): "args": {"topic": FLAGS.compute_topic, "instance_id": instance_id, "availability_zone": availability_zone, - "onset_files": onset_files}}) + "personality_files": personality_files}}) for group_id in security_groups: self.trigger_security_group_members_refresh(elevated, group_id) diff --git a/nova/compute/manager.py b/nova/compute/manager.py index d659712ad..1a392dda8 100644 --- a/nova/compute/manager.py +++ b/nova/compute/manager.py @@ -174,7 +174,7 @@ class ComputeManager(manager.Manager): """Launch a new instance with specified options.""" context = context.elevated() instance_ref = self.db.instance_get(context, instance_id) - instance_ref.onset_files = kwargs.get('onset_files', []) + instance_ref.onset_files = kwargs.get('personality_files', []) if instance_ref['name'] in self.driver.list_instances(): raise exception.Error(_("Instance has already been created")) LOG.audit(_("instance %s: starting..."), instance_id, -- cgit From abd5779068f3b979fc79dec7a68549999c58092d Mon Sep 17 00:00:00 2001 From: Mark Washenberger Date: Fri, 4 Mar 2011 01:36:29 -0500 Subject: remove ensure_b64_encoding --- nova/compute/manager.py | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'nova/compute') diff --git a/nova/compute/manager.py b/nova/compute/manager.py index d915dc069..3a712fd97 100644 --- a/nova/compute/manager.py +++ b/nova/compute/manager.py @@ -34,7 +34,6 @@ terminating it. :func:`nova.utils.import_object` """ -import base64 import datetime import random import string @@ -353,15 +352,10 @@ class ComputeManager(manager.Manager): LOG.warn(_('trying to inject a file into a non-running ' 'instance: %(instance_id)s (state: %(instance_state)s ' 'expected: %(expected_state)s)') % locals()) - # Files/paths *should* be base64-encoded at this point, but - # double-check to make sure. - b64_path = utils.ensure_b64_encoding(path) - b64_contents = utils.ensure_b64_encoding(file_contents) - plain_path = base64.b64decode(b64_path) nm = instance_ref['name'] - msg = _('instance %(nm)s: injecting file to %(plain_path)s') % locals() + msg = _('instance %(nm)s: injecting file to %(path)s') % locals() LOG.audit(msg) - self.driver.inject_file(instance_ref, b64_path, b64_contents) + self.driver.inject_file(instance_ref, path, file_contents) @exception.wrap_exception @checks_instance_lock -- cgit From 68d894be2ec3b4eaa14dc5c90143f45f7db1e4b8 Mon Sep 17 00:00:00 2001 From: Cory Wright Date: Fri, 4 Mar 2011 17:48:28 +0000 Subject: * Tests to verify correct vm-params for Windows and Linux instances --- nova/compute/api.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'nova/compute') diff --git a/nova/compute/api.py b/nova/compute/api.py index 8bdf712a0..d79371e94 100644 --- a/nova/compute/api.py +++ b/nova/compute/api.py @@ -125,7 +125,10 @@ class API(base.Base): raise quota.QuotaError(msg, "MetadataLimitExceeded") image = self.image_service.show(context, image_id) - os_type = image['properties'].get('os_type', 'linux') + + os_type = None + if 'properties' in image and 'os_type' in image['properties']: + os_type = image['properties']['os_type'] if kernel_id is None: kernel_id = image.get('kernel_id', None) -- cgit From a5bee00af4d6ec3eed6ed0abd866948f4510f041 Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Mon, 7 Mar 2011 01:25:01 +0000 Subject: make compute get the new images properly, fix a bunch of tests, and provide conversion commands --- 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 35a7d7bc0..58118121a 100644 --- a/nova/compute/api.py +++ b/nova/compute/api.py @@ -126,9 +126,9 @@ class API(base.Base): image = self.image_service.show(context, image_id) if kernel_id is None: - kernel_id = image.get('kernel_id', None) + kernel_id = image['properties'].get('kernel_id', None) if ramdisk_id is None: - ramdisk_id = image.get('ramdisk_id', None) + ramdisk_id = image['properties'].get('ramdisk_id', None) # FIXME(sirp): is there a way we can remove null_kernel? # No kernel and ramdisk for raw images if kernel_id == str(FLAGS.null_kernel): -- cgit From a9bd1b456332aaf5f6ab9942979485f2192b6f3e Mon Sep 17 00:00:00 2001 From: Dan Prince Date: Wed, 9 Mar 2011 14:53:44 -0500 Subject: Add password parameter to the set_admin_password call in the compute api. Updated servers password to use this parameter. --- nova/compute/api.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'nova/compute') diff --git a/nova/compute/api.py b/nova/compute/api.py index 33d25fc4b..a0bb2cf04 100644 --- a/nova/compute/api.py +++ b/nova/compute/api.py @@ -498,9 +498,10 @@ class API(base.Base): """Unrescue the given instance.""" self._cast_compute_message('unrescue_instance', context, instance_id) - def set_admin_password(self, context, instance_id): + def set_admin_password(self, context, instance_id, password=None): """Set the root/admin password for the given instance.""" - self._cast_compute_message('set_admin_password', context, instance_id) + self._cast_compute_message('set_admin_password', context, instance_id, + password) def inject_file(self, context, instance_id): """Write a file to the given instance.""" -- cgit From 203e23ebebc73a98dc8e8497fd2b28d3a6bf01da Mon Sep 17 00:00:00 2001 From: Ken Pepple Date: Wed, 9 Mar 2011 14:13:52 -0800 Subject: initializing instance power state on launch to 0 (fixes EC2 API bug) --- nova/compute/api.py | 1 + 1 file changed, 1 insertion(+) (limited to 'nova/compute') diff --git a/nova/compute/api.py b/nova/compute/api.py index a0bb2cf04..2358b562c 100644 --- a/nova/compute/api.py +++ b/nova/compute/api.py @@ -165,6 +165,7 @@ class API(base.Base): 'image_id': image_id, 'kernel_id': kernel_id or '', 'ramdisk_id': ramdisk_id or '', + 'state': "0", 'state_description': 'scheduling', 'user_id': context.user_id, 'project_id': context.project_id, -- cgit From 9822af58162dc520c4a17646a013560e422efcf9 Mon Sep 17 00:00:00 2001 From: Ken Pepple Date: Wed, 9 Mar 2011 14:54:57 -0800 Subject: maybe a int instead ? --- 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 2358b562c..5334acfcf 100644 --- a/nova/compute/api.py +++ b/nova/compute/api.py @@ -165,7 +165,7 @@ class API(base.Base): 'image_id': image_id, 'kernel_id': kernel_id or '', 'ramdisk_id': ramdisk_id or '', - 'state': "0", + 'state': 0, 'state_description': 'scheduling', 'user_id': context.user_id, 'project_id': context.project_id, -- cgit From f0bb6d9fc47b92d335c7d7fa238dfd43f0dbdf69 Mon Sep 17 00:00:00 2001 From: Kei Masumoto Date: Thu, 10 Mar 2011 13:30:52 +0900 Subject: fixed based on reviewer's comment. --- nova/compute/manager.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'nova/compute') diff --git a/nova/compute/manager.py b/nova/compute/manager.py index 3675cc92e..0cab10fc3 100644 --- a/nova/compute/manager.py +++ b/nova/compute/manager.py @@ -64,7 +64,7 @@ flags.DEFINE_integer('password_length', 12, flags.DEFINE_string('console_host', socket.gethostname(), 'Console proxy host to use to connect to instances on' 'this host.') -flags.DEFINE_string('live_migration_retry_count', 30, +flags.DEFINE_integer('live_migration_retry_count', 30, ("Retry count needed in live_migration." " sleep 1 sec for each count")) @@ -757,8 +757,9 @@ class ComputeManager(manager.Manager): dirpath = FLAGS.instances_path fd, tmp_file = tempfile.mkstemp(dir=dirpath) LOG.debug(_("Creating tmpfile %s to notify to other " - "compute node that they mounts same storage.") % tmp_file) - os.fdopen(fd, 'w+').close() + "compute nodes that they should mount " + "the same storage.") % tmp_file) + os.close(fd) return os.path.basename(tmp_file) @exception.wrap_exception @@ -812,7 +813,7 @@ class ComputeManager(manager.Manager): # Getting fixed ips fixed_ip = self.db.instance_get_fixed_address(context, instance_id) if not fixed_ip: - msg = _("%(instance_id)s(%(ec2_id)s) does'nt have fixed_ip") + msg = _("%(instance_id)s(%(ec2_id)s) does not have fixed_ip.") raise exception.NotFound(msg % locals()) # If any volume is mounted, prepare here. @@ -929,7 +930,7 @@ class ComputeManager(manager.Manager): floating_ip = self.db.instance_get_floating_address(ctxt, instance_id) if not floating_ip: - LOG.info(_('floating_ip is not found for %s'), i_name) + LOG.info(_('No floating_ip is found for %s.'), i_name) else: floating_ip_ref = self.db.floating_ip_get_by_address(ctxt, floating_ip) @@ -937,7 +938,7 @@ class ComputeManager(manager.Manager): floating_ip_ref['address'], {'host': dest}) except exception.NotFound: - LOG.info(_('Floating_ip is not found for %s'), i_name) + LOG.info(_('No floating_ip is found for %s.'), i_name) except: LOG.error(_("Live migration: Unexpected error:" "%s cannot inherit floating ip..") % i_name) @@ -945,12 +946,11 @@ class ComputeManager(manager.Manager): # Restore instance/volume state self.recover_live_migration(ctxt, instance_ref, dest) - LOG.info(_('Migrating %(i_name)s to %(dest)s finishes successfully.') + LOG.info(_('Migrating %(i_name)s to %(dest)s finished successfully.') % locals()) - LOG.info(_("The below error is normally occurs. " - "Just check if instance is successfully migrated.\n" - "libvir: QEMU error : Domain not found: no domain " - "with matching name..")) + LOG.info(_("You may see the error \"libvirt: QEMU error: " + "Domain not found: no domain with matching name.\" " + "This error can be safely ignored.")) def recover_live_migration(self, ctxt, instance_ref, host=None): """Recovers Instance/volume state from migrating -> running. -- cgit From 616723fe4e7d52b0b8ddafda10fcfe07a87609c8 Mon Sep 17 00:00:00 2001 From: Mark Washenberger Date: Thu, 10 Mar 2011 14:53:13 -0500 Subject: add docstring --- nova/compute/api.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'nova/compute') diff --git a/nova/compute/api.py b/nova/compute/api.py index 2766ddc9c..efa051d10 100644 --- a/nova/compute/api.py +++ b/nova/compute/api.py @@ -81,6 +81,11 @@ class API(base.Base): {"method": "get_network_topic", "args": {'fake': 1}}) def _check_personality_file_quota(self, context, personality_files): + """ + Enforce quota limits on personality files + + Raises a QuotaError if any limit is exceeded + """ limit = quota.allowed_personality_files(context) if len(personality_files) > limit: raise quota.QuotaError(_("Personality limit exceeded. You can " -- cgit From c967679fa8144af57d79d89666ee29a0241d38a9 Mon Sep 17 00:00:00 2001 From: Mark Washenberger Date: Thu, 10 Mar 2011 17:36:41 -0500 Subject: switch to a more consistent usage of onset_files variable names --- nova/compute/api.py | 38 +++++++++++++++----------------------- nova/compute/manager.py | 2 +- 2 files changed, 16 insertions(+), 24 deletions(-) (limited to 'nova/compute') diff --git a/nova/compute/api.py b/nova/compute/api.py index b97cadf61..140bbb3aa 100644 --- a/nova/compute/api.py +++ b/nova/compute/api.py @@ -80,30 +80,23 @@ class API(base.Base): topic, {"method": "get_network_topic", "args": {'fake': 1}}) - def _check_personality_file_quota(self, context, personality_files): + def _check_onset_file_quota(self, context, onset_files): """ - Enforce quota limits on personality files + Enforce quota limits on onset files Raises a QuotaError if any limit is exceeded """ - limit = quota.allowed_personality_files(context) - if len(personality_files) > limit: - raise quota.QuotaError(_("Personality limit exceeded. You can " - "only have %d personalities when " - "creating an instance.") % limit, - "PersonalityLimitExceeded") - path_limit = quota.allowed_personality_path_bytes(context) - content_limit = quota.allowed_personality_content_bytes(context) - for path, content in personality_files: + limit = quota.allowed_onset_files(context) + if len(onset_files) > limit: + raise quota.QuotaError(code="OnsetFileLimitExceeded") + path_limit = quota.allowed_onset_file_path_bytes(context) + content_limit = quota.allowed_onset_file_content_bytes(context) + for path, content in onset_files: if len(path) > path_limit: - raise quota.QuotaError( - _("Personality file path limit exceeded."), - "PersonalityLimitExceeded") + raise quota.QuotaError(code="OnsetFilePathLimitExceeded") if len(content) > content_limit: - raise quota.QuotaError( - _("Personality file content limit exceeded."), - "PersonalityLimitExceeded") - return personality_files + raise quota.QuotaError(code="OnsetFileContentLimitExceeded") + return onset_files def create(self, context, instance_type, image_id, kernel_id=None, ramdisk_id=None, @@ -111,7 +104,7 @@ class API(base.Base): display_name='', display_description='', key_name=None, key_data=None, security_group='default', availability_zone=None, user_data=None, metadata=[], - personality_files=None): + onset_files=None): """Create the number of instances requested if quota and other arguments check out ok.""" @@ -149,9 +142,8 @@ class API(base.Base): LOG.warn(msg) raise quota.QuotaError(msg, "MetadataLimitExceeded") - if personality_files is not None: - personality_files = \ - self._check_personality_file_quota(context, personality_files) + if onset_files is not None: + onset_files = self._check_onset_file_quota(context, onset_files) image = self.image_service.show(context, image_id) if kernel_id is None: @@ -248,7 +240,7 @@ class API(base.Base): "args": {"topic": FLAGS.compute_topic, "instance_id": instance_id, "availability_zone": availability_zone, - "personality_files": personality_files}}) + "onset_files": onset_files}}) for group_id in security_groups: self.trigger_security_group_members_refresh(elevated, group_id) diff --git a/nova/compute/manager.py b/nova/compute/manager.py index d87290aae..601bb3084 100644 --- a/nova/compute/manager.py +++ b/nova/compute/manager.py @@ -173,7 +173,7 @@ class ComputeManager(manager.Manager): """Launch a new instance with specified options.""" context = context.elevated() instance_ref = self.db.instance_get(context, instance_id) - instance_ref.onset_files = kwargs.get('personality_files', []) + instance_ref.onset_files = kwargs.get('onset_files', []) if instance_ref['name'] in self.driver.list_instances(): raise exception.Error(_("Instance has already been created")) LOG.audit(_("instance %s: starting..."), instance_id, -- cgit From 1d69d499124317aa1a9cf7d4bc54db2ff0bc3be9 Mon Sep 17 00:00:00 2001 From: Mark Washenberger Date: Tue, 15 Mar 2011 14:33:45 -0400 Subject: refactor onset_files quota checking --- 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 b6ef889f6..c11059a28 100644 --- a/nova/compute/api.py +++ b/nova/compute/api.py @@ -86,6 +86,8 @@ class API(base.Base): Raises a QuotaError if any limit is exceeded """ + if onset_files is None: + return limit = quota.allowed_onset_files(context) if len(onset_files) > limit: raise quota.QuotaError(code="OnsetFileLimitExceeded") @@ -96,7 +98,6 @@ class API(base.Base): raise quota.QuotaError(code="OnsetFilePathLimitExceeded") if len(content) > content_limit: raise quota.QuotaError(code="OnsetFileContentLimitExceeded") - return onset_files def create(self, context, instance_type, image_id, kernel_id=None, ramdisk_id=None, @@ -142,8 +143,7 @@ class API(base.Base): LOG.warn(msg) raise quota.QuotaError(msg, "MetadataLimitExceeded") - if onset_files is not None: - onset_files = self._check_onset_file_quota(context, onset_files) + self._check_onset_file_quota(context, onset_files) image = self.image_service.show(context, image_id) -- cgit From e9ef6e04786a40d20f8022bec5d23d2e4503ce3a Mon Sep 17 00:00:00 2001 From: Mark Washenberger Date: Tue, 15 Mar 2011 17:56:00 -0400 Subject: s/onset_files/injected_files/g --- nova/compute/api.py | 22 +++++++++++----------- nova/compute/manager.py | 2 +- 2 files changed, 12 insertions(+), 12 deletions(-) (limited to 'nova/compute') diff --git a/nova/compute/api.py b/nova/compute/api.py index c11059a28..32577af82 100644 --- a/nova/compute/api.py +++ b/nova/compute/api.py @@ -80,20 +80,20 @@ class API(base.Base): topic, {"method": "get_network_topic", "args": {'fake': 1}}) - def _check_onset_file_quota(self, context, onset_files): + def _check_injected_file_quota(self, context, injected_files): """ - Enforce quota limits on onset files + Enforce quota limits on injected files Raises a QuotaError if any limit is exceeded """ - if onset_files is None: + if injected_files is None: return - limit = quota.allowed_onset_files(context) - if len(onset_files) > limit: + limit = quota.allowed_injected_files(context) + if len(injected_files) > limit: raise quota.QuotaError(code="OnsetFileLimitExceeded") - path_limit = quota.allowed_onset_file_path_bytes(context) - content_limit = quota.allowed_onset_file_content_bytes(context) - for path, content in onset_files: + path_limit = quota.allowed_injected_file_path_bytes(context) + content_limit = quota.allowed_injected_file_content_bytes(context) + for path, content in injected_files: if len(path) > path_limit: raise quota.QuotaError(code="OnsetFilePathLimitExceeded") if len(content) > content_limit: @@ -105,7 +105,7 @@ class API(base.Base): display_name='', display_description='', key_name=None, key_data=None, security_group='default', availability_zone=None, user_data=None, metadata=[], - onset_files=None): + injected_files=None): """Create the number of instances requested if quota and other arguments check out ok.""" @@ -143,7 +143,7 @@ class API(base.Base): LOG.warn(msg) raise quota.QuotaError(msg, "MetadataLimitExceeded") - self._check_onset_file_quota(context, onset_files) + self._check_injected_file_quota(context, injected_files) image = self.image_service.show(context, image_id) @@ -246,7 +246,7 @@ class API(base.Base): "args": {"topic": FLAGS.compute_topic, "instance_id": instance_id, "availability_zone": availability_zone, - "onset_files": onset_files}}) + "injected_files": injected_files}}) for group_id in security_groups: self.trigger_security_group_members_refresh(elevated, group_id) diff --git a/nova/compute/manager.py b/nova/compute/manager.py index 6bb169fa5..92deca813 100644 --- a/nova/compute/manager.py +++ b/nova/compute/manager.py @@ -179,7 +179,7 @@ class ComputeManager(manager.Manager): """Launch a new instance with specified options.""" context = context.elevated() instance_ref = self.db.instance_get(context, instance_id) - instance_ref.onset_files = kwargs.get('onset_files', []) + instance_ref.injected_files = kwargs.get('injected_files', []) if instance_ref['name'] in self.driver.list_instances(): raise exception.Error(_("Instance has already been created")) LOG.audit(_("instance %s: starting..."), instance_id, -- cgit