当前位置: 首页>>代码示例>>Python>>正文


Python StorageVolume.set_size方法代码示例

本文整理汇总了Python中healthnmon.resourcemodel.healthnmonResourceModel.StorageVolume.set_size方法的典型用法代码示例。如果您正苦于以下问题:Python StorageVolume.set_size方法的具体用法?Python StorageVolume.set_size怎么用?Python StorageVolume.set_size使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在healthnmon.resourcemodel.healthnmonResourceModel.StorageVolume的用法示例。


在下文中一共展示了StorageVolume.set_size方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_diff_resourcemodel_storagevolume_withupdate

# 需要导入模块: from healthnmon.resourcemodel.healthnmonResourceModel import StorageVolume [as 别名]
# 或者: from healthnmon.resourcemodel.healthnmonResourceModel.StorageVolume import set_size [as 别名]
    def test_diff_resourcemodel_storagevolume_withupdate(self):
        """Unit Test to test for resource model comparison with some change """

        storagevolume = StorageVolume()
        storagevolume.set_id('datastore-112')
        storagevolume.set_name('datastore-112')
        storagevolume.set_resourceManagerId(
            '13274325-BFD6-464F-A9D1-61332573B5E2'
        )
        storagevolume.set_size(107105746944)
        storagevolume.set_free(32256294912)
        storagevolume.set_vmfsVolume(False)
        storagevolume.set_shared(False)
        storagevolume.set_assignedServerCount(1)
        storagevolume.set_volumeType('VMFS')
        storagevolume.set_volumeId(
            '/vmfs/volumes/4e374cf3-328f8064-aa2c-78acc0fcb5db'
        )
        hostMountPoint = \
            HostMountPoint(
                '/vmfs/volumes/4e374cf3-328f8064-aa2c-78acc0fcb5db',
                'host-9')
        storagevolume.add_mountPoints(hostMountPoint)

        storagevolume1 = StorageVolume()
        storagevolume1.set_id('datastore-112')
        storagevolume1.set_name('datastore-112')
        storagevolume1.set_resourceManagerId(
            '13274325-BFD6-464F-A9D1-61332573B5E2'
        )
        storagevolume1.set_size(107105746944)
        storagevolume1.set_free(32256294912)
        storagevolume1.set_vmfsVolume(False)
        storagevolume1.set_shared(False)
        storagevolume1.set_assignedServerCount(1)
        storagevolume1.set_volumeType('VMFS')
        storagevolume1.set_volumeId(
            '/vmfs/volumes/4e374cf3-328f8064-aa2c-78acc0fcb5db'
        )
        hostMountPoint1 = \
            HostMountPoint(
                '/vmfs/volumes/4e374cf3-328f8064-aa2c-78acc0fcb5db',
                'host-19')
        storagevolume1.add_mountPoints(hostMountPoint1)

        diff = ResourceModelDiff(storagevolume, storagevolume1)
        diff_res = diff.diff_resourcemodel()
        self.assertTrue(len(diff_res) > 0)
        self.assertTrue(self.update in diff_res)
        mountPoints = 'mountPoints'
        vmHostId = 'vmHostId'
        self.assertTrue(mountPoints in diff_res[self.update])
        self.assertTrue(self.update in diff_res[self.update][mountPoints])
        key = diff_res[self.update][mountPoints][self.update].keys()[0]
        self.assertTrue(self.update in diff_res[self.update][mountPoints][
            self.update][key])
        self.assertTrue(vmHostId in diff_res[self.update][mountPoints][
            self.update][key][self.update])
        self.assertEquals(diff_res[self.update][mountPoints][self.update][
            key][self.update][vmHostId], 'host-19')
开发者ID:rakrup,项目名称:healthnmon,代码行数:62,代码来源:test_resourcemodel_diff.py

示例2: test_diff_resourcemodel_storagevolume_nochange

