]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Merge tag '2015.1_b1' into debian/kilo
authorThomas Goirand <thomas@goirand.fr>
Tue, 23 Dec 2014 07:22:54 +0000 (15:22 +0800)
committerThomas Goirand <thomas@goirand.fr>
Tue, 23 Dec 2014 07:22:54 +0000 (15:22 +0800)
Cinder kilo-1 milestone (2015.1.0b1)

Conflicts:
cinder/openstack/common/processutils.py
cinder/tests/volume/drivers/netapp/test_iscsi.py
cinder/volume/drivers/netapp/iscsi.py
cinder/volume/drivers/netapp/nfs.py
etc/cinder/cinder.conf.sample

1  2 
cinder/brick/iscsi/iscsi.py
cinder/locale/cinder.pot
cinder/tests/brick/test_brick_connector.py

index 9ff4e42c1b285f604eee09eca28c2d2e2f182bd9,c5afa617c44fd0f2b8dff7d1cd9e69b5013bd3d8..af0e3efd43bdea2f20a499faf2f2d3b3acc0e95c
@@@ -44,15 -47,20 +47,24 @@@ class TargetAdmin(executor.Executor)
  
      def __init__(self, cmd, root_helper, execute):
          super(TargetAdmin, self).__init__(root_helper, execute=execute)
+         # NOTE(jdg):  cmd is a prefix to the target helper utility we
+         # use.  This can be tgtadm, cinder-rtstool etc
          self._cmd = cmd
  
-     def _run(self, *args, **kwargs):
-         self._execute(self._cmd, *args, run_as_root=True, **kwargs)
+     def _run(self, cmd, *args, **kwargs):
+         return self._execute(cmd,
+                              *args,
+                              **kwargs)
+     def _get_target_chap_auth(self, volume_id):
+         """Get the current chap auth username and password."""
+         return None
  
 +    def _get_target_chap_auth(self, volume_id):
 +        """Get the current chap auth username and password."""
 +        return None
 +
      def create_iscsi_target(self, name, tid, lun, path,
                              chap_auth=None, **kwargs):
          """Create an iSCSI target and logical unit."""
index 87bc6c48c5afd107c64568357712390f7b456318,8175fbcccc39709bced52d149f137e7dcab7e5a8..b0f6f20f7ff86b63e0826abbf9f28e7bf7107fec
@@@ -10219,44 -7309,26 +7309,34 @@@ msgstr "
  msgid "Flexvisor failed to delete snapshot (failed to get event) %(id)s."
  msgstr ""
  
- #: cinder/volume/drivers/prophetstor/dplcommon.py:960
- #, python-format
- msgid "Flexvisor snapshot %(id)s not existed."
- msgstr ""
- #: cinder/volume/drivers/prophetstor/dplcommon.py:969
+ #: cinder/volume/drivers/prophetstor/dplcommon.py:1418
+ #: cinder/volume/drivers/prophetstor/dplcommon.py:1430
  #, python-format
- msgid "Flexvisor succeed to delete snapshot %(id)s."
+ msgid "Flexvisor failed to get pool info %(id)s: %(status)s."
  msgstr ""
  
- #: cinder/volume/drivers/prophetstor/dplcommon.py:1021
+ #: cinder/volume/drivers/prophetstor/dplcommon.py:1425
  #, python-format
- msgid "Failed to get server info due to %(state)s."
- msgstr ""
- #: cinder/volume/drivers/prophetstor/dplcommon.py:1029
- msgid "Activate Flexvisor cinder volume driver."
+ msgid "Flexvisor failed to get pool info (failed to get event)%s."
  msgstr ""
  
- #: cinder/volume/drivers/prophetstor/dplcommon.py:1044
- #: cinder/volume/drivers/prophetstor/dplcommon.py:1057
- #, python-format
- msgid "Flexvisor failed to get pool info %(id)s: %(status)s."
+ #: cinder/volume/drivers/prophetstor/dplcommon.py:1434
+ msgid "Flexvisor succeed to get pool info."
  msgstr ""
  
