Merge "Fix HNAS snapshot creation on deleted shares"
This commit is contained in:
commit
b4fac2b7e7
@ -575,6 +575,7 @@ class HDSHNASDriver(driver.ShareDriver):
|
||||
:param share_id: ID of share for snapshot.
|
||||
:param snapshot_id: ID of new snapshot.
|
||||
"""
|
||||
self._ensure_share(share_id)
|
||||
|
||||
saved_list = self.hnas.get_host_list(share_id)
|
||||
new_list = []
|
||||
|
@ -419,6 +419,9 @@ class HNASSSHBackend(object):
|
||||
if 'DirectoryNotEmpty' in e.stderr:
|
||||
LOG.debug("Share %(path)s has more snapshots.",
|
||||
{'path': path})
|
||||
elif 'NotFound' in e.stderr:
|
||||
LOG.warning(_LW("Attempted to delete path %s but it does "
|
||||
"not exist."), path)
|
||||
else:
|
||||
msg = six.text_type(e)
|
||||
LOG.exception(msg)
|
||||
|
@ -239,6 +239,7 @@ class HDSHNASTestCase(test.TestCase):
|
||||
ssh.HNASSSHBackend.vvol_delete.assert_called_once_with(share['id'])
|
||||
|
||||
def test_create_snapshot(self):
|
||||
self.mock_object(hds_hnas.HDSHNASDriver, "_ensure_share")
|
||||
self.mock_object(hds_hnas.HDSHNASDriver, "_get_hnas_share_id",
|
||||
mock.Mock(return_value=share['id']))
|
||||
self.mock_object(ssh.HNASSSHBackend, "get_host_list", mock.Mock(
|
||||
@ -258,6 +259,7 @@ class HDSHNASTestCase(test.TestCase):
|
||||
snapshot['id'])
|
||||
|
||||
def test_create_snapshot_first_snapshot(self):
|
||||
self.mock_object(hds_hnas.HDSHNASDriver, "_ensure_share")
|
||||
self.mock_object(hds_hnas.HDSHNASDriver, "_get_hnas_share_id",
|
||||
mock.Mock(return_value=share['id']))
|
||||
self.mock_object(ssh.HNASSSHBackend, "get_host_list", mock.Mock(
|
||||
|
@ -944,7 +944,7 @@ class HNASSSHTestCase(test.TestCase):
|
||||
self.assertTrue(self.mock_log.debug.called)
|
||||
|
||||
def test__locked_selectfs_delete_exception(self):
|
||||
msg = 'rmdir: cannot remove \'/path\': NotFound'
|
||||
msg = 'rmdir: cannot remove \'/path\''
|
||||
|
||||
self.mock_object(ssh.HNASSSHBackend, '_execute', mock.Mock(
|
||||
side_effect=[putils.ProcessExecutionError(stderr=msg)]))
|
||||
|
Loading…
Reference in New Issue
Block a user