From 49761cd38a08c52e5fc5b90188fdeade5e0906ba Mon Sep 17 00:00:00 2001 From: liucheng Date: Wed, 6 Jan 2016 14:26:19 +0800 Subject: [PATCH] Use constants instead of literals in Huawei Driver We judged filesystem alloctype by literals, now we change these literals to constants. Change-Id: Iaeb64ed83b4c44e3e7d150c615ad03f8b1b4ce90 Closes-Bug: #1529015 --- manila/share/drivers/huawei/constants.py | 2 ++ manila/share/drivers/huawei/v3/connection.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/manila/share/drivers/huawei/constants.py b/manila/share/drivers/huawei/constants.py index 98f64bf0..548df91f 100644 --- a/manila/share/drivers/huawei/constants.py +++ b/manila/share/drivers/huawei/constants.py @@ -31,6 +31,8 @@ ACCESS_CIFS_RO = "0" ERROR_CONNECT_TO_SERVER = -403 ERROR_UNAUTHORIZED_TO_SERVER = -401 +ALLOC_TYPE_THIN_FLAG = "1" + OPTS_CAPABILITIES = { 'dedupe': False, 'compression': False, diff --git a/manila/share/drivers/huawei/v3/connection.py b/manila/share/drivers/huawei/v3/connection.py index c4084b8e..85bc095e 100644 --- a/manila/share/drivers/huawei/v3/connection.py +++ b/manila/share/drivers/huawei/v3/connection.py @@ -171,7 +171,7 @@ class V3StorageConnection(driver.HuaweiBase): LOG.error(err_msg) raise exception.InvalidShare(reason=err_msg) - if fs_info['ALLOCTYPE'] != '1': + if fs_info['ALLOCTYPE'] != constants.ALLOC_TYPE_THIN_FLAG: err_msg = (_("Share (%s) can not be shrunk. only 'Thin' shares " "support shrink.") % share_name)