Esempio n. 1
0
 def __init__(self, methodName='runTest'):
     super(SDKVswitchTestCase, self).__init__(methodName)
     self.basevm = "TESTVMID"
     self.client = zvmclient.get_zvmclient()
     self.vswitch = "VSWTEST"
     # Delete test vswitch to make test env more stable
     self.sdkapi.vswitch_delete(self.vswitch)
Esempio n. 2
0
 def __init__(self, methodName='runTest'):
     super(SDKNICTestCase, self).__init__(methodName)
     self.basevm = "NICTEST"
     self.client = zvmclient.get_zvmclient()
     self.vswitch = "VSWTEST"
     # Delete test vm/vsw before run cases to make test env more stable
     self.sdkapi.guest_delete(self.basevm)
     self.sdkapi.vswitch_delete(self.vswitch)
Esempio n. 3
0
 def __init__(self):
     self._zvmclient = zvmclient.get_zvmclient()
Esempio n. 4
0
 def __init__(self):
     self.api = api.SDKAPI()
     self.zvmclient = zvmclient.get_zvmclient()
Esempio n. 5
0
 def __init__(self):
     self._cache = MeteringCache(self._TYPES)
     self._zvmclient = zvmclient.get_zvmclient()
Esempio n. 6
0
 def test_get_zvmclient(self):
     _client = zvmclient.get_zvmclient()
     if CONF.zvm.client_type == 'xcat':
         self.assertTrue(isinstance(_client, xcatclient.XCATClient))
     elif CONF.zvm.client_type == 'smut':
         self.assertTrue(isinstance(_client, smutclient.SMUTClient))
Esempio n. 7
0
 def setUp(self):
     super(SDKZVMClientTestCase, self).setUp()
     self._zvmclient = zvmclient.get_zvmclient()
Esempio n. 8
0
class SDKZVMClientTestCase(base.SDKTestCase):
    def setUp(self):
        super(SDKZVMClientTestCase, self).setUp()
        self._zvmclient = zvmclient.get_zvmclient()

    def test_get_zvmclient(self):
        _client = zvmclient.get_zvmclient()
        if CONF.zvm.client_type == 'xcat':
            self.assertTrue(isinstance(_client, xcatclient.XCATClient))
        elif CONF.zvm.client_type == 'smut':
            self.assertTrue(isinstance(_client, smutclient.SMUTClient))

    def test_generate_vdev(self):
        base = '0100'
        idx = 1
        vdev = self._zvmclient._generate_vdev(base, idx)
        self.assertEqual(vdev, '0101')

    @mock.patch.object(zvmclient.get_zvmclient(), '_add_mdisk')
    def test_add_mdisks(self, add_mdisk):
        userid = 'fakeuser'
        disk_list = [{
            'size': '1g',
            'is_boot_disk': True,
            'disk_pool': 'ECKD:eckdpool1'
        }, {
            'size': '200000',
            'disk_pool': 'FBA:fbapool1',
            'format': 'ext3'
        }]
        self._zvmclient.add_mdisks(userid, disk_list)
        add_mdisk.assert_any_call(userid, disk_list[0], '0100')
        add_mdisk.assert_any_call(userid, disk_list[1], '0101')

    @mock.patch.object(zvmclient.get_zvmclient(), 'image_performance_query')
    def test_get_image_performance_info(self, ipq):
        ipq.return_value = {
            u'FAKEVM': {
                'used_memory': u'5222192 KB',
                'used_cpu_time': u'25640530229 uS',
                'guest_cpus': u'2',
                'userid': u'FKAEVM',
                'max_memory': u'8388608 KB'
            }
        }
        info = self._zvmclient.get_image_performance_info('fakevm')
        self.assertEqual(info['used_memory'], '5222192 KB')

    @mock.patch.object(zvmclient.get_zvmclient(), 'image_performance_query')
    def test_get_image_performance_info_not_exist(self, ipq):
        ipq.return_value = {}
        info = self._zvmclient.get_image_performance_info('fakevm')
        self.assertEqual(info, None)

    def test_is_vdev_valid_true(self):
        vdev = '1009'
        vdev_info = ['1003', '1006']
        result = self._zvmclient._is_vdev_valid(vdev, vdev_info)
        self.assertEqual(result, True)

    def test_is_vdev_valid_False(self):
        vdev = '2002'
        vdev_info = ['2000', '2004']
        result = self._zvmclient._is_vdev_valid(vdev, vdev_info)
        self.assertEqual(result, False)
Esempio n. 9
0
 def __init__(self):
     self._zvmclient = zvmclient.get_zvmclient()
     self._dist_manager = dist.LinuxDistManager()
     self._pathutils = zvmutils.PathUtils()
Esempio n. 10
0
 def __init__(self):
     self.zvmclient = zvmclient.get_zvmclient()
     self._pathutils = zvmutils.PathUtils()
     self._ImageDbOperator = database.ImageDbOperator()