Mercurial > hg > Members > anatofuz > ie-virsh
diff 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 |
line wrap: on
line diff
--- a/src/main.rs Sun Nov 01 14:02:35 2020 +0900 +++ b/src/main.rs Mon Nov 02 16:09:53 2020 +0900 @@ -18,7 +18,15 @@ Console(Console), Start(Start), Ttyconsole(TTyConsole), - VNCDisplay(VNCDisplay), //todo define-gdb dumpxml + VNCDisplay(VNCDisplay), + DumpXML(DumpXML), + DefineGDB(DefineGDB), +} + +/// define the domain in which the gdb port is opened from the template XML file +#[derive(Clap)] +struct DefineGDB { + name: String, } /// define (but don't start) a domain from an template XML file @@ -27,10 +35,16 @@ name: String, } -// vncdisplay +/// domain information in XML +#[derive(Clap)] +struct DumpXML { + name_or_id: String, +} + +/// vncdisplay #[derive(Clap)] struct VNCDisplay { - name_or_id: String, + name: String, } /// undefine a domain @@ -48,7 +62,7 @@ /// tty console #[derive(Clap)] struct TTyConsole { - name_or_id: String, + name: String, } /// gracefully shutdown a domain @@ -70,7 +84,7 @@ /// connect to the guest console #[derive(Clap)] struct Console { - name_or_id: String, + name: String, } /* @@ -92,16 +106,35 @@ match opts.subcmd { SubCommand::List(_) => { user::set_root_id(); - command::list_command(user_name); + command::list(user_name); } + SubCommand::Start(arg) => { user::set_root_id(); - command::start_command(user_name, arg.name); + command::start(user_name, arg.name); } SubCommand::Define(name) => {} - SubCommand::Shutdown(name) => {} - SubCommand::Console(name) => {} - SubCommand::Destroy(name_or_id) => {} + + SubCommand::Shutdown(arg) => { + user::set_root_id(); + command::shutdown(user_name, arg.name); + } + + SubCommand::Console(arg) => { + user::set_root_id(); + command::console(user_name, arg.name); + } + + SubCommand::Destroy(arg) => { + user::set_root_id(); + command::destroy(user_name, arg.name); + } + + SubCommand::VNCDisplay(arg) => { + user::set_root_id(); + command::vncdisplay(user_name, arg.name); + } + _ => {} }