예제 #1
0
파일: test_lun.py 프로젝트: seven/storops
 def test_get_lun_with_host_access(self):
     unity = UnitySystem('10.109.22.101', 'admin', 'Password123!')
     lun = unity.get_lun(_id='sv_567')
     assert_that(lun.host_access, instance_of(UnityBlockHostAccessList))
     access = lun.host_access[0]
     assert_that(access.access_mask, equal_to(HostLUNAccessEnum.PRODUCTION))
     assert_that(access.host, instance_of(UnityHost))
     assert_that(access.host.id, equal_to('Host_1'))
예제 #2
0
    def test_lun_perf_disabled_exception(self):
        unity = UnitySystem('10.244.223.61', 'a', 'a')
        unity.disable_perf_stats()

        def f():
            return unity.get_lun(_id='sv_2').read_iops

        assert_that(f, raises(UnityPerfMonNotEnabledError, 'not enabled'))
예제 #3
0
def get_unity_unisphere_connection(module_params):
    if HAS_UNITY_SDK:
        conn = UnitySystem(host=module_params['unispherehost'],
                           port=module_params['port'],
                           verify=module_params['verifycert'],
                           username=module_params['username'],
                           password=module_params['password'])
        return conn
예제 #4
0
def index():
    data = ''
    if request.method == "POST":

        info = request.form.to_dict()
        # array = ip address of Unity array from inputbox
        ip = info['ip']
        username = info['username']
        password = info['password']

        unity = UnitySystem(ip, username, password)
        hosts = unity.get_host()

        data = dict(
            array_name=unity.name,
            array_OE=unity.system_version,
            host_list=hosts
        )
        for host in data['host_list']:
            print(host.name)

        #user = f'Connected to {unity.name} (OE: {unity.system_version})'

    return render_template("index.html", data=data)
예제 #5
0
 def setUp(self):
     self.unity = UnitySystem('10.244.223.61', 'a', 'a')
     self.unity.enable_perf_stats(1, [UnityDisk])
예제 #6
0
import sys
import re
from storops import UnitySystem
import json

array_ip = ''
array_user = '******'
array_pass = '******'

unity = UnitySystem(array_ip, array_user, array_pass)
luns = unity.get_lun()
for lun in luns:
    lun_id = lun.id
    lun_name = lun.name
    lun_wwn = lun.wwn
    lun_size = lun.size_total / 1024 / 1024 / 1024
    print('Lun ID: {}'.format(lun_id))
    print('Lun Name: {}'.format(lun_name))
    print('Lun Size (GB): {}'.format(lun_size))
    print('Lun WWN: {}'.format(lun.wwn))
    lun_pool = lun.pool.id
    print('Lun Pool: {}'.format(lun_pool))
    print()
예제 #7
0
def t_unity():
    unity = UnitySystem('10.244.223.61', 'admin', 'Password123!')
    log.debug('initialize unity system: {}'.format(unity))
    return unity
예제 #8
0
import os
import urllib3

from storops import UnitySystem  # https://github.com/emc-openstack/storops
from hurry.filesize import size

# Load the config from environment variables
SAN_IP = os.environ["UNITY_SAN_IP"]
USER = os.environ["UNITY_USER"]
PASSWORD = os.environ["UNITY_PASSWORD"]

# Squelch HTTPS warnings
urllib3.disable_warnings()

# Connect to Unity
unity = UnitySystem(SAN_IP, USER, PASSWORD)

# Collect some basic information - List the storage pools
print("Listing Pools:")
pools = unity.get_pool()
for pool in pools.list:
    print(f"   {pool.name}")

# Show usage details of a specific pool
print("Usage in pool1:")
pool1 = unity.get_pool(name="pool1")
print(f"   Used: {size(pool1.size_used)}")
print(f"   Free: {size(pool1.size_free)}")
print(f"   Total: {size(pool1.size_total)}")