- #: cinder/volume/drivers/prophetstor/dplcommon.py:1052
+ #: cinder/volume/drivers/san/san.py:151
  #, python-format
- msgid "Flexvisor failed to get pool info (failed to get event)%s."
+ msgid "Error running SSH command: %s"
  msgstr ""
  
 +#: cinder/volume/drivers/san/san.py:151
 +#: cinder/zonemanager/drivers/brocade/brcd_fc_zone_client_cli.py:417
 +#: cinder/zonemanager/drivers/cisco/cisco_fc_san_lookup_service.py:271
 +#: cinder/zonemanager/drivers/cisco/cisco_fc_zone_client_cli.py:397
 +#, python-format
 +msgid "Error running SSH command: %s"
 +msgstr ""
 +
  #: cinder/volume/drivers/san/san.py:171
  msgid "Specify san_password or san_private_key"
  msgstr ""
@@@ -11238,20 -8109,12 +8131,14 @@@ msgstr "
  msgid "Version string '%s' is not parseable"
  msgstr ""
  
- #: cinder/volume/drivers/vmware/vmdk.py:1889
- #, python-format
- msgid "Not able to configure PBM for VC server: %s"
- msgstr ""
- #: cinder/volume/drivers/vmware/vmdk.py:1956
+ #: cinder/volume/drivers/vmware/vmdk.py:1953
  #, python-format
 -msgid "Relocating volume: %(backing)s to %(ds)s and %(rp)s."
 +msgid ""
 +"There are no datastores matching volume requirements; can't relocate "
 +"volume: %s."
  msgstr ""
  
- #: cinder/volume/drivers/vmware/vmdk.py:2008
- #: cinder/volume/drivers/vmware/volumeops.py:1069
+ #: cinder/volume/drivers/vmware/vmdk.py:2001
  #, python-format
  msgid "Successfully created clone: %s."
  msgstr ""
