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


Python StorageVolume.get_id方法代码示例

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


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

示例1: test_vm_host_get_all_for_sv

# 需要导入模块: from healthnmon.resourcemodel.healthnmonResourceModel import StorageVolume [as 别名]
# 或者: from healthnmon.resourcemodel.healthnmonResourceModel.StorageVolume import get_id [as 别名]
    def test_vm_host_get_all_for_sv(self):
        host_id = 'VH1'
        vmhost = VmHost()
        vmhost.id = host_id
        healthnmon_db_api.vm_host_save(get_admin_context(), vmhost)
        mntPnt = HostMountPoint()
        mntPnt.set_vmHostId(host_id)
        mntPnt.set_path('/path')
        volume = StorageVolume()
        volume.set_id('SV11')
        volume.add_mountPoints(mntPnt)
        healthnmon_db_api.storage_volume_save(get_admin_context(),
                                              volume)

        vmhosts = \
            healthnmon_db_api.vm_host_get_all(get_admin_context())
        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'
                        )
        self.assertTrue(vmhosts[0].id == host_id)
        svlist = vmhosts[0].get_storageVolumeIds()
        self.assert_(svlist is not None)
        self.assert_(len(svlist) == 1)
        self.assert_(volume.get_id() in svlist)

        healthnmon_db_api.storage_volume_delete_by_ids(
            get_admin_context(), [volume.get_id()])
        vmhosts = \
            healthnmon_db_api.vm_host_get_all(get_admin_context())
        self.assertTrue(vmhosts[0].id == host_id)
        svids = vmhosts[0].get_storageVolumeIds()
        self.assert_((svids is None) or (len(svids) == 0))
开发者ID:rakrup,项目名称:healthnmon,代码行数:36,代码来源:test_vm_host_db_api.py

示例2: test_timestamp_columns

# 需要导入模块: from healthnmon.resourcemodel.healthnmonResourceModel import StorageVolume [as 别名]
# 或者: from healthnmon.resourcemodel.healthnmonResourceModel.StorageVolume import get_id [as 别名]
 def test_timestamp_columns(self):
     """
         Test the time stamp columns createEpoch,
         modifiedEpoch and deletedEpoch
     """
     vol = StorageVolume()
     vol.set_id('vol-01')
     # Check for createEpoch
     epoch_before = utils.get_current_epoch_ms()
     healthnmon_db_api.storage_volume_save(self.admin_context, vol)
     epoch_after = utils.get_current_epoch_ms()
     vol_queried = healthnmon_db_api.storage_volume_get_by_ids(
         self.admin_context, [vol.get_id()])[0]
     self.assert_(test_utils.is_timestamp_between(
         epoch_before, epoch_after, vol_queried.get_createEpoch()))
     # Check for lastModifiedEpoch
     vol_modified = vol_queried
     test_utils.unset_timestamp_fields(vol_modified)
     vol_modified.set_name('changed_name')
     epoch_before = utils.get_current_epoch_ms()
     healthnmon_db_api.storage_volume_save(self.admin_context, vol_modified)
     epoch_after = utils.get_current_epoch_ms()
     vol_queried = healthnmon_db_api.storage_volume_get_by_ids(
         self.admin_context, [vol.get_id()])[0]
     self.assert_(
         vol_modified.get_createEpoch() == vol_queried.get_createEpoch())
     self.assert_(test_utils.is_timestamp_between(
         epoch_before, epoch_after, vol_queried.get_lastModifiedEpoch()))
开发者ID:jessegonzalez,项目名称:healthnmon,代码行数:30,代码来源:test_storage_volume_db_api.py

示例3: get_storagevolume_list

# 需要导入模块: from healthnmon.resourcemodel.healthnmonResourceModel import StorageVolume [as 别名]
# 或者: from healthnmon.resourcemodel.healthnmonResourceModel.StorageVolume import get_id [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


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