本文整理汇总了Python中gns3server.compute.qemu.Qemu.img_binary_list方法的典型用法代码示例。如果您正苦于以下问题:Python Qemu.img_binary_list方法的具体用法?Python Qemu.img_binary_list怎么用?Python Qemu.img_binary_list使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gns3server.compute.qemu.Qemu
的用法示例。
在下文中一共展示了Qemu.img_binary_list方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_img_binary_list
# 需要导入模块: from gns3server.compute.qemu import Qemu [as 别名]
# 或者: from gns3server.compute.qemu.Qemu import img_binary_list [as 别名]
def test_img_binary_list(loop):
files_to_create = ["qemu-img", "qemu-io", "qemu-system-x86", "qemu-system-x42", "qemu-kvm", "hello"]
for file_to_create in files_to_create:
path = os.path.join(os.environ["PATH"], file_to_create)
with open(path, "w+") as f:
f.write("1")
os.chmod(path, stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR)
with asyncio_patch("gns3server.compute.qemu.subprocess_check_output", return_value="qemu-img version 2.2.0, Copyright (c) 2004-2008 Fabrice Bellard") as mock:
qemus = loop.run_until_complete(asyncio.async(Qemu.img_binary_list()))
version = "2.2.0"
assert {"path": os.path.join(os.environ["PATH"], "qemu-img"), "version": version} in qemus
assert {"path": os.path.join(os.environ["PATH"], "qemu-io"), "version": version} not in qemus
assert {"path": os.path.join(os.environ["PATH"], "qemu-system-x86"), "version": version} not in qemus
assert {"path": os.path.join(os.environ["PATH"], "qemu-kvm"), "version": version} not in qemus
assert {"path": os.path.join(os.environ["PATH"], "qemu-system-x42"), "version": version} not in qemus
assert {"path": os.path.join(os.environ["PATH"], "hello"), "version": version} not in qemus
示例2: list_img_binaries
# 需要导入模块: from gns3server.compute.qemu import Qemu [as 别名]
# 或者: from gns3server.compute.qemu.Qemu import img_binary_list [as 别名]
def list_img_binaries(request, response):
binaries = yield from Qemu.img_binary_list()
response.json(binaries)