Lines Matching +full:drive +full:- +full:open +full:- +full:source

4 # Copyright 2017-2019 Red Hat Inc.
11 # the COPYING file in the top-level directory.
62 'block' : "-drive file={},if=none,id=drive0,cache=writeback "\
63 "-device virtio-blk,drive=drive0,bootindex=0",
64 'scsi' : "-device virtio-scsi-device,id=scsi "\
65 "-drive file={},format=raw,if=none,id=hd0 "\
66 "-device scsi-hd,drive=hd0,bootindex=0",
111 self._tmpdir = os.path.realpath(tempfile.mkdtemp(prefix="vm-test-",
118 open(self._config['ssh_key_file']).read().rstrip()
120 open(self._config['ssh_pub_key_file']).read().rstrip()
122 open(self._ssh_tmp_key_file, "w").write(self._config['ssh_key'])
126 open(self._ssh_tmp_pub_key_file,
133 os.path.join(os.path.expanduser("~/.cache/qemu-vm"),
136 self._devnull = open(os.devnull, "w")
141 netdev = "user,id=vnet,hostfwd=:127.0.0.1:{}-:22"
143 "-nodefaults", "-m", self._config['memory'],
144 "-cpu", self._config['cpu'],
145 "-netdev",
149 "-device", "virtio-net-pci,netdev=vnet",
150 "-vnc", "127.0.0.1:0,to=20"]
152 self._args += ["-smp", "%d" % args.jobs]
155 self._args += ["-enable-kvm"]
157 logging.info("KVM not available, not using -enable-kvm")
209 return sha256sum == checksum.decode("utf-8")
215 return sha512sum == checksum.decode("utf-8")
217 cache_dir = os.path.expanduser("~/.cache/qemu-vm/download")
221 hashlib.sha1(url.encode("utf-8")).hexdigest())
225 subprocess.check_call(["wget", "-c", url, "-O", fname + ".download"],
232 "-t",
233 "-o", "StrictHostKeyChecking=no",
234 "-o", "UserKnownHostsFile=" + os.devnull,
235 "-o",
237 "-p", str(self.ssh_port), "-i", self._ssh_tmp_key_file,
238 "-o", "IdentitiesOnly=yes"]
242 ssh_cmd.append("-q")
244 ssh_cmd += ['-o', "SendEnv=%s" % var ]
269 cmd = [os.environ.get("QEMU_IMG", "qemu-img")]
274 name = "data-" + hashlib.sha1(src_dir.encode("utf-8")).hexdigest()[:5]
277 subprocess.check_call(["./scripts/archive-source.sh", tarfile],
280 self._data_args += ["-drive",
283 "-device",
284 "virtio-blk,drive=%s,serial=%s,bootindex=1" % (name, name)]
315 usernet_info = guest.cmd("human-monitor-command",
328 vm._name + "-console.raw")
329 self.console_raw_file = open(self.console_raw_path, 'wb')
334 line = re.sub("\x1b\\[[0-9;?]*[a-zA-Z]", "", line)
335 line = re.sub("\x1b\\([0-9;?]*[a-zA-Z]", "", line)
338 line = re.sub("[\x00-\x1f]", ".", line)
339 line = re.sub("[\x80-\xff]", ".", line)
403 logline = re.sub("[\x00-\x1f]", ".", logline)
406 vm.console_socket.send(char.encode("utf-8"))
449 seconds = (endtime - datetime.datetime.now()).total_seconds()
470 mdata = open(os.path.join(cidir, "meta-data"), "w")
471 name = self.name.replace(".","-")
472 mdata.writelines(["instance-id: {}-vm-0\n".format(name),
473 "local-hostname: {}-guest\n".format(name)])
475 udata = open(os.path.join(cidir, "user-data"), "w")
478 udata.writelines(["#cloud-config\n",
486 " - name: %s\n" % self._config['guest_user'],
488 " ssh-authorized-keys:\n",
489 " - %s\n" % self._config['ssh_pub_key'],
490 " - name: root\n",
491 " ssh-authorized-keys:\n",
492 " - %s\n" % self._config['ssh_pub_key'],
493 "locale: en_US.UTF-8\n"])
499 subprocess.check_call([self._genisoimage, "-output", "cloud-init.iso",
500 "-volid", "cidata", "-joliet", "-rock",
501 "user-data", "meta-data"],
505 return os.path.join(cidir, "cloud-init.iso")
513 with open(json_path, "r") as fh:
523 qemu_path = os.path.join(build_path, arch + "-softmmu")
524 qemu_path = os.path.join(qemu_path, "qemu-system-" + arch)
527 qemu_path = "qemu-system-" + arch
533 output = subprocess.check_output([qemu_path, '--version'])
534 version_line = output.decode("utf-8")
558 print("The python3-yaml package is needed "\
563 with open(config_file) as f:
566 if 'qemu-conf' in yaml_dict:
567 config.update(yaml_dict['qemu-conf'])
570 " missing qemu-conf".format(config_file))
583 # can always override these limits with --jobs.
594 parser.add_argument("--debug", "-D", action="store_true",
596 parser.add_argument("--image", "-i", default="%s.img" % vmcls.name,
598 parser.add_argument("--force", "-f", action="store_true",
600 parser.add_argument("--jobs", type=int, default=get_default_jobs(),
602 parser.add_argument("--verbose", "-V", action="store_true",
604 parser.add_argument("--build-image", "-b", action="store_true",
606 parser.add_argument("--build-qemu",
607 help="build QEMU from source in guest")
608 parser.add_argument("--build-target",
610 parser.add_argument("--build-path", default=None,
613 parser.add_argument("--source-path", default=None,
614 help="Path of source directory, "\
616 parser.add_argument("--interactive", "-I", action="store_true",
618 parser.add_argument("--snapshot", "-s", action="store_true",
620 parser.add_argument("--genisoimage", default="genisoimage",
622 parser.add_argument("--config", "-c", default=None,
625 parser.add_argument("--efi-aarch64",
626 default="/usr/share/qemu-efi-aarch64/QEMU_EFI.fd",
628 parser.add_argument("--log-console", action="store_true",
631 commands after -- are passed to command inside the VM""")
650 "Use --force option to overwrite\n"])