# 需要导入模块: from healthnmon.resourcemodel.healthnmonResourceModel import StorageVolume [as 别名]
# 或者: from healthnmon.resourcemodel.healthnmonResourceModel.StorageVolume import set_size [as 别名]
    def test_diff_resourcemodel_storagevolume_nochange(self):
        """Unit Test to test for resource model comparison with no change """

        storagevolume = StorageVolume()
        storagevolume.set_id('datastore-112')
        storagevolume.set_name('datastore-112')
        storagevolume.set_resourceManagerId(
            '13274325-BFD6-464F-A9D1-61332573B5E2'
        )
        storagevolume.set_size(107105746944)
        storagevolume.set_free(32256294912)
        storagevolume.set_vmfsVolume(False)
        storagevolume.set_shared(False)
        storagevolume.set_assignedServerCount(1)
        storagevolume.set_volumeType('VMFS')
        storagevolume.set_volumeId(
            '/vmfs/volumes/4e374cf3-328f8064-aa2c-78acc0fcb5db'
        )
        hostMountPoint = \
            HostMountPoint(
                '/vmfs/volumes/4e374cf3-328f8064-aa2c-78acc0fcb5db',
                'host-9')
        storagevolume.add_mountPoints(hostMountPoint)

        storagevolume1 = StorageVolume()
        storagevolume1.set_id('datastore-112')
        storagevolume1.set_name('datastore-112')
        storagevolume1.set_resourceManagerId(
            '13274325-BFD6-464F-A9D1-61332573B5E2'
        )
        storagevolume1.set_size(107105746944)
        storagevolume1.set_free(32256294912)
        storagevolume1.set_vmfsVolume(False)
        storagevolume1.set_shared(False)
        storagevolume1.set_assignedServerCount(1)
        storagevolume1.set_volumeType('VMFS')
        storagevolume1.set_volumeId(
            '/vmfs/volumes/4e374cf3-328f8064-aa2c-78acc0fcb5db'
        )
        hostMountPoint1 = \
            HostMountPoint(
                '/vmfs/volumes/4e374cf3-328f8064-aa2c-78acc0fcb5db',
                'host-9')
        storagevolume1.add_mountPoints(hostMountPoint1)

        diff = ResourceModelDiff(storagevolume, storagevolume1)
        diff_res = diff.diff_resourcemodel()

        self.assertTrue(len(diff_res) == 0)
开发者ID:rakrup,项目名称:healthnmon,代码行数:51,代码来源:test_resourcemodel_diff.py

示例3: get_storagevolume_list

# 需要导入模块: from healthnmon.resourcemodel.healthnmonResourceModel import StorageVolume [as 别名]
# 或者: from healthnmon.resourcemodel.healthnmonResourceModel.StorageVolume import set_size [as 别名]
    def get_storagevolume_list(self, storageId=None):
        storagevolume_dict = {}
        storagevolume_list = []
        storagevolume = StorageVolume()
        storagevolume.set_id('datastore-111')
        storagevolume.set_name('datastore-111')
        storagevolume.set_resourceManagerId(
            '13274325-BFD6-464F-A9D1-61332573B5E2')
        storagevolume.set_size(107105746944)
        storagevolume.set_free(32256294912)
        storagevolume.set_vmfsVolume(True)
        storagevolume.set_shared(True)
        storagevolume.set_assignedServerCount(2)
        storagevolume.set_volumeType('VMFS')
        storagevolume.set_volumeId(
            '/vmfs/volumes/4e374cf3-328f8064-aa2c-78acc0fcb5da')
        hostMountPoint = \
            HostMountPoint(
                '/vmfs/volumes/4e374cf3-328f8064-aa2c-78acc0fcb5da', 'host-9')
        storagevolume.add_mountPoints(hostMountPoint)
        storagevolume_list.append(storagevolume)
        storagevolume_dict[storagevolume.get_id()] = storagevolume

        storagevolume = StorageVolume()
        storagevolume.set_id('datastore-112')
        storagevolume.set_name('datastore-112')
        storagevolume.set_resourceManagerId(
            '13274325-BFD6-464F-A9D1-61332573B5E2')
        storagevolume.set_size(107105746944)
        storagevolume.set_free(32256294912)
        storagevolume.set_vmfsVolume(False)
        storagevolume.set_shared(False)
        storagevolume.set_assignedServerCount(1)
        storagevolume.set_volumeType('VMFS')
        storagevolume.set_volumeId(
            '/vmfs/volumes/4e374cf3-328f8064-aa2c-78acc0fcb5db')
        hostMountPoint = \
            HostMountPoint(
                '/vmfs/volumes/4e374cf3-328f8064-aa2c-78acc0fcb5db', 'host-9')
        storagevolume.add_mountPoints(hostMountPoint)
        storagevolume_list.append(storagevolume)
        storagevolume_dict[storagevolume.get_id()] = storagevolume
        if storageId is not None:
            return [storagevolume_dict[storageId]]
        return storagevolume_list
