Comment 1 for bug 923546

Revision history for this message
Tomoe Sugihara (tomoe) wrote :

I tried the following patch to fix the obvious bugs, but it still doesn't work.
Seems like this feature is not working, or am I missing something?

The patch:
-------------------------------

midokura@midokura-iMac:/opt/stack/nova$ git diff
diff --git a/nova/api/ec2/cloud.py b/nova/api/ec2/cloud.py
index 5a3b952..7a18595 100644
--- a/nova/api/ec2/cloud.py
+++ b/nova/api/ec2/cloud.py
@@ -1533,7 +1533,7 @@ class CloudController(object):

             if vm_state in (vm_states.ACTIVE, vm_states.SHUTOFF):
                 restart_instance = True
- self.compute_api.stop(context, instance_id=instance_id)
+ self.compute_api.stop(context, instance)

             # wait instance for really stopped
             start_time = time.time()
@@ -1549,7 +1549,15 @@ class CloudController(object):
                     raise exception.ApiError(
                         _('Couldn\'t stop instance with in %d sec') % timeout)

- src_image = self._get_image(context, instance['image_ref'])
+ image_uuid = instance['image_ref']
+ image_id = self._get_image_id(context, image_uuid)
+ ec2_image_id = ec2utils.image_ec2_id(image_id)
+
+ print ' image_ref ----------> ', instance['image_ref']
+ print ' ec2_image_id -------> ', ec2_image_id
+
+ src_image = self._get_image(context, ec2_image_id)
+ print' src_image ', src_image
         properties = src_image['properties']
         if instance['root_device_name']:
             properties['root_device_name'] = instance['root_device_name']
---------------------

Another Error:
---------------------
2012-01-30 09:53:55,982 DEBUG keystone.middleware.auth_token [-] Sending request to next app in WSGI pipeline from (pid=23018) debug /opt/stack/nova/nova/log.py:175
2012-01-30 09:53:55,983 DEBUG nova.api [req-ad27ede4-b92b-4ca4-8c6e-5349fee5cd0f 5e653de2fb5d4b508012406df77ec445 03c6ffa2bee74bca9bec99e82d872673] action: CreateImage from (pid=23018) debug /opt/stack/nova/nova/log.py:175
2012-01-30 09:53:55,983 DEBUG nova.api [req-ad27ede4-b92b-4ca4-8c6e-5349fee5cd0f 5e653de2fb5d4b508012406df77ec445 03c6ffa2bee74bca9bec99e82d872673] arg: Name val: created-image from (pid=23018) debug /opt/stack/nova/nova/log.py:175
2012-01-30 09:53:55,983 DEBUG nova.api [req-ad27ede4-b92b-4ca4-8c6e-5349fee5cd0f 5e653de2fb5d4b508012406df77ec445 03c6ffa2bee74bca9bec99e82d872673] arg: InstanceId val: i-00000001 from (pid=23018) debug /opt/stack/nova/nova/log.py:175
2012-01-30 09:53:56,020 DEBUG nova.compute.api [req-ad27ede4-b92b-4ca4-8c6e-5349fee5cd0f 5e653de2fb5d4b508012406df77ec445 03c6ffa2bee74bca9bec99e82d872673] Going to try to stop 5e32efbc-77ad-4108-a237-e5cf9f5a0ae7 from (pid=23018) debug /opt/stack/nova/nova/log.py:175
2012-01-30 09:53:56,101 DEBUG nova.rpc [req-ad27ede4-b92b-4ca4-8c6e-5349fee5cd0f 5e653de2fb5d4b508012406df77ec445 03c6ffa2bee74bca9bec99e82d872673] Making asynchronous cast on compute.midokura-iMac... from (pid=23018) debug /opt/stack/nova/nova/log.py:175
2012-01-30 09:53:56,101 DEBUG nova.rpc [req-ad27ede4-b92b-4ca4-8c6e-5349fee5cd0f 5e653de2fb5d4b508012406df77ec445 03c6ffa2bee74bca9bec99e82d872673] Pool creating new connection from (pid=23018) debug /opt/stack/nova/nova/log.py:175
2012-01-30 09:53:56,107 INFO nova.rpc [req-ad27ede4-b92b-4ca4-8c6e-5349fee5cd0f 5e653de2fb5d4b508012406df77ec445 03c6ffa2bee74bca9bec99e82d872673] Connected to AMQP server on localhost:5672
 image_ref ----------> 871e53a5-be19-4084-acad-4f53dc47fae0
 ec2_image_id -------> ami-00000003
  src_image {'status': 'active', 'name': 'cirros-0.3.0-x86_64-blank', 'deleted': False, 'container_format': 'ami', 'created_at': datetime.datetime(2012, 1, 30, 0, 24, 15), 'disk_format': 'ami', 'updated_at': datetime.datetime(2012, 1, 30, 0, 24, 15), 'properties': {'kernel_id': 2L, 'ramdisk_id': 1L}, 'min_ram': '0', 'checksum': '2f81976cae15c16ef0010c51e3a6c163', 'min_disk': '0', 'is_public': True, 'deleted_at': None, 'id': 3L, 'size': 25165824}
