From a8ccc1ac1258c950b82a38e4670a2a6b4a9486f0 Mon Sep 17 00:00:00 2001 From: Chris Yang Date: Thu, 19 Jul 2018 16:44:22 +0800 Subject: [PATCH] QNAP: Add support for QES 2.1.0 This patch do the following change to the QNAP Manila driver: 1. Add support for QNAP QES firmware 2.1.0. Change-Id: I81320b6af988d19526241fd0856b427fcf1f96d7 Implements: blueprint qnap-support-qes-210 --- manila/share/drivers/qnap/qnap.py | 7 +- manila/tests/share/drivers/qnap/fakes.py | 126 ++++++++++++++++++ manila/tests/share/drivers/qnap/test_qnap.py | 18 +++ ...qnap-support-qes-210-8775e6c210f3ca9f.yaml | 4 + 4 files changed, 152 insertions(+), 3 deletions(-) create mode 100644 releasenotes/notes/qnap-support-qes-210-8775e6c210f3ca9f.yaml diff --git a/manila/share/drivers/qnap/qnap.py b/manila/share/drivers/qnap/qnap.py index 80a4d9a400..567c69194e 100644 --- a/manila/share/drivers/qnap/qnap.py +++ b/manila/share/drivers/qnap/qnap.py @@ -73,9 +73,10 @@ class QnapShareDriver(driver.ShareDriver): 1.0.4 - Add support for QES fw 2.0.0. 1.0.5 - Fix bug #1773761, when user tries to manage share, the size of managed share should not be changed. + 1.0.6 - Add support for QES fw 2.1.0. """ - DRIVER_VERSION = '1.0.5' + DRIVER_VERSION = '1.0.6' def __init__(self, *args, **kwargs): """Initialize QnapShareDriver.""" @@ -164,14 +165,14 @@ class QnapShareDriver(driver.ShareDriver): username=self.configuration.qnap_nas_login, password=self.configuration.qnap_nas_password, management_url=self.configuration.qnap_management_url) - elif "1.1.2" <= fw_version <= "2.0.9999": + elif "1.1.2" <= fw_version <= "2.1.9999": LOG.debug('Create ES API Executor') return api.QnapAPIExecutor( username=self.configuration.qnap_nas_login, password=self.configuration.qnap_nas_password, management_url=self.configuration.qnap_management_url) elif model_type in es_model_types: - if "1.1.2" <= fw_version <= "2.0.9999": + if "1.1.2" <= fw_version <= "2.1.9999": LOG.debug('Create ES API Executor') return api.QnapAPIExecutor( username=self.configuration.qnap_nas_login, diff --git a/manila/tests/share/drivers/qnap/fakes.py b/manila/tests/share/drivers/qnap/fakes.py index f9d4a2f2fa..98d08d5764 100644 --- a/manila/tests/share/drivers/qnap/fakes.py +++ b/manila/tests/share/drivers/qnap/fakes.py @@ -41,6 +41,39 @@ FAKE_RES_DETAIL_DATA_GETBASIC_INFO_ES_1_1_3 = """ """ +FAKE_RES_DETAIL_DATA_GETBASIC_INFO_ES_2_0_0 = """ + + + + + + + + + """ + +FAKE_RES_DETAIL_DATA_GETBASIC_INFO_ES_2_1_0 = """ + + + + + + + + + """ + +FAKE_RES_DETAIL_DATA_GETBASIC_INFO_ES_2_2_0 = """ + + + + + + + + + """ + FAKE_RES_DETAIL_DATA_GETBASIC_INFO_TS_4_0_0 = """ @@ -107,6 +140,39 @@ FAKE_RES_DETAIL_DATA_GETBASIC_INFO_TES_ES_1_1_3 = """ """ +FAKE_RES_DETAIL_DATA_GETBASIC_INFO_TES_ES_2_0_0 = """ + + + + + + + + + """ + +FAKE_RES_DETAIL_DATA_GETBASIC_INFO_TES_ES_2_1_0 = """ + + + + + + + + + """ + +FAKE_RES_DETAIL_DATA_GETBASIC_INFO_TES_ES_2_2_0 = """ + + + + + + + + + """ + FAKE_RES_DETAIL_DATA_GETBASIC_INFO_ERROR = """ @@ -439,6 +505,36 @@ class FakeGetBasicInfoResponseEs_1_1_3(object): return FAKE_RES_DETAIL_DATA_GETBASIC_INFO_ES_1_1_3 +class FakeGetBasicInfoResponseEs_2_0_0(object): + """Fake GetBasicInfo response from ES nas.""" + + status = 'fackStatus' + + def read(self): + """Mock response.read.""" + return FAKE_RES_DETAIL_DATA_GETBASIC_INFO_ES_2_0_0 + + +class FakeGetBasicInfoResponseEs_2_1_0(object): + """Fake GetBasicInfo response from ES nas.""" + + status = 'fackStatus' + + def read(self): + """Mock response.read.""" + return FAKE_RES_DETAIL_DATA_GETBASIC_INFO_ES_2_1_0 + + +class FakeGetBasicInfoResponseEs_2_2_0(object): + """Fake GetBasicInfo response from ES nas.""" + + status = 'fackStatus' + + def read(self): + """Mock response.read.""" + return FAKE_RES_DETAIL_DATA_GETBASIC_INFO_ES_2_2_0 + + class FakeGetBasicInfoResponseTs_4_0_0(object): """Fake GetBasicInfoTS response from TS nas.""" @@ -499,6 +595,36 @@ class FakeGetBasicInfoResponseTesEs_1_1_3(object): return FAKE_RES_DETAIL_DATA_GETBASIC_INFO_TES_ES_1_1_3 +class FakeGetBasicInfoResponseTesEs_2_0_0(object): + """Fake GetBasicInfoTS response from TS nas.""" + + status = 'fackStatus' + + def read(self): + """Mock response.read.""" + return FAKE_RES_DETAIL_DATA_GETBASIC_INFO_TES_ES_2_0_0 + + +class FakeGetBasicInfoResponseTesEs_2_1_0(object): + """Fake GetBasicInfoTS response from TS nas.""" + + status = 'fackStatus' + + def read(self): + """Mock response.read.""" + return FAKE_RES_DETAIL_DATA_GETBASIC_INFO_TES_ES_2_1_0 + + +class FakeGetBasicInfoResponseTesEs_2_2_0(object): + """Fake GetBasicInfoTS response from TS nas.""" + + status = 'fackStatus' + + def read(self): + """Mock response.read.""" + return FAKE_RES_DETAIL_DATA_GETBASIC_INFO_TES_ES_2_2_0 + + class FakeGetBasicInfoResponseError(object): """Fake GetBasicInfoTS response from TS nas.""" diff --git a/manila/tests/share/drivers/qnap/test_qnap.py b/manila/tests/share/drivers/qnap/test_qnap.py index 8e5974a718..878c953feb 100644 --- a/manila/tests/share/drivers/qnap/test_qnap.py +++ b/manila/tests/share/drivers/qnap/test_qnap.py @@ -153,9 +153,21 @@ class QnapShareDriverLoginTestCase(QnapShareDriverBaseTestCase): }, { 'fake_basic_info': fakes.FakeGetBasicInfoResponseTesEs_1_1_3(), 'expect_result': api.QnapAPIExecutor + }, { + 'fake_basic_info': fakes.FakeGetBasicInfoResponseTesEs_2_0_0(), + 'expect_result': api.QnapAPIExecutor + }, { + 'fake_basic_info': fakes.FakeGetBasicInfoResponseTesEs_2_1_0(), + 'expect_result': api.QnapAPIExecutor }, { 'fake_basic_info': fakes.FakeGetBasicInfoResponseEs_1_1_3(), 'expect_result': api.QnapAPIExecutor + }, { + 'fake_basic_info': fakes.FakeGetBasicInfoResponseEs_2_0_0(), + 'expect_result': api.QnapAPIExecutor + }, { + 'fake_basic_info': fakes.FakeGetBasicInfoResponseEs_2_1_0(), + 'expect_result': api.QnapAPIExecutor }) @ddt.unpack def test_create_api_executor(self, fake_basic_info, expect_result): @@ -179,9 +191,15 @@ class QnapShareDriverLoginTestCase(QnapShareDriverBaseTestCase): }, { 'fake_basic_info': fakes.FakeGetBasicInfoResponseTesEs_1_1_1(), 'expect_result': exception.ShareBackendException + }, { + 'fake_basic_info': fakes.FakeGetBasicInfoResponseTesEs_2_2_0(), + 'expect_result': exception.ShareBackendException }, { 'fake_basic_info': fakes.FakeGetBasicInfoResponseEs_1_1_1(), 'expect_result': exception.ShareBackendException + }, { + 'fake_basic_info': fakes.FakeGetBasicInfoResponseEs_2_2_0(), + 'expect_result': exception.ShareBackendException }) @ddt.unpack def test_create_api_executor_negative(self, diff --git a/releasenotes/notes/qnap-support-qes-210-8775e6c210f3ca9f.yaml b/releasenotes/notes/qnap-support-qes-210-8775e6c210f3ca9f.yaml new file mode 100644 index 0000000000..34d70b03c1 --- /dev/null +++ b/releasenotes/notes/qnap-support-qes-210-8775e6c210f3ca9f.yaml @@ -0,0 +1,4 @@ +--- +features: + - | + QNAP Manila driver added support for QES fw 2.1.0.