本文整理汇总了Python中nova.block_device.new_format_is_swap函数的典型用法代码示例。如果您正苦于以下问题:Python new_format_is_swap函数的具体用法?Python new_format_is_swap怎么用?Python new_format_is_swap使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了new_format_is_swap函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _transform
def _transform(self):
if not block_device.new_format_is_swap(self._bdm_obj):
raise _InvalidType
self.update({
'device_name': self._bdm_obj.device_name,
'swap_size': self._bdm_obj.volume_size or 0,
'disk_bus': self._bdm_obj.disk_bus
})
示例2: _transform
def _transform(self, bdm):
if not block_device.new_format_is_swap(bdm):
raise _InvalidType
self.update({
'device_name': bdm.get('device_name'),
'swap_size': bdm.get('volume_size') or 0,
'disk_bus': bdm.get('disk_bus')
})
示例3: _transform
def _transform(self, bdm):
if not block_device.new_format_is_swap(bdm):
raise _InvalidType
self.update(
{
"device_name": bdm.get("device_name"),
"swap_size": bdm.get("volume_size", 0),
"disk_bus": bdm.get("disk_bus"),
}
)
示例4: _transform
def _transform(self):
if not block_device.new_format_is_swap(self._bdm_obj):
raise _InvalidType
self.update(
{
"device_name": self._bdm_obj.device_name,
"swap_size": self._bdm_obj.volume_size or 0,
"disk_bus": self._bdm_obj.disk_bus,
}
)
示例5: test_new_format_is_swap
def test_new_format_is_swap(self):
expected_results = [True, False, False, False, False]
for expected, bdm in zip(expected_results, self.new_mapping):
res = block_device.new_format_is_swap(bdm)
self.assertEqual(expected, res)