Skip to content

Commit

Permalink
Release 0.2.13.
Browse files Browse the repository at this point in the history
Merge commit for release 0.2.13.

Enhancements:

* Add list host support for VNX.
* Add system level capacity for VNX.
* Add callback for VNX LUN migration complete.
* Enhance log for Unity HTTP request and VNX naviseccli call.

Bugfix:

* Fix the issue that some times remove Unity Filesystem will fail.
* Add CT for VNX mirror view support.
  • Loading branch information
Cedric Zhuang committed Jul 1, 2016
2 parents 17e2c5a + 4abf38b commit 62c07c5
Show file tree
Hide file tree
Showing 57 changed files with 1,787 additions and 275 deletions.
4 changes: 3 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ StorOps: The Python Library for VNX & Unity
.. image:: https://img.shields.io/pypi/v/storops.svg
:target: https://pypi.python.org/pypi/storops

VERSION: 0.2.12
VERSION: 0.2.13

A minimalist Python library to manage VNX/Unity systems.
This document lies in the source code and go with the release.
Expand Down Expand Up @@ -56,6 +56,7 @@ Feature List
- list/create/delete file system snap
- list/create/delete NFS share
- show system domain information
- list hosts
- supported feature/operations
- list/start/cancel migration sessions
- enable/disable LUN deduplication
Expand Down Expand Up @@ -304,6 +305,7 @@ EMC Contributors
- Cedric Zhuang <cedric.zhuang@emc.com>
- Jay Xu <jay.xu@emc.com>
- Ray Chen <ray.chen@emc.com>
- Tina Tang <tina.tang@emc.com>
Community Contributors
``````````````````````
Expand Down
19 changes: 17 additions & 2 deletions comptest/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@

import logging

from comptest.utils import setup_log
from comptest.utils import setup_log, inter_process_locked
from storops import VNXSystem, UnitySystem, cache
from storops.lib.common import inter_process_locked

__author__ = 'Cedric Zhuang'

Expand All @@ -42,4 +41,20 @@ def t_unity():
return unity


@inter_process_locked('t_vnx.lck')
@cache
def vnx1():
vnx = VNXSystem('192.168.1.52', 'sysadmin', 'sysadmin')
log.debug('initialize vnx system: {}'.format(vnx))
return vnx


@inter_process_locked('t_vnx.lck')
@cache
def vnx2():
vnx = VNXSystem('192.168.1.94', 'sysadmin', 'sysadmin')
log.debug('initialize vnx system: {}'.format(vnx))
return vnx


setup_log()
29 changes: 26 additions & 3 deletions comptest/unity/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,16 @@
class UnityTestResourceManager(ResourceManager):
def __init__(self, name):
super(UnityTestResourceManager, self).__init__(name)
self.unity = None
self.pool = None
self.nas_server = None

def setup(self):
super(UnityTestResourceManager, self).setup()
self.unity = t_unity()
self.pool = self._create_pool()
self.nas_server = self._create_nas_server('{}_nas_server'.format(name))
self.nas_server = self._create_nas_server(
'{}_nas_server'.format(self.name))

def _create_pool(self, name=None):
if name:
Expand Down Expand Up @@ -171,11 +178,16 @@ def _delete_nas_server(self, server):

class UnityGeneralFixture(UnityTestResourceManager):
def __init__(self):
super(UnityGeneralFixture, self).__init__('ug')
self.cifs_share = None
self.nfs_share = None

def setup(self):
clz_name = self.__class__.__name__
log.debug('start {} setup.'.format(clz_name))
# noinspection PyBroadException
try:
super(UnityGeneralFixture, self).__init__('ug')
super(UnityGeneralFixture, self).setup()

self._enable_nfs_service()
self._enable_cifs_service()
Expand All @@ -189,6 +201,17 @@ def __init__(self):

class UnityCifsShareFixture(UnityTestResourceManager):
def __init__(self):
super(UnityCifsShareFixture, self).__init__('ucs')
self.domain_user = None
self.domain_pass = None
self.domain = None
self.domain_controller = None
self.ip_port = None
self.ip = None
self.gateway = None
self.cifs_share = None

