def create_startcommand(args: Dict[str, str]) -> StartCommand: rootlog.warning( "Using legacy create_startcommand()," "please use proper nix test vm instrumentation, instead" "to generate the appropriate nixos test vm qemu startup script") hda = None if args.get("hda"): hda_arg: str = args.get("hda", "") hda_arg_path: Path = Path(hda_arg) hda = (hda_arg_path, args.get("hdaInterface", "")) return LegacyStartCommand( netBackendArgs=args.get("netBackendArgs"), netFrontendArgs=args.get("netFrontendArgs"), hda=hda, cdrom=args.get("cdrom"), usb=args.get("usb"), bios=args.get("bios"), qemuFlags=args.get("qemuFlags"), )
def create_machine(self, args: Dict[str, Any]) -> Machine: rootlog.warning("Using legacy create_machine(), please instantiate the" "Machine class directly, instead") tmp_dir = Path(os.environ.get("TMPDIR", tempfile.gettempdir())) tmp_dir.mkdir(mode=0o700, exist_ok=True) if args.get("startCommand"): start_command: str = args.get("startCommand", "") cmd = NixStartScript(start_command) name = args.get("name", cmd.machine_name) else: cmd = Machine.create_startcommand(args) # type: ignore name = args.get("name", "machine") return Machine( tmp_dir=tmp_dir, start_command=cmd, name=name, keep_vm_state=args.get("keep_vm_state", False), allow_reboot=args.get("allow_reboot", False), )
def create_machine(self, args: Dict[str, Any]) -> Machine: rootlog.warning("Using legacy create_machine(), please instantiate the" "Machine class directly, instead") tmp_dir = get_tmp_dir() if args.get("startCommand"): start_command: str = args.get("startCommand", "") cmd = NixStartScript(start_command) name = args.get("name", cmd.machine_name) else: cmd = Machine.create_startcommand(args) # type: ignore name = args.get("name", "machine") return Machine( tmp_dir=tmp_dir, out_dir=self.out_dir, start_command=cmd, name=name, keep_vm_state=args.get("keep_vm_state", False), allow_reboot=args.get("allow_reboot", False), )