2012-01-30 09:53:59,323 ERROR nova.api [req-ad27ede4-b92b-4ca4-8c6e-5349fee5cd0f 5e653de2fb5d4b508012406df77ec445 03c6ffa2bee74bca9bec99e82d872673] Unexpected error raised: 'image_location'
(nova.api): TRACE: Traceback (most recent call last):
(nova.api): TRACE: File "/opt/stack/nova/nova/api/ec2/__init__.py", line 460, in __call__
(nova.api): TRACE: result = api_request.invoke(context)
(nova.api): TRACE: File "/opt/stack/nova/nova/api/ec2/apirequest.py", line 90, in invoke
(nova.api): TRACE: result = method(context, **args)
(nova.api): TRACE: File "/opt/stack/nova/nova/api/ec2/cloud.py", line 1617, in create_image
(nova.api): TRACE: image_id = self._register_image(context, src_image)
(nova.api): TRACE: File "/opt/stack/nova/nova/api/ec2/cloud.py", line 1422, in _register_image
(nova.api): TRACE: image = self.image_service.create(context, metadata)
(nova.api): TRACE: File "/opt/stack/nova/nova/image/s3.py", line 105, in create
(nova.api): TRACE: image = self._s3_create(context, metadata)
(nova.api): TRACE: File "/opt/stack/nova/nova/image/s3.py", line 256, in _s3_create
(nova.api): TRACE: image_location = metadata['properties']['image_location']
(nova.api): TRACE: KeyError: 'image_location'
(nova.api): TRACE:
2012-01-30 09:53:59,324 ERROR nova.api [req-ad27ede4-b92b-4ca4-8c6e-5349fee5cd0f 5e653de2fb5d4b508012406df77ec445 03c6ffa2bee74bca9bec99e82d872673] Environment: {"HTTP_AUTHORIZATION": "Basic None", "SCRIPT_NAME": "/services/Cloud", "REQUEST_METHOD": "POST", "PATH_INFO": "/", "SERVER_PROTOCOL": "HTTP/1.0", "HTTP_X_IDENTITY_STATUS": "Confirmed", "HTTP_USER_AGENT": "Boto/2.0 (linux2)", "SERVER_NAME": "192.168.1.138", "REMOTE_ADDR": "192.168.1.138", "wsgi.url_scheme": "http", "SERVER_PORT": "8773", "CONTENT_TYPE": "application/x-www-form-urlencoded; charset=UTF-8", "HTTP_HOST": "192.168.1.138:8773", "GATEWAY_INTERFACE": "CGI/1.1", "HTTP_ACCEPT_ENCODING": "identity"}
2012-01-30 09:53:59,324 ERROR nova.api [req-ad27ede4-b92b-4ca4-8c6e-5349fee5cd0f 5e653de2fb5d4b508012406df77ec445 03c6ffa2bee74bca9bec99e82d872673] UnknownError: An unknown error has occurred. Please try your request again.
2012-01-30 09:53:59,325 INFO nova.api [req-ad27ede4-b92b-4ca4-8c6e-5349fee5cd0f 5e653de2fb5d4b508012406df77ec445 03c6ffa2bee74bca9bec99e82d872673] 3.448191s 192.168.1.138 POST /services/Cloud/ CloudController:CreateImage 400 [Boto/2.0 (linux2)] application/x-www-form-urlencoded text/xml
------------------------------------------------------------------------

I'd be happy to help debugging the issue.