def setup(self):
# please make sure system level
# NTP server and DNS server has already
# been configured on the unity system!
Expand All @@ -205,7 +228,7 @@ def __init__(self):
log.debug('start {} setup.'.format(clz_name))
# noinspection PyBroadException
try:
super(UnityCifsShareFixture, self).__init__('ucs')
super(UnityCifsShareFixture, self).setup()
self._enable_cifs_domain()
self.cifs_share = self._create_cifs_share('ucs_cifs_share')
except Exception:
Expand Down
34 changes: 3 additions & 31 deletions comptest/unity/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@
import pytest

from comptest.unity import UnityGeneralFixture, UnityCifsShareFixture
from comptest.utils import is_jenkins
from storops.lib.common import inter_process_locked
from comptest.utils import is_jenkins, setup_fixture

__author__ = 'Cedric Zhuang'

Expand All @@ -35,21 +34,7 @@ def unity_gf(request):
:param request:
:return:
"""

@inter_process_locked('unity_gf.lck')
def _setup():
log.info('setup general fixture.')
return UnityGeneralFixture()

fixture = _setup()

def fin():
log.info('tear down general fixture.')
if fixture:
fixture.clean_up()

request.addfinalizer(fin)
return fixture
return setup_fixture(request, UnityGeneralFixture)


@pytest.fixture(scope="session", autouse=True)
Expand All @@ -62,17 +47,4 @@ def unity_cs(request):
if is_jenkins():
pytest.skip('do not run on CI, manual only.')

@inter_process_locked('unity_cs.lck')
def _setup():
log.info('setup cifs share fixture.')
return UnityCifsShareFixture()

fixture = _setup()

def fin():
log.info('tear down cifs share fixture.')
if fixture:
fixture.clean_up()

request.addfinalizer(fin)
return fixture
return setup_fixture(request, UnityCifsShareFixture)
45 changes: 45 additions & 0 deletions comptest/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,15 @@
import sys
import os
from os.path import join, dirname, abspath
from fasteners import process_lock

import errno
from time import sleep

from retryz import retry

from storops.exception import StoropsException
from storops.lib.common import get_lock_file
from test.utils import PersistedDict

__author__ = 'Cedric Zhuang'
Expand Down Expand Up @@ -70,6 +73,18 @@ def __init__(self, name):
self._names = self._init_names()
self._name = name
self._add_worker()
log.info('initialize fixture "{}"'.format(self._name))

@property
def name(self):
return self._name

def setup(self):
""" Detail setup should be done in this method
:return: nothing
"""
pass

def clean_up(self):
log.info('wait for all workers to exit.')
Expand Down Expand Up @@ -154,6 +169,9 @@ def has_snap_name(self, name=None):
def has_lun_name(self, name=None):
return self.has_name('lun', name)

def has_mirror_name(self, name=None):
return self.has_name('mirror', name)

def has_pool_name(self, name=None):
return self.has_name('pool', name)

Expand Down Expand Up @@ -186,6 +204,9 @@ def add_snap_name(self, name=None):
def add_lun_name(self, name=None):
return self.add_name('lun', name)

def add_mirror_name(self, name=None):
return self.add_name('mirror', name)

def add_pool_name(self, name=None):
return self.add_name('pool', name)

Expand Down Expand Up @@ -213,3 +234,27 @@ def add_cg_name(self, name=None):

def is_jenkins():
return 'jenkins' in os.path.abspath(__file__)


def setup_fixture(request, fixture_clz):
fixture = fixture_clz()

@inter_process_locked('{}.lck'.format(fixture.name))
def _setup():
try:
fixture.setup()
except StoropsException:
log.exception('fixture setup failed.')

def _clean_up():
log.info('tear down general fixture.')
if fixture:
fixture.clean_up()

request.addfinalizer(_clean_up)
_setup()
return fixture


def inter_process_locked(name):
return process_lock.interprocess_locked(get_lock_file(name))
Loading

0 comments on commit 62c07c5

Please sign in to comment.