Skip to content

Commit

Permalink
Release 0.2.15
Browse files Browse the repository at this point in the history
  • Loading branch information
Murray-LIANG committed Jul 5, 2016
2 parents 577769d + 9c782d0 commit 3ea3171
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 8 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.14
VERSION: 0.2.15

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 @@ -57,6 +57,7 @@ Feature List
- list/create/delete NFS share
- show system domain information
- list hosts
- show system capacity
- supported feature/operations
- list/start/cancel migration sessions
- enable/disable LUN deduplication
Expand Down Expand Up @@ -306,6 +307,7 @@ EMC Contributors
- Jay Xu <jay.xu@emc.com>
- Ray Chen <ray.chen@emc.com>
- Tina Tang <tina.tang@emc.com>
- Ryan Liang <ryan.liang@emc.com>
Community Contributors
``````````````````````
Expand Down
2 changes: 2 additions & 0 deletions storops/lib/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -435,3 +435,5 @@ def _inner(*args, **kwargs):
return round(value, ndigits)
return _inner
return inner

round_3 = round_it(3)
4 changes: 4 additions & 0 deletions storops/vnx/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ def get_sp_index(cls, value):
def index(self):
return self.value.lower()[-1]

@property
def display_name(self):
return self.index.upper()


class VNXProvisionEnum(VNXEnum):
# value of spec "provisioning:type"
Expand Down
10 changes: 5 additions & 5 deletions storops/vnx/resource/capacity.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from storops.vnx.resource.disk import VNXDisk
from storops.vnx.resource.block_pool import VNXPool
from storops.vnx.resource.rg import VNXRaidGroup
from storops.lib.common import JsonPrinter, round_it
from storops.lib.common import JsonPrinter, round_3
from storops.lib.converter import mb_to_gb

__author__ = 'Tina Tang'
Expand All @@ -41,15 +41,15 @@ def get(cls, cli):
return VNXCapacity(cli)

@property
@round_it()
@round_3
def total(self):
"""Total disk capacity in GB"""
if self._total is None:
self._update_disk_capacity()
return self._total

@property
@round_it()
@round_3
def free_raw_disk(self):
"""Free raw disk capacity in GB
Expand All @@ -61,7 +61,7 @@ def free_raw_disk(self):
return self._free_raw_disk

@property
@round_it()
@round_3
def free_storage_pool(self):
"""Free storage pool capacity in GB
Expand All @@ -73,7 +73,7 @@ def free_storage_pool(self):
return self._free_storage_pool

@property
@round_it()
@round_3
def used(self):
"""Total used capacity in GB
Expand Down
7 changes: 7 additions & 0 deletions storops/vnx/resource/port.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,13 @@ def vport_id(self):
def wwn(self):
return self._get_property('_wwn')

@property
def display_name(self):
items = [self.sp.display_name, str(self.port_id)]
if self.vport_id is not None:
items.append(str(self.vport_id))
return '-'.join(items)

def config_ip(self, ip, mask, gateway, vport_id=None, vlan_id=None):
if self.type != VNXPortType.ISCSI:
raise TypeError('configure IP only works for iSCSI ports.')
Expand Down
4 changes: 2 additions & 2 deletions storops/vnx/resource/rg.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

from storops.vnx.resource import VNXCliResource, VNXCliResourceList
from storops import exception as ex
from storops.lib.common import round_it
from storops.lib.common import round_3
from storops.lib.converter import block_to_gb

__author__ = 'Cedric Zhuang'
Expand Down Expand Up @@ -58,7 +58,7 @@ def get(cls, cli, raid_group_id=None):
return ret

@property
@round_it()
@round_3
def available_capacity_gbs(self):
return block_to_gb(self.free_capacity_blocks_non_contiguous)

Expand Down
2 changes: 2 additions & 0 deletions test/vnx/resource/test_port.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ def test_get_port_property(self):
assert_that(port.logged_in_initiators, equal_to(1))
assert_that(port.not_logged_in_initiators, equal_to(2))
assert_that(port.type, equal_to(VNXPortType.FC))
assert_that(port.display_name, equal_to('A-0'))

@patch_cli()
def test_get_port_by_type(self):
Expand Down Expand Up @@ -173,6 +174,7 @@ def test_properties(self):
assert_that(port.gateway_address, equal_to('0.0.0.0'))
assert_that(port.type, equal_to(VNXPortType.ISCSI))
assert_that(port.existed, equal_to(True))
assert_that(port.display_name, equal_to('A-4-0'))

@patch_cli()
def test_get_all(self):
Expand Down

0 comments on commit 3ea3171

Please sign in to comment.