本文整理汇总了Python中nova.block_device.new_format_is_ephemeral函数的典型用法代码示例。如果您正苦于以下问题:Python new_format_is_ephemeral函数的具体用法?Python new_format_is_ephemeral怎么用?Python new_format_is_ephemeral使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了new_format_is_ephemeral函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _transform
def _transform(self):
if not block_device.new_format_is_ephemeral(self._bdm_obj):
raise _InvalidType
self.update({
'device_name': self._bdm_obj.device_name,
'size': self._bdm_obj.volume_size or 0,
'disk_bus': self._bdm_obj.disk_bus,
'device_type': self._bdm_obj.device_type,
'guest_format': self._bdm_obj.guest_format
})
示例2: _transform
def _transform(self, bdm):
if not block_device.new_format_is_ephemeral(bdm):
raise _InvalidType
self.update({
'device_name': bdm.get('device_name'),
'size': bdm.get('volume_size') or 0,
'disk_bus': bdm.get('disk_bus'),
'device_type': bdm.get('device_type'),
'guest_format': bdm.get('guest_format')
})
示例3: _transform
def _transform(self, bdm):
if not block_device.new_format_is_ephemeral(bdm):
raise _InvalidType
self.update(
{
"device_name": bdm.get("device_name"),
"size": bdm.get("volume_size", 0),
"disk_bus": bdm.get("disk_bus"),
"device_type": bdm.get("device_type"),
"guest_format": bdm.get("guest_format"),
}
)
示例4: _transform
def _transform(self):
if not block_device.new_format_is_ephemeral(self._bdm_obj):
raise _InvalidType
self.update(
{
"device_name": self._bdm_obj.device_name,
"size": self._bdm_obj.volume_size or 0,
"disk_bus": self._bdm_obj.disk_bus,
"device_type": self._bdm_obj.device_type,
"guest_format": self._bdm_obj.guest_format,
}
)
示例5: _get_disk_metadata
def _get_disk_metadata(self, instance, bdm):
attachment_info = None
if bdm.is_volume:
attachment_info = self._get_vol_bdm_attachment_info(bdm)
elif block_device.new_format_is_ephemeral(bdm):
attachment_info = self._get_eph_bdm_attachment_info(
instance, bdm)
if not attachment_info:
LOG.debug("No attachment info retrieved for bdm %s.", bdm)
return
tags = [bdm.tag] if bdm.tag else []
bus = self._get_device_bus(
attachment_info['controller_type'],
attachment_info['controller_addr'],
attachment_info['controller_slot'])
serial = attachment_info.get('serial')
return objects.DiskMetadata(bus=bus,
tags=tags,
serial=serial)
示例6: test_new_format_is_ephemeral
def test_new_format_is_ephemeral(self):
expected_results = [False, True, False, False, False]
for expected, bdm in zip(expected_results, self.new_mapping):
res = block_device.new_format_is_ephemeral(bdm)
self.assertEqual(expected, res)