From 88d6be0c66694021847574d2e255d69bcd0bda73 Mon Sep 17 00:00:00 2001 From: Nirmal Ranganathan Date: Fri, 2 Nov 2012 11:49:17 -0500 Subject: [PATCH] Minor optimization in create_volume in HpSanISCSIDriver Removing extra call to getClusterInfo in HpSANISCSIDriver on every create_volume call. The cluster info is now being lazily stored in a local variable. Fixes bug 1074201 Change-Id: Iadf8383dbf87a8e82c649c312c67978c7dd3df71 --- cinder/volume/san/hp_lefthand.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/cinder/volume/san/hp_lefthand.py b/cinder/volume/san/hp_lefthand.py index 0f27150b1..e2ec46cce 100644 --- a/cinder/volume/san/hp_lefthand.py +++ b/cinder/volume/san/hp_lefthand.py @@ -54,6 +54,10 @@ class HpSanISCSIDriver(SanISCSIDriver): compute layer. """ + def __init__(self, *args, **kwargs): + super(HpSanISCSIDriver, self).__init__(*args, **kwargs) + self.cluster_vip = None + def _cliq_run(self, verb, cliq_args): """Runs a CLIQ command over SSH, without doing any result parsing""" cliq_arg_strings = [] @@ -173,7 +177,6 @@ class HpSanISCSIDriver(SanISCSIDriver): """Creates a volume.""" cliq_args = {} cliq_args['clusterName'] = FLAGS.san_clustername - #TODO(justinsb): Should we default to inheriting thinProvision? cliq_args['thinProvision'] = '1' if FLAGS.san_thin_provision else '0' cliq_args['volumeName'] = volume['name'] if int(volume['size']) == 0: @@ -190,8 +193,9 @@ class HpSanISCSIDriver(SanISCSIDriver): #TODO(justinsb): Is this always 1? Does it matter? cluster_interface = '1' - cluster_vip = self._cliq_get_cluster_vip(cluster_name) - iscsi_portal = cluster_vip + ":3260," + cluster_interface + if not self.cluster_vip: + self.cluster_vip = self._cliq_get_cluster_vip(cluster_name) + iscsi_portal = self.cluster_vip + ":3260," + cluster_interface model_update = {} @@ -220,7 +224,6 @@ class HpSanISCSIDriver(SanISCSIDriver): self._cliq_run_xml("deleteVolume", cliq_args) def local_path(self, volume): - # TODO(justinsb): Is this needed here? msg = _("local_path not supported") raise exception.VolumeBackendAPIException(data=msg) -- 2.45.2