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


Python StorageVolume.createEpoch方法代码示例

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


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

示例1: testStorageVolumePayloadGenerator

# 需要导入模块: from healthnmon.resourcemodel.healthnmonResourceModel import StorageVolume [as 别名]
# 或者: from healthnmon.resourcemodel.healthnmonResourceModel.StorageVolume import createEpoch [as 别名]
 def testStorageVolumePayloadGenerator(self):
     metadata = \
         event_metadata.get_EventMetaData(
             event_metadata.EVENT_TYPE_STORAGE_ADDED)
     obj = StorageVolume()
     obj.name = 'TestStorageVolume'
     obj.connectionState = 'ACTIVE'
     obj.size = 200
     obj.volumeType = 'DIR'
     obj.volumeId = 'TestVolumeId'
     obj.createEpoch = long(time.time() * 1000)
     obj.lastModifiedEpoch = long(time.time() * 1000)
     mount_point = HostMountPoint()
     mount_point.set_path('/root/storage/1')
     mount_point.set_vmHostId('HOST1')
     obj.add_mountPoints(mount_point)
     mount_point = HostMountPoint()
     mount_point.set_path('/root/storage/2')
     mount_point.set_vmHostId('HOST2')
     obj.add_mountPoints(mount_point)
     payload = payload_generator.generate_payload(metadata, obj)
     self.assertEquals(payload['entity_type'],
                       obj.__class__.__name__)
     self.assertEquals(payload['name'], obj.name)
     self.assertEquals(payload['state'], obj.connectionState)
     self.assertTrue(obj.mountPoints[0].path
                     in payload['mount_points'])
开发者ID:rakrup,项目名称:healthnmon,代码行数:29,代码来源:test_payload_generator.py

示例2: testVmHostPayload_with_storage_size

# 需要导入模块: from healthnmon.resourcemodel.healthnmonResourceModel import StorageVolume [as 别名]
# 或者: from healthnmon.resourcemodel.healthnmonResourceModel.StorageVolume import createEpoch [as 别名]
 def testVmHostPayload_with_storage_size(self):
     self.flags(instances_path="/var/lib/nova/instances")
     metadata = \
         event_metadata.get_EventMetaData(
             event_metadata.EVENT_TYPE_HOST_ADDED)
     obj = VmHost()
     obj.name = 'TestVmHost'
     ipProfile = IpProfile()
     ipProfile.ipAddress = '10.10.10.1'
     obj.add_ipAddresses(ipProfile)
     storage_obj = StorageVolume()
     storage_obj.id = "storage_id"
     storage_obj.name = 'TestStorageVolume'
     storage_obj.connectionState = 'ACTIVE'
     storage_obj.size = 200
     storage_obj.free = 100
     storage_obj.volumeType = 'DIR'
     storage_obj.volumeId = 'TestVolumeId'
     storage_obj.createEpoch = long(time.time() * 1000)
     storage_obj.lastModifiedEpoch = long(time.time() * 1000)
     mount_point = HostMountPoint()
     mount_point.set_path('/var/lib/nova/instances')
     mount_point.set_vmHostId('TestVmHost')
     storage_obj.add_mountPoints(mount_point)
     obj.add_storageVolumeIds("storage_id")
     self.mox.StubOutWithMock(
         InventoryCacheManager, 'get_object_from_cache')
     InventoryCacheManager.get_object_from_cache(
         storage_obj.id,
         Constants.StorageVolume).AndReturn(storage_obj)
     self.mox.ReplayAll()
     payload = payload_generator.generate_payload(metadata, obj)
     self.assertEquals(payload['entity_type'],
                       obj.__class__.__name__)
     self.assertEquals(payload['name'], obj.name)
     self.assertEquals(payload['ipAddresses'],
                       ipProfile.ipAddress)
     self.assertEquals(payload['totalStorageSize'],
                       storage_obj.size)
     self.assertEquals(payload['storageUsed'],
                       storage_obj.free)
开发者ID:rakrup,项目名称:healthnmon,代码行数:43,代码来源:test_payload_generator.py


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