开发者ID:jessegonzalez,项目名称:healthnmon,代码行数:47,代码来源:test_storagevolume.py

示例4: test_vm_host_delete

# 需要导入模块: from healthnmon.resourcemodel.healthnmonResourceModel import StorageVolume [as 别名]
# 或者: from healthnmon.resourcemodel.healthnmonResourceModel.StorageVolume import set_size [as 别名]
    def test_vm_host_delete(self):
        vmhost_id = 'VH1'
        vmhost = VmHost()
        vmhost.id = vmhost_id
        vSwitch = VirtualSwitch()
        vSwitch.set_id('vSwitch-01')
        vSwitch.set_name('vSwitch-01')
        vSwitch.set_resourceManagerId('rmId')
        vSwitch.set_switchType('vSwitch')

        cost1 = Cost()
        cost1.set_value(100)
        cost1.set_units('USD')
        vSwitch.set_cost(cost1)

        portGroup = PortGroup()
        portGroup.set_id('pg-01')
        portGroup.set_name('pg-01')
        portGroup.set_resourceManagerId('rmId')
        portGroup.set_type('portgroup_type')
        portGroup.set_cost(cost1)
        vSwitch.add_portGroups(portGroup)
        vmhost.add_virtualSwitches(vSwitch)
        vmhost.add_portGroups(portGroup)
        healthnmon_db_api.vm_host_save(get_admin_context(), vmhost)

        vmhost2 = VmHost()
        vmhost2.set_id('VH2')
        healthnmon_db_api.vm_host_save(get_admin_context(), vmhost2)

        storage = StorageVolume()
        storage.set_id('sv-01')
        storage.set_name('storage-01')
        storage.set_resourceManagerId('rmId')
        storage.set_size(1234)
        storage.set_free(2345)
        storage.set_vmfsVolume(True)
        storage.set_shared(True)
        storage.set_assignedServerCount(1)
        storage.set_volumeType('VMFS')
        storage.set_volumeId('101')

        hostMount1 = HostMountPoint()
        hostMount1.set_path('test_path1')
        hostMount1.set_vmHostId('VH1')
        storage.add_mountPoints(hostMount1)
        hostMount2 = HostMountPoint()
        hostMount2.set_path('test_path2')
        hostMount2.set_vmHostId('VH2')
        storage.add_mountPoints(hostMount2)
        healthnmon_db_api.storage_volume_save(get_admin_context(),
                                              storage)

        vm = Vm()
        vm.set_id('vm-01')
        vm.set_name('vm-01')
        vm.set_vmHostId('VH1')
        healthnmon_db_api.vm_save(get_admin_context(), vm)

        vmhosts = \
            healthnmon_db_api.vm_host_get_by_ids(get_admin_context(),
                                                 [vmhost_id])
        self.assertFalse(vmhosts is None,
                         'host get by id returned a none list')
        self.assertTrue(len(vmhosts) > 0,
                        'host get by id returned invalid number of list'
                        )

        healthnmon_db_api.vm_host_delete_by_ids(get_admin_context(),
                                                [vmhost_id])

        vmhosts = \
            healthnmon_db_api.vm_host_get_by_ids(get_admin_context(),
                                                 [vmhost_id])
        self.assertTrue(vmhosts is None or len(vmhosts) == 0,
                        'host not deleted')
开发者ID:rakrup,项目名称:healthnmon,代码行数:78,代码来源:test_vm_host_db_api.py

