From 08963a0df7a6d1c90ba12ce60cbf15c93b0b70e6 Mon Sep 17 00:00:00 2001 From: Anthony Young Date: Tue, 21 Dec 2010 14:44:53 -0800 Subject: prototype works with kvm. now moving call from api to compute --- nova/compute/instance_types.py | 2 +- nova/compute/manager.py | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) (limited to 'nova/compute') diff --git a/nova/compute/instance_types.py b/nova/compute/instance_types.py index 67ee8f8a8..bca9839d0 100644 --- a/nova/compute/instance_types.py +++ b/nova/compute/instance_types.py @@ -22,7 +22,7 @@ The built-in instance properties. """ INSTANCE_TYPES = { - 'm1.tiny': dict(memory_mb=512, vcpus=1, local_gb=0, flavorid=1), + 'm1.tiny': dict(memory_mb=128, vcpus=1, local_gb=0, flavorid=1), 'm1.small': dict(memory_mb=2048, vcpus=1, local_gb=20, flavorid=2), 'm1.medium': dict(memory_mb=4096, vcpus=2, local_gb=40, flavorid=3), 'm1.large': dict(memory_mb=8192, vcpus=4, local_gb=80, flavorid=4), diff --git a/nova/compute/manager.py b/nova/compute/manager.py index 523bb8893..0897eee45 100644 --- a/nova/compute/manager.py +++ b/nova/compute/manager.py @@ -154,6 +154,15 @@ class ComputeManager(manager.Manager): return self.driver.get_console_output(instance_ref) + @exception.wrap_exception + def get_ajax_console(self, context, instance_id): + """Send the console output for an instance.""" + context = context.elevated() + logging.debug("instance %s: getting ajax console", instance_id) + instance_ref = self.db.instance_get(context, instance_id) + + return self.driver.get_console_output(instance_ref) + @defer.inlineCallbacks @exception.wrap_exception def attach_volume(self, context, instance_id, volume_id, mountpoint): -- cgit From a84e2b9131e4c8b212c9de0b9ad4931f7743ff75 Mon Sep 17 00:00:00 2001 From: Anthony Young Date: Tue, 21 Dec 2010 18:20:55 -0800 Subject: move prototype code from api into compute worker --- 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 0897eee45..1fc71d1e5 100644 --- a/nova/compute/manager.py +++ b/nova/compute/manager.py @@ -161,7 +161,7 @@ class ComputeManager(manager.Manager): logging.debug("instance %s: getting ajax console", instance_id) instance_ref = self.db.instance_get(context, instance_id) - return self.driver.get_console_output(instance_ref) + return self.driver.get_ajax_console(instance_ref) @defer.inlineCallbacks @exception.wrap_exception -- cgit From aa8a6a01bdf8a2f0f732e993a1732993f7328eff Mon Sep 17 00:00:00 2001 From: Anthony Young Date: Wed, 22 Dec 2010 13:00:20 -0800 Subject: add in support of openstack api --- 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 c740814da..1acf320ae 100644 --- a/nova/compute/api.py +++ b/nova/compute/api.py @@ -316,6 +316,30 @@ class ComputeAPI(base.Base): {"method": "unrescue_instance", "args": {"instance_id": instance['id']}}) + def get_ajax_console(self, context, instance_id): + """Get an AJAX Console + + In order for this to work properly, a ttyS0 must be configured + in the instance + """ + + instance_ref = db.instance_get_by_internal_id(context, instance_id) + + output = rpc.call(context, + '%s.%s' % (FLAGS.compute_topic, + instance_ref['host']), + {'method': 'get_ajax_console', + 'args': {'instance_id': instance_ref['id']}}) + + # TODO: make this a call + rpc.cast(context, '%s' % FLAGS.ajax_console_proxy_topic, + {'method': 'authorize_ajax_console', + 'args': {'token': output['token'], 'host': output['host'], + 'port':output['port']}}) + + return {'url': '%s?token=%s' % (FLAGS.ajax_console_proxy_url, + output['token'])} + def _get_network_topic(self, context): """Retrieves the network host for a project""" network_ref = self.network_manager.get_network(context) -- cgit From 4e9b4c9ce31a7a50d7e38d5e0bd71718d5bb8b95 Mon Sep 17 00:00:00 2001 From: Anthony Young Date: Wed, 22 Dec 2010 18:52:43 -0800 Subject: minor notes, commit before rewriting proxy with eventlet --- 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 1acf320ae..3e9b58db5 100644 --- a/nova/compute/api.py +++ b/nova/compute/api.py @@ -331,7 +331,6 @@ class ComputeAPI(base.Base): {'method': 'get_ajax_console', 'args': {'instance_id': instance_ref['id']}}) - # TODO: make this a call rpc.cast(context, '%s' % FLAGS.ajax_console_proxy_topic, {'method': 'authorize_ajax_console', 'args': {'token': output['token'], 'host': output['host'], -- cgit From f4a2d86519434f934bd6c90ba401b08875420d19 Mon Sep 17 00:00:00 2001 From: Sandy Walsh Date: Mon, 3 Jan 2011 05:17:42 -0800 Subject: temp --- 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 07c69bd31..be188190d 100644 --- a/nova/compute/api.py +++ b/nova/compute/api.py @@ -102,6 +102,7 @@ class ComputeAPI(base.Base): ramdisk_id = None logging.debug("Creating a raw instance") # Make sure we have access to kernel and ramdisk (if not raw) + logging.debug("KERNEL=%s, RAMDISK=%s" % (kernel_id, ramdisk_id)) if kernel_id: self.image_service.show(context, kernel_id) if ramdisk_id: -- cgit From 1097e32645dad68b89507d6ac7704c1db626723b Mon Sep 17 00:00:00 2001 From: Sandy Walsh Date: Mon, 3 Jan 2011 19:10:33 -0800 Subject: dabo fix to update for password reset --- 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 edc8c0b4a..fa9925627 100644 --- a/nova/compute/api.py +++ b/nova/compute/api.py @@ -204,7 +204,7 @@ class ComputeAPI(base.Base): """Updates the instance in the datastore. :param context: The security context - :param instance_id: ID of the instance to update + :param instance_id: internal_id of the instance to update :param kwargs: All additional keyword args are treated as data fields of the instance to be updated @@ -212,7 +212,8 @@ class ComputeAPI(base.Base): :retval None """ - return self.db.instance_update(context, instance_id, kwargs) + instance = self.get_instance(context, instance_id) + return self.db.instance_update(context, instance.id, kwargs) def delete_instance(self, context, instance_id): logging.debug("Going to try and terminate %d" % instance_id) -- cgit From 75618ce6379cb01b9f78ddb7c2f26501b838ca71 Mon Sep 17 00:00:00 2001 From: Sandy Walsh Date: Mon, 3 Jan 2011 19:32:25 -0800 Subject: dabo fix to update for password reset v2 --- nova/compute/api.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'nova/compute') diff --git a/nova/compute/api.py b/nova/compute/api.py index fa9925627..edc8c0b4a 100644 --- a/nova/compute/api.py +++ b/nova/compute/api.py @@ -204,7 +204,7 @@ class ComputeAPI(base.Base): """Updates the instance in the datastore. :param context: The security context - :param instance_id: internal_id of the instance to update + :param instance_id: ID of the instance to update :param kwargs: All additional keyword args are treated as data fields of the instance to be updated @@ -212,8 +212,7 @@ class ComputeAPI(base.Base): :retval None """ - instance = self.get_instance(context, instance_id) - return self.db.instance_update(context, instance.id, kwargs) + return self.db.instance_update(context, instance_id, kwargs) def delete_instance(self, context, instance_id): logging.debug("Going to try and terminate %d" % instance_id) -- cgit From ee2d8a5bcdaf938b7047131d7809d1b6b3120b59 Mon Sep 17 00:00:00 2001 From: Anthony Young Date: Mon, 3 Jan 2011 22:51:19 -0800 Subject: some fixes per vish's feedback --- nova/compute/instance_types.py | 2 +- nova/compute/manager.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'nova/compute') diff --git a/nova/compute/instance_types.py b/nova/compute/instance_types.py index 02defbf2f..196d6a8df 100644 --- a/nova/compute/instance_types.py +++ b/nova/compute/instance_types.py @@ -26,7 +26,7 @@ from nova import exception FLAGS = flags.FLAGS INSTANCE_TYPES = { - 'm1.tiny': dict(memory_mb=128, vcpus=1, local_gb=0, flavorid=1), + 'm1.tiny': dict(memory_mb=512, vcpus=1, local_gb=0, flavorid=1), 'm1.small': dict(memory_mb=2048, vcpus=1, local_gb=20, flavorid=2), 'm1.medium': dict(memory_mb=4096, vcpus=2, local_gb=40, flavorid=3), 'm1.large': dict(memory_mb=8192, vcpus=4, local_gb=80, flavorid=4), diff --git a/nova/compute/manager.py b/nova/compute/manager.py index 882b000ef..e485a0415 100644 --- a/nova/compute/manager.py +++ b/nova/compute/manager.py @@ -372,7 +372,7 @@ class ComputeManager(manager.Manager): def get_ajax_console(self, context, instance_id): """Send the console output for an instance.""" context = context.elevated() - logging.debug("instance %s: getting ajax console", instance_id) + logging.debug(_("instance %s: getting ajax console"), instance_id) instance_ref = self.db.instance_get(context, instance_id) return self.driver.get_ajax_console(instance_ref) -- cgit From e774f2cd7206b5ae632a42c1eda7330858b1613c Mon Sep 17 00:00:00 2001 From: Sandy Walsh Date: Wed, 5 Jan 2011 03:51:21 -0400 Subject: pep8 --- nova/compute/api.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'nova/compute') diff --git a/nova/compute/api.py b/nova/compute/api.py index edc8c0b4a..f9595bde5 100644 --- a/nova/compute/api.py +++ b/nova/compute/api.py @@ -102,7 +102,8 @@ class ComputeAPI(base.Base): ramdisk_id = None logging.debug("Creating a raw instance") # Make sure we have access to kernel and ramdisk (if not raw) - logging.debug("Using Kernel=%s, Ramdisk=%s" % (kernel_id, ramdisk_id)) + logging.debug("Using Kernel=%s, Ramdisk=%s" % + (kernel_id, ramdisk_id)) if kernel_id: self.image_service.show(context, kernel_id) if ramdisk_id: -- cgit From b437a98738c7a564205d1b27e36b844cd54445d1 Mon Sep 17 00:00:00 2001 From: Monsyne Dragon Date: Wed, 5 Jan 2011 14:16:14 -0600 Subject: add in xs-console worker and tests. --- nova/compute/manager.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'nova/compute') diff --git a/nova/compute/manager.py b/nova/compute/manager.py index 70b175e7c..295e75eca 100644 --- a/nova/compute/manager.py +++ b/nova/compute/manager.py @@ -99,6 +99,11 @@ class ComputeManager(manager.Manager): FLAGS.network_topic, host) + + def get_console_pool_info(self, context, console_type): + return self.driver.get_console_pool_info(console_type) + + @exception.wrap_exception def refresh_security_group(self, context, security_group_id, **_kwargs): """This call passes stright through to the virtualization driver.""" -- cgit From f21f078113fc81c1dcee4f3a077bd555c0cf85f6 Mon Sep 17 00:00:00 2001 From: Monsyne Dragon Date: Wed, 5 Jan 2011 19:45:46 -0600 Subject: Fix a bunch of pep8 stuff --- 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 3e73c351c..403b46b2a 100644 --- a/nova/compute/manager.py +++ b/nova/compute/manager.py @@ -112,11 +112,9 @@ class ComputeManager(manager.Manager): FLAGS.network_topic, host) - def get_console_pool_info(self, context, console_type): return self.driver.get_console_pool_info(console_type) - @exception.wrap_exception def refresh_security_group(self, context, security_group_id, **_kwargs): """This call passes stright through to the virtualization driver.""" -- cgit From 114577d4f4ed1ca173dadf47d4bf3a5a05c449a2 Mon Sep 17 00:00:00 2001 From: Sandy Walsh Date: Thu, 6 Jan 2011 03:05:59 -0400 Subject: Fixed display_name on create_instance --- 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 7ab7eb6ad..252f88003 100644 --- a/nova/compute/api.py +++ b/nova/compute/api.py @@ -171,7 +171,7 @@ class API(base.Base): # Set sane defaults if not specified updates = dict(hostname=generate_hostname(instance_id)) - if 'display_name' not in instance: + if not hasattr(instance, 'display_name'): updates['display_name'] = "Server %s" % instance_id instance = self.update(context, instance_id, **updates) -- cgit From 457e19826cfdb7f8f324180e42d8df79da48cfc6 Mon Sep 17 00:00:00 2001 From: Sandy Walsh Date: Thu, 6 Jan 2011 04:55:16 -0400 Subject: renamed sharedipgroups to shared_ip_groups and fixed tests for display_name --- nova/compute/api.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'nova/compute') diff --git a/nova/compute/api.py b/nova/compute/api.py index 252f88003..912c7d93f 100644 --- a/nova/compute/api.py +++ b/nova/compute/api.py @@ -171,7 +171,8 @@ class API(base.Base): # Set sane defaults if not specified updates = dict(hostname=generate_hostname(instance_id)) - if not hasattr(instance, 'display_name'): + if (not hasattr(instance, 'display_name')) or \ + instance.display_name == None: updates['display_name'] = "Server %s" % instance_id instance = self.update(context, instance_id, **updates) -- cgit From 3478e90442ad7a22497b53153ae893df96e55b4e Mon Sep 17 00:00:00 2001 From: Eldar Nugaev Date: Fri, 7 Jan 2011 05:59:30 +0300 Subject: merge --- nova/compute/api.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'nova/compute') diff --git a/nova/compute/api.py b/nova/compute/api.py index 64d47b1ce..3ba91fe05 100644 --- a/nova/compute/api.py +++ b/nova/compute/api.py @@ -181,7 +181,8 @@ class API(base.Base): FLAGS.scheduler_topic, {"method": "run_instance", "args": {"topic": FLAGS.compute_topic, - "instance_id": instance_id}}) + "instance_id": instance_id, + "availability_zone": availability_zone}}) return instances -- cgit From 4edfa8ea26f8e820674e8bebbe34b6ed5885a69b Mon Sep 17 00:00:00 2001 From: Anthony Young Date: Mon, 10 Jan 2011 13:44:45 -0800 Subject: consolidate boto_extensions.py and euca-get-ajax-console, fix bugs from previous trunk merge --- 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 adf4dbe43..4d25bd705 100644 --- a/nova/compute/api.py +++ b/nova/compute/api.py @@ -416,13 +416,13 @@ class API(base.Base): def get_ajax_console(self, context, instance_id): """Get a url to an AJAX Console""" - instance_ref = db.instance_get_by_internal_id(context, instance_id) + instance = self.get(context, instance_id) output = rpc.call(context, '%s.%s' % (FLAGS.compute_topic, - instance_ref['host']), + instance['host']), {'method': 'get_ajax_console', - 'args': {'instance_id': instance_ref['id']}}) + 'args': {'instance_id': instance['id']}}) rpc.cast(context, '%s' % FLAGS.ajax_console_proxy_topic, {'method': 'authorize_ajax_console', -- cgit From eb48bdce5ad131245977dff50030f5561b8809c1 Mon Sep 17 00:00:00 2001 From: Anthony Young Date: Tue, 11 Jan 2011 14:33:20 -0800 Subject: bah - pep8 errors --- 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 4d25bd705..632ce0efb 100644 --- a/nova/compute/api.py +++ b/nova/compute/api.py @@ -426,8 +426,8 @@ class API(base.Base): rpc.cast(context, '%s' % FLAGS.ajax_console_proxy_topic, {'method': 'authorize_ajax_console', - 'args': {'token': output['token'], 'host': output['host'], - 'port':output['port']}}) + 'args': {'token': output['token'], 'host': output['host'], + 'port': output['port']}}) return {'url': '%s?token=%s' % (FLAGS.ajax_console_proxy_url, output['token'])} -- cgit