Synology: Add support for UC-Series model
Use regular expression of firmware version to check if the model supports Cinder driver or not. Closes-Bug: #1817259 Change-Id: I166be597d62d8e5fb221da73fd79487379917850
This commit is contained in:
parent
6785bf614b
commit
66bfd46e4b
@ -1104,7 +1104,7 @@ class SynoCommonTestCase(test.TestCase):
|
||||
|
||||
def test__check_ds_version(self):
|
||||
ver1 = 'DSM 6.1-9999'
|
||||
ver2 = 'DSM 6.0.2-9999'
|
||||
ver2 = 'DSM UC 1.0-9999 Update 2'
|
||||
ver3 = 'DSM 6.0.1-9999 Update 2'
|
||||
ver4 = 'DSM 6.0-9999 Update 2'
|
||||
ver5 = 'DSM 5.2-9999'
|
||||
|
@ -20,6 +20,7 @@ import json
|
||||
import math
|
||||
from os import urandom
|
||||
from random import randint
|
||||
import re
|
||||
|
||||
from cryptography.hazmat.backends import default_backend
|
||||
from cryptography.hazmat.primitives.asymmetric import padding
|
||||
@ -856,17 +857,26 @@ class SynoCommon(object):
|
||||
reason=_('data not found'))
|
||||
firmware_version = out['data']['firmware_ver']
|
||||
|
||||
# e.g. 'DSM 6.1-7610', 'DSM 6.0.1-7370', 'DSM 6.0-7321 update 3'
|
||||
version = firmware_version.split()[1].split('-')[0]
|
||||
versions = version.split('.')
|
||||
major, minor, hotfix = (versions[0],
|
||||
versions[1],
|
||||
versions[2] if len(versions) is 3 else '0')
|
||||
# e.g. 'DSM 6.1-7610', 'DSM 6.0.1-7321 update 3', 'DSM UC 1.0-6789'
|
||||
pattern = re.compile(r"^(.*) (\d+)\.(\d+)(?:\.(\d+))?-(\d+)"
|
||||
r"(?: [uU]pdate (\d+))?$")
|
||||
matches = pattern.match(firmware_version)
|
||||
|
||||
major, minor, hotfix = (int(major), int(minor), int(hotfix))
|
||||
if not matches:
|
||||
m = (_('DS version %s is not supported') %
|
||||
firmware_version)
|
||||
raise exception.VolumeDriverException(message=m)
|
||||
|
||||
if (6 > major) or (major is 6 and minor is 0 and hotfix < 2):
|
||||
m = (_('DS version %s is not supperted') %
|
||||
os_name = matches.group(1)
|
||||
major = int(matches.group(2))
|
||||
minor = int(matches.group(3))
|
||||
hotfix = int(matches.group(4)) if matches.group(4) else 0
|
||||
|
||||
if os_name == 'DSM UC':
|
||||
return
|
||||
elif (os_name == 'DSM' and
|
||||
((6 > major) or (major is 6 and minor is 0 and hotfix < 2))):
|
||||
m = (_('DS version %s is not supported') %
|
||||
firmware_version)
|
||||
raise exception.VolumeDriverException(message=m)
|
||||
|
||||
|
@ -31,10 +31,11 @@ class SynoISCSIDriver(driver.ISCSIDriver):
|
||||
|
||||
Version history:
|
||||
1.0.0 - Initial driver. Provide Cinder minimum features
|
||||
1.0.1 - Add support for UC series model
|
||||
"""
|
||||
# ThirdPartySystems wiki page
|
||||
CI_WIKI_NAME = 'Synology_DSM_CI'
|
||||
VERSION = '1.0.0'
|
||||
VERSION = '1.0.1'
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(SynoISCSIDriver, self).__init__(*args, **kwargs)
|
||||
|
@ -0,0 +1,4 @@
|
||||
---
|
||||
features:
|
||||
- |
|
||||
Added support for UC-Series model to Synology Cinder driver.
|
Loading…
Reference in New Issue
Block a user