diff src/virsh.rs @ 13:56e9763abeef

define start cmd
author AnaTofuZ <k198584@ie.u-ryukyu.ac.jp>
date Thu, 29 Oct 2020 17:12:09 +0900
parents 0df4d067badb
children e6dc51066703
line wrap: on
line diff
--- a/src/virsh.rs	Thu Oct 29 16:15:52 2020 +0900
+++ b/src/virsh.rs	Thu Oct 29 17:12:09 2020 +0900
@@ -1,3 +1,4 @@
+use std::io::{self, Write};
 use std::process::Command;
 
 pub struct ListDumpMsg {
@@ -29,3 +30,14 @@
             .collect(),
     );
 }
+
+pub fn start_vm(vm_name: String) {
+    let output = Command::new("virsh")
+        .arg("start")
+        .arg(vm_name)
+        .output()
+        .expect("failed to start vm");
+
+    io::stdout().write_all(&output.stdout).unwrap();
+    io::stderr().write_all(&output.stderr).unwrap();
+}