Mercurial > hg > Members > anatofuz > ie-virsh
comparison src/main.rs @ 17:5477c26e6984
impl sub commands that use uid
author | AnaTofuZ <k198584@ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 02 Nov 2020 16:09:53 +0900 |
parents | 56e9763abeef |
children | 9b24d6767a2f |
comparison
equal
deleted
inserted
replaced
16:1da4937628be | 17:5477c26e6984 |
---|---|
16 Shutdown(Shutdown), | 16 Shutdown(Shutdown), |
17 Destroy(Destroy), | 17 Destroy(Destroy), |
18 Console(Console), | 18 Console(Console), |
19 Start(Start), | 19 Start(Start), |
20 Ttyconsole(TTyConsole), | 20 Ttyconsole(TTyConsole), |
21 VNCDisplay(VNCDisplay), //todo define-gdb dumpxml | 21 VNCDisplay(VNCDisplay), |
22 DumpXML(DumpXML), | |
23 DefineGDB(DefineGDB), | |
24 } | |
25 | |
26 /// define the domain in which the gdb port is opened from the template XML file | |
27 #[derive(Clap)] | |
28 struct DefineGDB { | |
29 name: String, | |
22 } | 30 } |
23 | 31 |
24 /// define (but don't start) a domain from an template XML file | 32 /// define (but don't start) a domain from an template XML file |
25 #[derive(Clap)] | 33 #[derive(Clap)] |
26 struct Define { | 34 struct Define { |
27 name: String, | 35 name: String, |
28 } | 36 } |
29 | 37 |
30 // vncdisplay | 38 /// domain information in XML |
39 #[derive(Clap)] | |
40 struct DumpXML { | |
41 name_or_id: String, | |
42 } | |
43 | |
44 /// vncdisplay | |
31 #[derive(Clap)] | 45 #[derive(Clap)] |
32 struct VNCDisplay { | 46 struct VNCDisplay { |
33 name_or_id: String, | 47 name: String, |
34 } | 48 } |
35 | 49 |
36 /// undefine a domain | 50 /// undefine a domain |
37 #[derive(Clap)] | 51 #[derive(Clap)] |
38 struct UnDefine { | 52 struct UnDefine { |
46 } | 60 } |
47 | 61 |
48 /// tty console | 62 /// tty console |
49 #[derive(Clap)] | 63 #[derive(Clap)] |
50 struct TTyConsole { | 64 struct TTyConsole { |
51 name_or_id: String, | 65 name: String, |
52 } | 66 } |
53 | 67 |
54 /// gracefully shutdown a domain | 68 /// gracefully shutdown a domain |
55 #[derive(Clap)] | 69 #[derive(Clap)] |
56 struct Shutdown { | 70 struct Shutdown { |
68 } | 82 } |
69 | 83 |
70 /// connect to the guest console | 84 /// connect to the guest console |
71 #[derive(Clap)] | 85 #[derive(Clap)] |
72 struct Console { | 86 struct Console { |
73 name_or_id: String, | 87 name: String, |
74 } | 88 } |
75 | 89 |
76 /* | 90 /* |
77 struct VM { | 91 struct VM { |
78 id: u32, | 92 id: u32, |
90 println!("uid: {} gid: {} name: {}", uid, gid, user_name); | 104 println!("uid: {} gid: {} name: {}", uid, gid, user_name); |
91 | 105 |
92 match opts.subcmd { | 106 match opts.subcmd { |
93 SubCommand::List(_) => { | 107 SubCommand::List(_) => { |
94 user::set_root_id(); | 108 user::set_root_id(); |
95 command::list_command(user_name); | 109 command::list(user_name); |
96 } | 110 } |
111 | |
97 SubCommand::Start(arg) => { | 112 SubCommand::Start(arg) => { |
98 user::set_root_id(); | 113 user::set_root_id(); |
99 command::start_command(user_name, arg.name); | 114 command::start(user_name, arg.name); |
100 } | 115 } |
101 SubCommand::Define(name) => {} | 116 SubCommand::Define(name) => {} |
102 SubCommand::Shutdown(name) => {} | 117 |
103 SubCommand::Console(name) => {} | 118 SubCommand::Shutdown(arg) => { |
104 SubCommand::Destroy(name_or_id) => {} | 119 user::set_root_id(); |
120 command::shutdown(user_name, arg.name); | |
121 } | |
122 | |
123 SubCommand::Console(arg) => { | |
124 user::set_root_id(); | |
125 command::console(user_name, arg.name); | |
126 } | |
127 | |
128 SubCommand::Destroy(arg) => { | |
129 user::set_root_id(); | |
130 command::destroy(user_name, arg.name); | |
131 } | |
132 | |
133 SubCommand::VNCDisplay(arg) => { | |
134 user::set_root_id(); | |
135 command::vncdisplay(user_name, arg.name); | |
136 } | |
137 | |
105 _ => {} | 138 _ => {} |
106 } | 139 } |
107 | 140 |
108 //set_root_id(); | 141 //set_root_id(); |
109 //list_command(user_name); | 142 //list_command(user_name); |