annotate src/main.rs @ 11:9fac2c578228

...
author AnaTofuZ <anatofuz@gmail.com>
date Thu, 29 Oct 2020 09:44:38 +0900
parents 188bf8ab3e81
children 0df4d067badb
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
8
017344e337e8 use split_whitespace
AnaTofuZ <anatofuz@gmail.com>
parents: 7
diff changeset
1 use clap::Clap;
1
dba3414e8f7e get uid, gid, login_user
AnaTofuZ <anatofuz@gmail.com>
parents: 0
diff changeset
2 use nix;
3
5bdb02e05c86 show virsh list --all
AnaTofuZ <anatofuz@gmail.com>
parents: 2
diff changeset
3 use std::process::Command;
1
dba3414e8f7e get uid, gid, login_user
AnaTofuZ <anatofuz@gmail.com>
parents: 0
diff changeset
4
5
ef1358b993e1 mmm.....
AnaTofuZ <anatofuz@gmail.com>
parents: 4
diff changeset
5 #[derive(Clap)]
7
07b763b84401 rebarse use macro
AnaTofuZ <anatofuz@gmail.com>
parents: 6
diff changeset
6 #[clap(version = "1.0", author = "AnaTofuZ <anatofuz@cr.ie.u-ryukyu.ac.jp>")]
5
ef1358b993e1 mmm.....
AnaTofuZ <anatofuz@gmail.com>
parents: 4
diff changeset
7 struct Opts {
ef1358b993e1 mmm.....
AnaTofuZ <anatofuz@gmail.com>
parents: 4
diff changeset
8 #[clap(subcommand)]
ef1358b993e1 mmm.....
AnaTofuZ <anatofuz@gmail.com>
parents: 4
diff changeset
9 subcmd: SubCommand,
ef1358b993e1 mmm.....
AnaTofuZ <anatofuz@gmail.com>
parents: 4
diff changeset
10 }
ef1358b993e1 mmm.....
AnaTofuZ <anatofuz@gmail.com>
parents: 4
diff changeset
11
ef1358b993e1 mmm.....
AnaTofuZ <anatofuz@gmail.com>
parents: 4
diff changeset
12 #[derive(Clap)]
ef1358b993e1 mmm.....
AnaTofuZ <anatofuz@gmail.com>
parents: 4
diff changeset
13 enum SubCommand {
10
AnaTofuZ <anatofuz@gmail.com>
parents: 9
diff changeset
14 List(List),
AnaTofuZ <anatofuz@gmail.com>
parents: 9
diff changeset
15 Undefine(UnDefine),
AnaTofuZ <anatofuz@gmail.com>
parents: 9
diff changeset
16 Define(Define),
AnaTofuZ <anatofuz@gmail.com>
parents: 9
diff changeset
17 Shutdown(Shutdown),
AnaTofuZ <anatofuz@gmail.com>
parents: 9
diff changeset
18 Destroy(Destroy),
AnaTofuZ <anatofuz@gmail.com>
parents: 9
diff changeset
19 Console(Console),
AnaTofuZ <anatofuz@gmail.com>
parents: 9
diff changeset
20 Start(Start),
AnaTofuZ <anatofuz@gmail.com>
parents: 9
diff changeset
21 Ttyconsole(TTyConsole),
11
AnaTofuZ <anatofuz@gmail.com>
parents: 10
diff changeset
22 VNCDisplay(VNCDisplay)
AnaTofuZ <anatofuz@gmail.com>
parents: 10
diff changeset
23 //todo define-gdb dumpxml
5
ef1358b993e1 mmm.....
AnaTofuZ <anatofuz@gmail.com>
parents: 4
diff changeset
24 }
ef1358b993e1 mmm.....
AnaTofuZ <anatofuz@gmail.com>
parents: 4
diff changeset
25
7
07b763b84401 rebarse use macro
AnaTofuZ <anatofuz@gmail.com>
parents: 6
diff changeset
26 /// define (but don't start) a domain from an template XML file
5
ef1358b993e1 mmm.....
AnaTofuZ <anatofuz@gmail.com>
parents: 4
diff changeset
27 #[derive(Clap)]
ef1358b993e1 mmm.....
AnaTofuZ <anatofuz@gmail.com>
parents: 4
diff changeset
28 struct Define {
ef1358b993e1 mmm.....
AnaTofuZ <anatofuz@gmail.com>
parents: 4
diff changeset
29 name: String,
ef1358b993e1 mmm.....
AnaTofuZ <anatofuz@gmail.com>
parents: 4
diff changeset
30 }
ef1358b993e1 mmm.....
AnaTofuZ <anatofuz@gmail.com>
parents: 4
diff changeset
31
11
AnaTofuZ <anatofuz@gmail.com>
parents: 10
diff changeset
32 // vncdisplay
AnaTofuZ <anatofuz@gmail.com>
parents: 10
diff changeset
33 #[derive(Clap)]
AnaTofuZ <anatofuz@gmail.com>
parents: 10
diff changeset
34 struct VNCDisplay {
AnaTofuZ <anatofuz@gmail.com>
parents: 10
diff changeset
35 name_or_id: String,
AnaTofuZ <anatofuz@gmail.com>
parents: 10
diff changeset
36 }
AnaTofuZ <anatofuz@gmail.com>
parents: 10
diff changeset
37
10
AnaTofuZ <anatofuz@gmail.com>
parents: 9
diff changeset
38 /// undefine a domain
AnaTofuZ <anatofuz@gmail.com>
parents: 9
diff changeset
39 #[derive(Clap)]
AnaTofuZ <anatofuz@gmail.com>
parents: 9
diff changeset
40 struct UnDefine {
AnaTofuZ <anatofuz@gmail.com>
parents: 9
diff changeset
41 name: String,
AnaTofuZ <anatofuz@gmail.com>
parents: 9
diff changeset
42 }
AnaTofuZ <anatofuz@gmail.com>
parents: 9
diff changeset
43
AnaTofuZ <anatofuz@gmail.com>
parents: 9
diff changeset
44 /// start a (previously defined) inactive domain
AnaTofuZ <anatofuz@gmail.com>
parents: 9
diff changeset
45 #[derive(Clap)]
AnaTofuZ <anatofuz@gmail.com>
parents: 9
diff changeset
46 struct Start {
AnaTofuZ <anatofuz@gmail.com>
parents: 9
diff changeset
47 name: String,
AnaTofuZ <anatofuz@gmail.com>
parents: 9
diff changeset
48 }
AnaTofuZ <anatofuz@gmail.com>
parents: 9
diff changeset
49
AnaTofuZ <anatofuz@gmail.com>
parents: 9
diff changeset
50 /// tty console
AnaTofuZ <anatofuz@gmail.com>
parents: 9
diff changeset
51 #[derive(Clap)]
AnaTofuZ <anatofuz@gmail.com>
parents: 9
diff changeset
52 struct TTyConsole {
AnaTofuZ <anatofuz@gmail.com>
parents: 9
diff changeset
53 name_or_id: String,
AnaTofuZ <anatofuz@gmail.com>
parents: 9
diff changeset
54 }
AnaTofuZ <anatofuz@gmail.com>
parents: 9
diff changeset
55
7
07b763b84401 rebarse use macro
AnaTofuZ <anatofuz@gmail.com>
parents: 6
diff changeset
56 /// gracefully shutdown a domain
5
ef1358b993e1 mmm.....
AnaTofuZ <anatofuz@gmail.com>
parents: 4
diff changeset
57 #[derive(Clap)]
ef1358b993e1 mmm.....
AnaTofuZ <anatofuz@gmail.com>
parents: 4
diff changeset
58 struct Shutdown {
ef1358b993e1 mmm.....
AnaTofuZ <anatofuz@gmail.com>
parents: 4
diff changeset
59 name: String,
ef1358b993e1 mmm.....
AnaTofuZ <anatofuz@gmail.com>
parents: 4
diff changeset
60 }
ef1358b993e1 mmm.....
AnaTofuZ <anatofuz@gmail.com>
parents: 4
diff changeset
61
7
07b763b84401 rebarse use macro
AnaTofuZ <anatofuz@gmail.com>
parents: 6
diff changeset
62 /// list domains
07b763b84401 rebarse use macro
AnaTofuZ <anatofuz@gmail.com>
parents: 6
diff changeset
63 #[derive(Clap)]
07b763b84401 rebarse use macro
AnaTofuZ <anatofuz@gmail.com>
parents: 6
diff changeset
64 struct List {}
07b763b84401 rebarse use macro
AnaTofuZ <anatofuz@gmail.com>
parents: 6
diff changeset
65
10
AnaTofuZ <anatofuz@gmail.com>
parents: 9
diff changeset
66 /// destroy (stop) a domain
AnaTofuZ <anatofuz@gmail.com>
parents: 9
diff changeset
67 #[derive(Clap)]
AnaTofuZ <anatofuz@gmail.com>
parents: 9
diff changeset
68 struct Destroy {
AnaTofuZ <anatofuz@gmail.com>
parents: 9
diff changeset
69 name: String,
AnaTofuZ <anatofuz@gmail.com>
parents: 9
diff changeset
70 }
AnaTofuZ <anatofuz@gmail.com>
parents: 9
diff changeset
71
AnaTofuZ <anatofuz@gmail.com>
parents: 9
diff changeset
72 /// connect to the guest console
AnaTofuZ <anatofuz@gmail.com>
parents: 9
diff changeset
73 #[derive(Clap)]
AnaTofuZ <anatofuz@gmail.com>
parents: 9
diff changeset
74 struct Console {
AnaTofuZ <anatofuz@gmail.com>
parents: 9
diff changeset
75 name_or_id: String,
AnaTofuZ <anatofuz@gmail.com>
parents: 9
diff changeset
76 }
AnaTofuZ <anatofuz@gmail.com>
parents: 9
diff changeset
77
AnaTofuZ <anatofuz@gmail.com>
parents: 9
diff changeset
78 struct ListDumpMsg {
7
07b763b84401 rebarse use macro
AnaTofuZ <anatofuz@gmail.com>
parents: 6
diff changeset
79 info_msg: String,
07b763b84401 rebarse use macro
AnaTofuZ <anatofuz@gmail.com>
parents: 6
diff changeset
80 border_line: String,
07b763b84401 rebarse use macro
AnaTofuZ <anatofuz@gmail.com>
parents: 6
diff changeset
81 }
07b763b84401 rebarse use macro
AnaTofuZ <anatofuz@gmail.com>
parents: 6
diff changeset
82
5
ef1358b993e1 mmm.....
AnaTofuZ <anatofuz@gmail.com>
parents: 4
diff changeset
83 struct VM {
ef1358b993e1 mmm.....
AnaTofuZ <anatofuz@gmail.com>
parents: 4
diff changeset
84 id: u32,
ef1358b993e1 mmm.....
AnaTofuZ <anatofuz@gmail.com>
parents: 4
diff changeset
85 name: String,
ef1358b993e1 mmm.....
AnaTofuZ <anatofuz@gmail.com>
parents: 4
diff changeset
86 is_vm_running: bool,
ef1358b993e1 mmm.....
AnaTofuZ <anatofuz@gmail.com>
parents: 4
diff changeset
87 }
ef1358b993e1 mmm.....
AnaTofuZ <anatofuz@gmail.com>
parents: 4
diff changeset
88
0
3ef828bc5261 cargo new
AnaTofuZ <anatofuz@gmail.com>
parents:
diff changeset
89 fn main() {
7
07b763b84401 rebarse use macro
AnaTofuZ <anatofuz@gmail.com>
parents: 6
diff changeset
90 let opts: Opts = Opts::parse();
07b763b84401 rebarse use macro
AnaTofuZ <anatofuz@gmail.com>
parents: 6
diff changeset
91
4
668a91cd7be8 impl virsh list --all filter
AnaTofuZ <anatofuz@gmail.com>
parents: 3
diff changeset
92 let uid = getuid();
668a91cd7be8 impl virsh list --all filter
AnaTofuZ <anatofuz@gmail.com>
parents: 3
diff changeset
93 let gid = getgid();
3
5bdb02e05c86 show virsh list --all
AnaTofuZ <anatofuz@gmail.com>
parents: 2
diff changeset
94 let user_name = getlogin(uid);
5bdb02e05c86 show virsh list --all
AnaTofuZ <anatofuz@gmail.com>
parents: 2
diff changeset
95 println!("uid: {} gid: {} name: {}", uid, gid, user_name);
5
ef1358b993e1 mmm.....
AnaTofuZ <anatofuz@gmail.com>
parents: 4
diff changeset
96
7
07b763b84401 rebarse use macro
AnaTofuZ <anatofuz@gmail.com>
parents: 6
diff changeset
97 match opts.subcmd {
10
AnaTofuZ <anatofuz@gmail.com>
parents: 9
diff changeset
98 SubCommand::List(_) => {
7
07b763b84401 rebarse use macro
AnaTofuZ <anatofuz@gmail.com>
parents: 6
diff changeset
99 set_root_id();
9
b89466455757 not parse when executing the list command
AnaTofuZ <anatofuz@gmail.com>
parents: 8
diff changeset
100 let (ldump_msg, vm_list_strs) = list_command(user_name);
b89466455757 not parse when executing the list command
AnaTofuZ <anatofuz@gmail.com>
parents: 8
diff changeset
101 println!("{}\n{}", ldump_msg.info_msg, ldump_msg.border_line);
b89466455757 not parse when executing the list command
AnaTofuZ <anatofuz@gmail.com>
parents: 8
diff changeset
102 for vm_info in vm_list_strs {
b89466455757 not parse when executing the list command
AnaTofuZ <anatofuz@gmail.com>
parents: 8
diff changeset
103 println!("{}", vm_info);
7
07b763b84401 rebarse use macro
AnaTofuZ <anatofuz@gmail.com>
parents: 6
diff changeset
104 }
5
ef1358b993e1 mmm.....
AnaTofuZ <anatofuz@gmail.com>
parents: 4
diff changeset
105 }
10
AnaTofuZ <anatofuz@gmail.com>
parents: 9
diff changeset
106 SubCommand::Define(name) => {}
AnaTofuZ <anatofuz@gmail.com>
parents: 9
diff changeset
107 SubCommand::Shutdown(name) => {}
AnaTofuZ <anatofuz@gmail.com>
parents: 9
diff changeset
108 SubCommand::Console(name) => {}
AnaTofuZ <anatofuz@gmail.com>
parents: 9
diff changeset
109
AnaTofuZ <anatofuz@gmail.com>
parents: 9
diff changeset
110 SubCommand::Destroy(name_or_id) => {}
AnaTofuZ <anatofuz@gmail.com>
parents: 9
diff changeset
111 _ => {}
5
ef1358b993e1 mmm.....
AnaTofuZ <anatofuz@gmail.com>
parents: 4
diff changeset
112 }
ef1358b993e1 mmm.....
AnaTofuZ <anatofuz@gmail.com>
parents: 4
diff changeset
113
ef1358b993e1 mmm.....
AnaTofuZ <anatofuz@gmail.com>
parents: 4
diff changeset
114 //set_root_id();
ef1358b993e1 mmm.....
AnaTofuZ <anatofuz@gmail.com>
parents: 4
diff changeset
115 //list_command(user_name);
0
3ef828bc5261 cargo new
AnaTofuZ <anatofuz@gmail.com>
parents:
diff changeset
116 }
1
dba3414e8f7e get uid, gid, login_user
AnaTofuZ <anatofuz@gmail.com>
parents: 0
diff changeset
117
2
1632a34a3f6c fix function name
AnaTofuZ <anatofuz@gmail.com>
parents: 1
diff changeset
118 fn getlogin(uid: u32) -> &'static str {
1632a34a3f6c fix function name
AnaTofuZ <anatofuz@gmail.com>
parents: 1
diff changeset
119 use std::ffi::CStr;
4
668a91cd7be8 impl virsh list --all filter
AnaTofuZ <anatofuz@gmail.com>
parents: 3
diff changeset
120 let user_passwd = unsafe { nix::libc::getpwuid(uid) };
668a91cd7be8 impl virsh list --all filter
AnaTofuZ <anatofuz@gmail.com>
parents: 3
diff changeset
121 let c_str = unsafe { CStr::from_ptr((*user_passwd).pw_name) };
1
dba3414e8f7e get uid, gid, login_user
AnaTofuZ <anatofuz@gmail.com>
parents: 0
diff changeset
122 return c_str.to_str().unwrap();
dba3414e8f7e get uid, gid, login_user
AnaTofuZ <anatofuz@gmail.com>
parents: 0
diff changeset
123 }
dba3414e8f7e get uid, gid, login_user
AnaTofuZ <anatofuz@gmail.com>
parents: 0
diff changeset
124
dba3414e8f7e get uid, gid, login_user
AnaTofuZ <anatofuz@gmail.com>
parents: 0
diff changeset
125 fn getuid() -> u32 {
dba3414e8f7e get uid, gid, login_user
AnaTofuZ <anatofuz@gmail.com>
parents: 0
diff changeset
126 let uid_struct = nix::unistd::getuid();
3
5bdb02e05c86 show virsh list --all
AnaTofuZ <anatofuz@gmail.com>
parents: 2
diff changeset
127 return uid_struct.into();
1
dba3414e8f7e get uid, gid, login_user
AnaTofuZ <anatofuz@gmail.com>
parents: 0
diff changeset
128 }
dba3414e8f7e get uid, gid, login_user
AnaTofuZ <anatofuz@gmail.com>
parents: 0
diff changeset
129
dba3414e8f7e get uid, gid, login_user
AnaTofuZ <anatofuz@gmail.com>
parents: 0
diff changeset
130 fn getgid() -> u32 {
dba3414e8f7e get uid, gid, login_user
AnaTofuZ <anatofuz@gmail.com>
parents: 0
diff changeset
131 let gid_struct = nix::unistd::getgid();
3
5bdb02e05c86 show virsh list --all
AnaTofuZ <anatofuz@gmail.com>
parents: 2
diff changeset
132 return gid_struct.into();
5bdb02e05c86 show virsh list --all
AnaTofuZ <anatofuz@gmail.com>
parents: 2
diff changeset
133 }
5bdb02e05c86 show virsh list --all
AnaTofuZ <anatofuz@gmail.com>
parents: 2
diff changeset
134
10
AnaTofuZ <anatofuz@gmail.com>
parents: 9
diff changeset
135 fn list_command(user_name: &'static str) -> (ListDumpMsg, Vec<String>) {
4
668a91cd7be8 impl virsh list --all filter
AnaTofuZ <anatofuz@gmail.com>
parents: 3
diff changeset
136 let output = Command::new("virsh")
668a91cd7be8 impl virsh list --all filter
AnaTofuZ <anatofuz@gmail.com>
parents: 3
diff changeset
137 .arg("list")
668a91cd7be8 impl virsh list --all filter
AnaTofuZ <anatofuz@gmail.com>
parents: 3
diff changeset
138 .arg("--all")
668a91cd7be8 impl virsh list --all filter
AnaTofuZ <anatofuz@gmail.com>
parents: 3
diff changeset
139 .output()
668a91cd7be8 impl virsh list --all filter
AnaTofuZ <anatofuz@gmail.com>
parents: 3
diff changeset
140 .expect("failed to virsh");
668a91cd7be8 impl virsh list --all filter
AnaTofuZ <anatofuz@gmail.com>
parents: 3
diff changeset
141 let virsh_list = String::from_utf8_lossy(&output.stdout);
668a91cd7be8 impl virsh list --all filter
AnaTofuZ <anatofuz@gmail.com>
parents: 3
diff changeset
142 let mut virsh_list = virsh_list.split("\n");
7
07b763b84401 rebarse use macro
AnaTofuZ <anatofuz@gmail.com>
parents: 6
diff changeset
143
4
668a91cd7be8 impl virsh list --all filter
AnaTofuZ <anatofuz@gmail.com>
parents: 3
diff changeset
144 let info_msg = virsh_list.next().unwrap();
668a91cd7be8 impl virsh list --all filter
AnaTofuZ <anatofuz@gmail.com>
parents: 3
diff changeset
145 let border_line = virsh_list.next().unwrap();
10
AnaTofuZ <anatofuz@gmail.com>
parents: 9
diff changeset
146 let ldump_msg = ListDumpMsg {
7
07b763b84401 rebarse use macro
AnaTofuZ <anatofuz@gmail.com>
parents: 6
diff changeset
147 info_msg: String::from(info_msg),
07b763b84401 rebarse use macro
AnaTofuZ <anatofuz@gmail.com>
parents: 6
diff changeset
148 border_line: String::from(border_line),
07b763b84401 rebarse use macro
AnaTofuZ <anatofuz@gmail.com>
parents: 6
diff changeset
149 };
4
668a91cd7be8 impl virsh list --all filter
AnaTofuZ <anatofuz@gmail.com>
parents: 3
diff changeset
150
9
b89466455757 not parse when executing the list command
AnaTofuZ <anatofuz@gmail.com>
parents: 8
diff changeset
151 return (
b89466455757 not parse when executing the list command
AnaTofuZ <anatofuz@gmail.com>
parents: 8
diff changeset
152 ldump_msg,
b89466455757 not parse when executing the list command
AnaTofuZ <anatofuz@gmail.com>
parents: 8
diff changeset
153 virsh_list
b89466455757 not parse when executing the list command
AnaTofuZ <anatofuz@gmail.com>
parents: 8
diff changeset
154 .filter(|&x| x.contains(user_name))
b89466455757 not parse when executing the list command
AnaTofuZ <anatofuz@gmail.com>
parents: 8
diff changeset
155 .map(|x| x.to_string())
b89466455757 not parse when executing the list command
AnaTofuZ <anatofuz@gmail.com>
parents: 8
diff changeset
156 .collect(),
b89466455757 not parse when executing the list command
AnaTofuZ <anatofuz@gmail.com>
parents: 8
diff changeset
157 );
1
dba3414e8f7e get uid, gid, login_user
AnaTofuZ <anatofuz@gmail.com>
parents: 0
diff changeset
158 }
3
5bdb02e05c86 show virsh list --all
AnaTofuZ <anatofuz@gmail.com>
parents: 2
diff changeset
159
4
668a91cd7be8 impl virsh list --all filter
AnaTofuZ <anatofuz@gmail.com>
parents: 3
diff changeset
160 fn set_root_id() {
3
5bdb02e05c86 show virsh list --all
AnaTofuZ <anatofuz@gmail.com>
parents: 2
diff changeset
161 let id = 0;
5bdb02e05c86 show virsh list --all
AnaTofuZ <anatofuz@gmail.com>
parents: 2
diff changeset
162 match nix::unistd::seteuid(nix::unistd::Uid::from_raw(id)) {
5bdb02e05c86 show virsh list --all
AnaTofuZ <anatofuz@gmail.com>
parents: 2
diff changeset
163 Err(err) => panic!("failed seteuid {}", err),
5bdb02e05c86 show virsh list --all
AnaTofuZ <anatofuz@gmail.com>
parents: 2
diff changeset
164 Ok(_) => {}
5bdb02e05c86 show virsh list --all
AnaTofuZ <anatofuz@gmail.com>
parents: 2
diff changeset
165 }
5bdb02e05c86 show virsh list --all
AnaTofuZ <anatofuz@gmail.com>
parents: 2
diff changeset
166 match nix::unistd::setegid(nix::unistd::Gid::from_raw(id)) {
5bdb02e05c86 show virsh list --all
AnaTofuZ <anatofuz@gmail.com>
parents: 2
diff changeset
167 Err(err) => panic!("failed setedid{}", err),
5bdb02e05c86 show virsh list --all
AnaTofuZ <anatofuz@gmail.com>
parents: 2
diff changeset
168 Ok(_) => {}
5bdb02e05c86 show virsh list --all
AnaTofuZ <anatofuz@gmail.com>
parents: 2
diff changeset
169 }
5bdb02e05c86 show virsh list --all
AnaTofuZ <anatofuz@gmail.com>
parents: 2
diff changeset
170
5bdb02e05c86 show virsh list --all
AnaTofuZ <anatofuz@gmail.com>
parents: 2
diff changeset
171 match nix::unistd::setuid(nix::unistd::Uid::from_raw(id)) {
5bdb02e05c86 show virsh list --all
AnaTofuZ <anatofuz@gmail.com>
parents: 2
diff changeset
172 Err(err) => panic!("failed setuid {}", err),
5bdb02e05c86 show virsh list --all
AnaTofuZ <anatofuz@gmail.com>
parents: 2
diff changeset
173 Ok(_) => {}
5bdb02e05c86 show virsh list --all
AnaTofuZ <anatofuz@gmail.com>
parents: 2
diff changeset
174 }
5bdb02e05c86 show virsh list --all
AnaTofuZ <anatofuz@gmail.com>
parents: 2
diff changeset
175
5bdb02e05c86 show virsh list --all
AnaTofuZ <anatofuz@gmail.com>
parents: 2
diff changeset
176 match nix::unistd::setgid(nix::unistd::Gid::from_raw(id)) {
5bdb02e05c86 show virsh list --all
AnaTofuZ <anatofuz@gmail.com>
parents: 2
diff changeset
177 Err(err) => panic!("failed setdid{}", err),
5bdb02e05c86 show virsh list --all
AnaTofuZ <anatofuz@gmail.com>
parents: 2
diff changeset
178 Ok(_) => {}
5bdb02e05c86 show virsh list --all
AnaTofuZ <anatofuz@gmail.com>
parents: 2
diff changeset
179 }
4
668a91cd7be8 impl virsh list --all filter
AnaTofuZ <anatofuz@gmail.com>
parents: 3
diff changeset
180 }
5
ef1358b993e1 mmm.....
AnaTofuZ <anatofuz@gmail.com>
parents: 4
diff changeset
181
6
08247e54d78d cargo fmt
AnaTofuZ <anatofuz@gmail.com>
parents: 5
diff changeset
182 fn create_new_vm(user_name: &'static str, vm_name: &'static str, debug_kernel: bool) {}