summaryrefslogtreecommitdiffstats
path: root/nova/volume
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2012-05-02 23:00:29 +0000
committerGerrit Code Review <review@openstack.org>2012-05-02 23:00:29 +0000
commit4db018636dcc2c083f5dc92a7dd993766337c86c (patch)
treeae3e8197ce150af71c69be6500cd94e0860f73e4 /nova/volume
parentfba02baf8dbf6d3d9a7ed58a498670157004bce5 (diff)
parentd14ac4bf38f23e429572f210f7b0560493968b15 (diff)
Merge "Adding 'host' info to volume-compute connection information."
Diffstat (limited to 'nova/volume')
-rw-r--r--nova/volume/san.py89
1 files changed, 39 insertions, 50 deletions
diff --git a/nova/volume/san.py b/nova/volume/san.py
index aecb9a0b5..9d83864d0 100644
--- a/nova/volume/san.py
+++ b/nova/volume/san.py
@@ -582,6 +582,14 @@ class HpSanISCSIDriver(SanISCSIDriver):
return model_update
+ def create_volume_from_snapshot(self, volume, snapshot):
+ """Creates a volume from a snapshot."""
+ raise NotImplementedError()
+
+ def create_snapshot(self, snapshot):
+ """Creates a snapshot."""
+ raise NotImplementedError()
+
def delete_volume(self, volume):
"""Deletes a volume."""
cliq_args = {}
@@ -594,64 +602,45 @@ class HpSanISCSIDriver(SanISCSIDriver):
# TODO(justinsb): Is this needed here?
raise exception.Error(_("local_path not supported"))
- def ensure_export(self, context, volume):
- """Synchronously recreates an export for a logical volume."""
- return self._do_export(context, volume, force_create=False)
-
- def create_export(self, context, volume):
- return self._do_export(context, volume, force_create=True)
+ def initialize_connection(self, volume, connector):
+ """Assigns the volume to a server.
- def _do_export(self, context, volume, force_create):
- """Supports ensure_export and create_export"""
- volume_info = self._cliq_get_volume_info(volume['name'])
+ Assign any created volume to a compute node/host so that it can be
+ used from that host. HP VSA requires a volume to be assigned
+ to a server.
- is_shared = 'permission.authGroup' in volume_info
+ This driver returns a driver_volume_type of 'iscsi'.
+ The format of the driver data is defined in _get_iscsi_properties.
+ Example return value::
- model_update = {}
+ {
+ 'driver_volume_type': 'iscsi'
+ 'data': {
+ 'target_discovered': True,
+ 'target_iqn': 'iqn.2010-10.org.openstack:volume-00000001',
+ 'target_portal': '127.0.0.0.1:3260',
+ 'volume_id': 1,
+ }
+ }
- should_export = False
-
- if force_create or not is_shared:
- should_export = True
- # Check that we have a project_id
- project_id = volume['project_id']
- if not project_id:
- project_id = context.project_id
-
- if project_id:
- #TODO(justinsb): Use a real per-project password here
- chap_username = 'proj_' + project_id
- # HP/Lefthand requires that the password be >= 12 characters
- chap_password = 'project_secret_' + project_id
- else:
- msg = (_("Could not determine project for volume %s, "
- "can't export") %
- (volume['name']))
- if force_create:
- raise exception.Error(msg)
- else:
- LOG.warn(msg)
- should_export = False
-
- if should_export:
- cliq_args = {}
- cliq_args['volumeName'] = volume['name']
- cliq_args['chapName'] = chap_username
- cliq_args['targetSecret'] = chap_password
-
- self._cliq_run_xml("assignVolumeChap", cliq_args)
-
- model_update['provider_auth'] = ("CHAP %s %s" %
- (chap_username, chap_password))
+ """
+ cliq_args = {}
+ cliq_args['volumeName'] = volume['name']
+ cliq_args['serverName'] = connector['host']
+ self._cliq_run_xml("assignVolumeToServer", cliq_args)
- return model_update
+ iscsi_properties = self._get_iscsi_properties(volume)
+ return {
+ 'driver_volume_type': 'iscsi',
+ 'data': iscsi_properties
+ }
- def remove_export(self, context, volume):
- """Removes an export for a logical volume."""
+ def terminate_connection(self, volume, connector):
+ """Unassign the volume from the host."""
cliq_args = {}
cliq_args['volumeName'] = volume['name']
-
- self._cliq_run_xml("unassignVolume", cliq_args)
+ cliq_args['serverName'] = connector['host']
+ self._cliq_run_xml("unassignVolumeToServer", cliq_args)
class SolidFireSanISCSIDriver(SanISCSIDriver):