示例5: test_diff_differentDict

# 需要导入模块: from healthnmon.resourcemodel.healthnmonResourceModel import StorageVolume [as 别名]
# 或者: from healthnmon.resourcemodel.healthnmonResourceModel.StorageVolume import set_size [as 别名]
    def test_diff_differentDict(self):
        storagevolume = StorageVolume()
        storagevolume.set_id('datastore-112')
        storagevolume.set_name('datastore-112')
        storagevolume.set_resourceManagerId(
            '13274325-BFD6-464F-A9D1-61332573B5E2'
        )
        storagevolume.set_size(107105746944)
        storagevolume.set_free(32256294912)
        storagevolume.set_vmfsVolume(False)
        storagevolume.set_shared(False)
        storagevolume.set_assignedServerCount(1)
        storagevolume.set_volumeType('VMFS')
        storagevolume.set_volumeId(
            '/vmfs/volumes/4e374cf3-328f8064-aa2c-78acc0fcb5db'
        )
        hostMountPoint = \
            HostMountPoint(
                {'1': '/vmfs/volumes/4e374cf3-328f8064-aa2c-78acc0fcb5db',
                 '2': 'host-9'})
        storagevolume.add_mountPoints(hostMountPoint)

        storagevolume1 = StorageVolume()
        storagevolume1.set_id('datastore-112')
        storagevolume1.set_name('datastore-112')
        storagevolume1.set_resourceManagerId(
            '13274325-BFD6-464F-A9D1-61332573B5E2'
        )
        storagevolume1.set_size(107105746944)
        storagevolume1.set_free(32256294912)
        storagevolume1.set_vmfsVolume(False)
        storagevolume1.set_shared(False)
        storagevolume1.set_assignedServerCount(1)
        storagevolume1.set_volumeType('VMFS')
        storagevolume1.set_volumeId(
            '/vmfs/volumes/4e374cf3-328f8064-aa2c-78acc0fcb5db'
        )
        hostMountPoint1 = \
            HostMountPoint(
                {'3': '/vmfs/volumes/4e374cf3-328f8064-aa2c-78acc0fcb5db',
                 '4': 'host-19'})
        storagevolume1.add_mountPoints(hostMountPoint1)

        diff = ResourceModelDiff(storagevolume, storagevolume1)
        diff_res = diff.diff_resourcemodel()
        self.assertTrue(len(diff_res) > 0)
        self.assertTrue(self.update in diff_res)
        mountPoints = 'mountPoints'

        self.assertTrue(mountPoints in diff_res[self.update])
        self.assertTrue(self.update in diff_res[self.update][mountPoints])

        key = diff_res[self.update][mountPoints][self.update].keys()[0]

        self.assertTrue(self.update in diff_res[self.update][mountPoints][
            self.update][key])
        self.assertTrue('path' in diff_res[self.update][mountPoints][
            self.update][key][self.update])
        self.assertTrue(self.add in diff_res[self.update][mountPoints][
            self.update][key][self.update]['path'])
        self.assertTrue('3' in diff_res[self.update][mountPoints][
                        self.update][key][self.update]['path'][self.add])
        self.assertEquals(diff_res[self.update][mountPoints][self.update][
            key][self.update]['path'][self.add]['3'],
            '/vmfs/volumes/4e374cf3-328f8064-aa2c-78acc0fcb5db')
        self.assertTrue('4' in diff_res[self.update][mountPoints][
                        self.update][key][self.update]['path'][self.add])
        self.assertEquals(diff_res[self.update][mountPoints][self.update][
            key][self.update]['path'][self.add]['4'], 'host-19')

        self.assertTrue(self.delete in diff_res[self.update][mountPoints][
            self.update][key][self.update]['path'])
        self.assertTrue('1' in diff_res[self.update][mountPoints][
                        self.update][key][self.update]['path'][self.delete])
        self.assertEquals(diff_res[self.update][mountPoints][self.update][
            key][self.update]['path'][self.delete]['1'],
            '/vmfs/volumes/4e374cf3-328f8064-aa2c-78acc0fcb5db')
        self.assertTrue('2' in diff_res[self.update][mountPoints][
                        self.update][key][self.update]['path'][self.delete])
        self.assertEquals(diff_res[self.update][mountPoints][self.update][
            key][self.update]['path'][self.delete]['2'], 'host-9')
