diff src/command.rs @ 61:b6e9e473678c

fix console cmd
author AnaTofuZ <anatofuz@gmail.com>
date Fri, 27 Nov 2020 20:20:01 +0900 (2020-11-27)
parents d6ef7ea91ff4
children aefbef761450
line wrap: on
line diff
--- a/src/command.rs	Tue Nov 24 22:09:11 2020 +0900
+++ b/src/command.rs	Fri Nov 27 20:20:01 2020 +0900
@@ -29,7 +29,7 @@
     let vm_name = generate_vm_name(&user_detail.user.name, &vm_name);
     let builder = xml::Builder::new(&user_detail, &vm_name).finalize();
     if let Ok(xml_path) = builder.generate() {
-        virsh::command_require_vm_name(&xml_path, "define")
+        virsh::subshell_virsh_command(&xml_path, "define")
     }
 }
 
@@ -55,21 +55,21 @@
         }
     };
     virsh::generate_qemu_from_template(RENTAL_DIR, &vm_name, &backing_path);
-    virsh::command_require_vm_name(&xml_path, "define");
+    virsh::subshell_virsh_command(&xml_path, "define");
 }
 
 pub fn start(user_name: &str, vm_name: &str) {
-    virsh::command_require_vm_name(&get_vm_name(user_name, vm_name), "start");
+    virsh::subshell_virsh_command(&get_vm_name(user_name, vm_name), "start");
 }
 
 pub fn common(user_name: &str, vm_name: &str, command: &str) {
     let vm_name = exec_cmd_from_name_or_id(user_name, vm_name);
-    virsh::command_require_vm_name(&vm_name, command);
+    virsh::subshell_virsh_command(&vm_name, command);
 }
 
 pub fn console(user_name: &str, vm_name: &str) {
     let vm_name = exec_cmd_from_name_or_id(user_name, vm_name);
-    virsh::exec_virsh_console(&vm_name);
+    virsh::exec_virsh_command(&vm_name, "console");
 }
 
 pub fn dumpvncpasswd(_user_name: &str, _vm_name: &str) {}