index db87184a78d0d94e01d2f97626d2ec382bc84ea1,357c511915c09cec5d57cd699f260e47a3ef23bc..62a3efafce2eb21793894f6a4a70d4a78767dbf6
@@@ -642,3 -644,201 +644,201 @@@ class LocalConnectorTestCase(test.TestC
          cprops = {}
          self.assertRaises(ValueError,
                            self.connector.connect_volume, cprops)
 -        LOG.debug("expected = %s." % expected_commands)
+ class HuaweiStorHyperConnectorTestCase(ConnectorTestCase):
+     """Test cases for StorHyper initiator class."""
+     attached = False
+     def setUp(self):
+         super(HuaweiStorHyperConnectorTestCase, self).setUp()
+         self.fake_sdscli_file = tempfile.mktemp()
+         self.addCleanup(os.remove, self.fake_sdscli_file)
+         newefile = open(self.fake_sdscli_file, 'w')
+         newefile.write('test')
+         newefile.close()
+         self.connector = connector.HuaweiStorHyperConnector(
+             None, execute=self.fake_execute)
+         self.connector.cli_path = self.fake_sdscli_file
+         self.connector.iscliexist = True
+         self.connector_fail = connector.HuaweiStorHyperConnector(
+             None, execute=self.fake_execute_fail)
+         self.connector_fail.cli_path = self.fake_sdscli_file
+         self.connector_fail.iscliexist = True
+         self.connector_nocli = connector.HuaweiStorHyperConnector(
+             None, execute=self.fake_execute_fail)
+         self.connector_nocli.cli_path = self.fake_sdscli_file
+         self.connector_nocli.iscliexist = False
+         self.connection_properties = {
+             'access_mode': 'rw',
+             'qos_specs': None,
+             'volume_id': 'volume-b2911673-863c-4380-a5f2-e1729eecfe3f'
+         }
+         self.device_info = {'type': 'block',
+                             'path': '/dev/vdxxx'}
+         HuaweiStorHyperConnectorTestCase.attached = False
+     def fake_execute(self, *cmd, **kwargs):
+         method = cmd[2]
+         self.cmds.append(string.join(cmd))
+         if 'attach' == method:
+             HuaweiStorHyperConnectorTestCase.attached = True
+             return 'ret_code=0', None
+         if 'querydev' == method:
+             if HuaweiStorHyperConnectorTestCase.attached:
+                 return 'ret_code=0\ndev_addr=/dev/vdxxx', None
+             else:
+                 return 'ret_code=1\ndev_addr=/dev/vdxxx', None
+         if 'detach' == method:
+             HuaweiStorHyperConnectorTestCase.attached = False
+             return 'ret_code=0', None
+     def fake_execute_fail(self, *cmd, **kwargs):
+         method = cmd[2]
+         self.cmds.append(string.join(cmd))
+         if 'attach' == method:
+             HuaweiStorHyperConnectorTestCase.attached = False
+             return 'ret_code=330151401', None
+         if 'querydev' == method:
+             if HuaweiStorHyperConnectorTestCase.attached:
+                 return 'ret_code=0\ndev_addr=/dev/vdxxx', None
+             else:
+                 return 'ret_code=1\ndev_addr=/dev/vdxxx', None
+         if 'detach' == method:
+             HuaweiStorHyperConnectorTestCase.attached = True
+             return 'ret_code=330155007', None
+     def test_connect_volume(self):
+         """Test the basic connect volume case."""
+         retval = self.connector.connect_volume(self.connection_properties)
+         self.assertEqual(self.device_info, retval)
+         expected_commands = [self.fake_sdscli_file + ' -c attach'
+                              ' -v volume-b2911673-863c-4380-a5f2-e1729eecfe3f',
+                              self.fake_sdscli_file + ' -c querydev'
+                              ' -v volume-b2911673-863c-4380-a5f2-e1729eecfe3f']
+         LOG.debug("self.cmds = %s." % self.cmds)
+         LOG.debug("expected = %s." % expected_commands)
+         self.assertEqual(expected_commands, self.cmds)
+     def test_disconnect_volume(self):
+         """Test the basic disconnect volume case."""
+         self.connector.connect_volume(self.connection_properties)
+         self.assertEqual(True, HuaweiStorHyperConnectorTestCase.attached)
+         self.connector.disconnect_volume(self.connection_properties,
+                                          self.device_info)
+         self.assertEqual(False, HuaweiStorHyperConnectorTestCase.attached)
+         expected_commands = [self.fake_sdscli_file + ' -c attach'
+                              ' -v volume-b2911673-863c-4380-a5f2-e1729eecfe3f',
+                              self.fake_sdscli_file + ' -c querydev'
+                              ' -v volume-b2911673-863c-4380-a5f2-e1729eecfe3f',
+                              self.fake_sdscli_file + ' -c detach'
+                              ' -v volume-b2911673-863c-4380-a5f2-e1729eecfe3f']
+         LOG.debug("self.cmds = %s." % self.cmds)
+         LOG.debug("expected = %s." % expected_commands)
+         self.assertEqual(expected_commands, self.cmds)
+     def test_is_volume_connected(self):
+         """Test if volume connected to host case."""
+         self.connector.connect_volume(self.connection_properties)
+         self.assertEqual(True, HuaweiStorHyperConnectorTestCase.attached)
+         is_connected = self.connector.is_volume_connected(
+             'volume-b2911673-863c-4380-a5f2-e1729eecfe3f')
+         self.assertEqual(HuaweiStorHyperConnectorTestCase.attached,
+                          is_connected)
+         self.connector.disconnect_volume(self.connection_properties,
+                                          self.device_info)
+         self.assertEqual(False, HuaweiStorHyperConnectorTestCase.attached)
+         is_connected = self.connector.is_volume_connected(
+             'volume-b2911673-863c-4380-a5f2-e1729eecfe3f')
+         self.assertEqual(HuaweiStorHyperConnectorTestCase.attached,
+                          is_connected)
+         expected_commands = [self.fake_sdscli_file + ' -c attach'
+                              ' -v volume-b2911673-863c-4380-a5f2-e1729eecfe3f',
+                              self.fake_sdscli_file + ' -c querydev'
+                              ' -v volume-b2911673-863c-4380-a5f2-e1729eecfe3f',
+                              self.fake_sdscli_file + ' -c querydev'
+                              ' -v volume-b2911673-863c-4380-a5f2-e1729eecfe3f',
+                              self.fake_sdscli_file + ' -c detach'
+                              ' -v volume-b2911673-863c-4380-a5f2-e1729eecfe3f',
+                              self.fake_sdscli_file + ' -c querydev'
+                              ' -v volume-b2911673-863c-4380-a5f2-e1729eecfe3f']
+         LOG.debug("self.cmds = %s." % self.cmds)
+         LOG.debug("expected = %s." % expected_commands)
+         self.assertEqual(expected_commands, self.cmds)
+     def test__analyze_output(self):
+         cliout = 'ret_code=0\ndev_addr=/dev/vdxxx\nret_desc="success"'
+         analyze_result = {'dev_addr': '/dev/vdxxx',
+                           'ret_desc': '"success"',
+                           'ret_code': '0'}
+         result = self.connector._analyze_output(cliout)
+         self.assertEqual(analyze_result, result)
+     def test_connect_volume_fail(self):
+         """Test the fail connect volume case."""
+         self.assertRaises(exception.BrickException,
+                           self.connector_fail.connect_volume,
+                           self.connection_properties)
+         expected_commands = [self.fake_sdscli_file + ' -c attach'
+                              ' -v volume-b2911673-863c-4380-a5f2-e1729eecfe3f']
+         LOG.debug("self.cmds = %s." % self.cmds)
+         LOG.debug("expected = %s." % expected_commands)
+         self.assertEqual(expected_commands, self.cmds)
+     def test_disconnect_volume_fail(self):
+         """Test the fail disconnect volume case."""
+         self.connector.connect_volume(self.connection_properties)
+         self.assertEqual(True, HuaweiStorHyperConnectorTestCase.attached)
+         self.assertRaises(exception.BrickException,
+                           self.connector_fail.disconnect_volume,
+                           self.connection_properties,
+                           self.device_info)
+         expected_commands = [self.fake_sdscli_file + ' -c attach'
+                              ' -v volume-b2911673-863c-4380-a5f2-e1729eecfe3f',
+                              self.fake_sdscli_file + ' -c querydev'
+                              ' -v volume-b2911673-863c-4380-a5f2-e1729eecfe3f',
+                              self.fake_sdscli_file + ' -c detach'
+                              ' -v volume-b2911673-863c-4380-a5f2-e1729eecfe3f']
+         LOG.debug("self.cmds = %s." % self.cmds)
+         LOG.debug("expected = %s." % expected_commands)
+         self.assertEqual(expected_commands, self.cmds)
+     def test_connect_volume_nocli(self):
+         """Test the fail connect volume case."""
+         self.assertRaises(exception.BrickException,
+                           self.connector_nocli.connect_volume,
+                           self.connection_properties)
+     def test_disconnect_volume_nocli(self):
+         """Test the fail disconnect volume case."""
+         self.connector.connect_volume(self.connection_properties)
+         self.assertEqual(True, HuaweiStorHyperConnectorTestCase.attached)
+         self.assertRaises(exception.BrickException,
+                           self.connector_nocli.disconnect_volume,
+                           self.connection_properties,
+                           self.device_info)
+         expected_commands = [self.fake_sdscli_file + ' -c attach'
+                              ' -v volume-b2911673-863c-4380-a5f2-e1729eecfe3f',
+                              self.fake_sdscli_file + ' -c querydev'
+                              ' -v volume-b2911673-863c-4380-a5f2-e1729eecfe3f']
+         LOG.debug("self.cmds = %s." % self.cmds)
++        LOG.debug("expected = %s." % expected_commands)