开发者ID:rakrup,项目名称:healthnmon,代码行数:83,代码来源:test_resourcemodel_diff.py

示例6: test_diff_resourcemodel_storagevolume_withdelete_withDict

# 需要导入模块: from healthnmon.resourcemodel.healthnmonResourceModel import StorageVolume [as 别名]
# 或者: from healthnmon.resourcemodel.healthnmonResourceModel.StorageVolume import set_size [as 别名]
    def test_diff_resourcemodel_storagevolume_withdelete_withDict(self):
        """Unit Test to test for resource model comparison with some change """

        storagevolume = StorageVolume()
        storagevolume.set_id('datastore-112')
        storagevolume.set_name('datastore-112')
        storagevolume.set_resourceManagerId(
            '13274325-BFD6-464F-A9D1-61332573B5E2'
        )
        storagevolume.set_size(107105746944)
        storagevolume.set_free(32256294912)
        storagevolume.set_vmfsVolume(False)
        storagevolume.set_shared(False)
        storagevolume.set_assignedServerCount(1)
        storagevolume.set_volumeType('VMFS')
        storagevolume.set_volumeId(
            '/vmfs/volumes/4e374cf3-328f8064-aa2c-78acc0fcb5db'
        )
        hostMountPoint = \
            HostMountPoint(
                {'1': '/vmfs/volumes/4e374cf3-328f8064-aa2c-78acc0fcb5db',
                 '2': 'host-9'})
        storagevolume.add_mountPoints(hostMountPoint)

        storagevolume1 = StorageVolume()
        storagevolume1.set_id('datastore-114')
        storagevolume1.set_name('datastore-114')
        storagevolume1.set_resourceManagerId(
            '13274325-BFD6-464F-A9D1-61332573B5E2'
        )
        storagevolume1.set_size(107105746944)
        storagevolume1.set_free(32256294912)
        storagevolume1.set_vmfsVolume(False)
        storagevolume1.set_shared(False)
        storagevolume1.set_assignedServerCount(1)
        storagevolume1.set_volumeType('VMFS')
        storagevolume1.set_volumeId(
            {'1': '/vmfs/volumes/4e374cf3-328f8064-aa2c-78acc0fcb5db'})

        diff = ResourceModelDiff(storagevolume, storagevolume1)
        diff_res = diff.diff_resourcemodel()
        self.assertTrue(len(diff_res) > 0)

        self.assertTrue(self.update in diff_res)
        mountPoints = 'mountPoints'
        self.assertTrue(mountPoints in diff_res[self.update])
        self.assertTrue(self.delete in diff_res[self.update][mountPoints])

        key = diff_res[self.update][mountPoints][self.delete].keys()[0]
        self.assertTrue(isinstance(diff_res[self.update][mountPoints][
                        self.delete][key], HostMountPoint))
        delMount = diff_res[self.update][mountPoints][self.delete][key]
        self.assertEquals(
            delMount.pathProp,
            {'1': '/vmfs/volumes/4e374cf3-328f8064-aa2c-78acc0fcb5db',
             '2': 'host-9'})

        self.assertTrue('id' in diff_res[self.update])
        self.assertEquals(diff_res[self.update]['id'], 'datastore-114')

        self.assertTrue('name' in diff_res[self.update])
        self.assertEquals(diff_res[self.update]['name'], 'datastore-114')

        self.assertTrue('volumeId' in diff_res[self.update])
        self.assertEquals(
            diff_res[self.update]['volumeId'],
            {'1': '/vmfs/volumes/4e374cf3-328f8064-aa2c-78acc0fcb5db'})
开发者ID:rakrup,项目名称:healthnmon,代码行数:69,代码来源:test_resourcemodel_diff.py


注:本文中的healthnmon.resourcemodel.healthnmonResourceModel.StorageVolume.set_size方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。