Commit f452410c authored by Heinz N. Gies's avatar Heinz N. Gies

Extract umount_devfs into own function closes #47

parent 892b6b01
Pipeline #12321200 passed with stage
in 3 minutes and 52 seconds
[root]
name = "vmadm"
version = "0.2.0"
version = "0.2.1"
dependencies = [
"aud 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
"bzip2 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
......
......@@ -93,18 +93,7 @@ impl<'a> Jail<'a> {
Ok(0)
}
/// stops a jail
pub fn stop(&self) -> Result<i32, Box<Error>> {
debug!("Dleting jail"; "vm" => self.idx.uuid.hyphenated().to_string());
let output = Command::new(JAIL)
.args(&["-r", self.idx.uuid.hyphenated().to_string().as_str()])
.output()
.expect("zfs list failed");
if !output.status.success() {
crit!("Failed to stop jail"; "vm" => self.idx.uuid.hyphenated().to_string());
return Err(GenericError::bx("Could not stop jail"));
}
fn umount_devfs(&self) {
let mut devfs = String::from("/");
devfs.push_str(self.idx.root.as_str());
devfs.push_str("/root/dev");
......@@ -130,7 +119,21 @@ impl<'a> Jail<'a> {
if !output.status.success() {
crit!("failed to mount devfs in inner jail"; "vm" => self.idx.uuid.hyphenated().to_string());
}
}
/// stops a jail
pub fn stop(&self) -> Result<i32, Box<Error>> {
debug!("Dleting jail"; "vm" => self.idx.uuid.hyphenated().to_string());
let output = Command::new(JAIL)
.args(&["-r", self.idx.uuid.hyphenated().to_string().as_str()])
.output()
.expect("jail stop failed");
if !output.status.success() {
crit!("Failed to stop jail"; "vm" => self.idx.uuid.hyphenated().to_string());
return Err(GenericError::bx("Could not stop jail"));
}
let _ = self.umount_devfs();
let _ = self.remove_rctl();
match self.outer {
Some(outer) => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment