diff options
| author | Vishvananda Ishaya <vishvananda@yahoo.com> | 2010-11-03 08:29:03 +0000 |
|---|---|---|
| committer | Tarmac <> | 2010-11-03 08:29:03 +0000 |
| commit | 2baf2127110929fb834042238058802dae8d725e (patch) | |
| tree | 56acaf6d9e9c05db6a044b3240ade3565eaa4c69 /nova/api | |
| parent | 56c7e7763fc07f26be40bb8c0c702fc9afe8b1e3 (diff) | |
| parent | fad337b648ea887bb713aab73335aa4602746b62 (diff) | |
ISCSI Volume support
* Rewrite of Volume code to make VolumeManager more generic
* AoE vs. ISCSI moved to driver layer
* Added db support for target ids
* Added code to re-export volumes on restart of VolumeManager
* Includes a script to create /dev/iscsi volumes on remote hosts
* Change libvirt_conn to use the python connection to attach disks instead of shell
* Changed cloud and compute manager to deal with attaching, detaching, and terminating in
a saner manner.
Diffstat (limited to 'nova/api')
| -rw-r--r-- | nova/api/ec2/__init__.py | 1 | ||||
| -rw-r--r-- | nova/api/ec2/cloud.py | 18 |
2 files changed, 15 insertions, 4 deletions
diff --git a/nova/api/ec2/__init__.py b/nova/api/ec2/__init__.py index 0df4d3710..c53ce6f5e 100644 --- a/nova/api/ec2/__init__.py +++ b/nova/api/ec2/__init__.py @@ -238,6 +238,7 @@ class Executor(wsgi.Application): return self._error(req, type(ex).__name__, str(ex)) def _error(self, req, code, message): + logging.error("%s: %s", code, message) resp = webob.Response() resp.status = 400 resp.headers['Content-Type'] = 'text/xml' diff --git a/nova/api/ec2/cloud.py b/nova/api/ec2/cloud.py index f2a6dc3b0..fbe4caa48 100644 --- a/nova/api/ec2/cloud.py +++ b/nova/api/ec2/cloud.py @@ -465,24 +465,31 @@ class CloudController(object): return {'volumeSet': volumes} def _format_volume(self, context, volume): + instance_ec2_id = None + instance_data = None + if volume.get('instance', None): + internal_id = volume['instance']['internal_id'] + instance_ec2_id = internal_id_to_ec2_id(internal_id) + instance_data = '%s[%s]' % (instance_ec2_id, + volume['instance']['host']) v = {} v['volumeId'] = volume['ec2_id'] v['status'] = volume['status'] v['size'] = volume['size'] v['availabilityZone'] = volume['availability_zone'] v['createTime'] = volume['created_at'] - if context.user.is_admin(): + if context.is_admin: v['status'] = '%s (%s, %s, %s, %s)' % ( volume['status'], volume['user_id'], volume['host'], - volume['instance_id'], + instance_data, volume['mountpoint']) if volume['attach_status'] == 'attached': v['attachmentSet'] = [{'attachTime': volume['attach_time'], 'deleteOnTermination': False, 'device': volume['mountpoint'], - 'instanceId': volume['instance_id'], + 'instanceId': instance_ec2_id, 'status': 'attached', 'volume_id': volume['ec2_id']}] else: @@ -517,7 +524,10 @@ class CloudController(object): "args": {"topic": FLAGS.volume_topic, "volume_id": volume_ref['id']}}) - return {'volumeSet': [self._format_volume(context, volume_ref)]} + # TODO(vish): Instance should be None at db layer instead of + # trying to lazy load, but for now we turn it into + # a dict to avoid an error. + return {'volumeSet': [self._format_volume(context, dict(volume_ref))]} def attach_volume(self, context, volume_id, instance_id, device, **kwargs): volume_ref = db.volume_get_by_ec2_id(context, volume_id) |
