本文整理汇总了Python中subprocess.Popen.qmp方法的典型用法代码示例。如果您正苦于以下问题:Python Popen.qmp方法的具体用法?Python Popen.qmp怎么用?Python Popen.qmp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类subprocess.Popen
的用法示例。
在下文中一共展示了Popen.qmp方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: start_qemu
# 需要导入模块: from subprocess import Popen [as 别名]
# 或者: from subprocess.Popen import qmp [as 别名]
def start_qemu(qemu_exec, image, spice_port, qmp_filename, incoming_port=None, extra_args=[]):
incoming_args = []
if incoming_port:
incoming_args = ("-incoming tcp::%s" % incoming_port).split()
args = ([qemu_exec, "-qmp", "unix:%s,server,nowait" % qmp_filename,
"-spice", "disable-ticketing,port=%s" % spice_port]
+ incoming_args + extra_args)
if os.path.exists(image):
args += ["-m", "512", "-drive",
"file=%s,index=0,media=disk,cache=unsafe" % image, "-snapshot"]
proc = Popen(args, executable=qemu_exec, stdin=PIPE, stdout=PIPE)
while not os.path.exists(qmp_filename):
time.sleep(0.1)
proc.qmp_filename = qmp_filename
proc.qmp = qmp.QEMUMonitorProtocol(qmp_filename)
while True:
try:
proc.qmp.connect()
break
except socket.error, err:
pass