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

Change destroy->delete add nics

parent 39dd6bab
This diff is collapsed.
......@@ -15,6 +15,7 @@ slog-term = "2"
slog-async = "2"
slog-scope = "2"
slog-bunyan = "2"
indicatif = "0.5"
[dependencies.clap]
version = "2"
......
......@@ -40,11 +40,11 @@ subcommands:
short: f
takes_value: true
required: false
- destroy:
about: destroys a jail
- delete:
about: deletes a jail
args:
- uuid:
help: UUID if the jail to destroy
help: UUID if the jail to delete
index: 1
required: true
- force:
......
......@@ -8,6 +8,20 @@ use serde_json;
use uuid::Uuid;
/// Jail configuration values
#[derive(Debug, Serialize, Deserialize)]
pub struct NIC {
/// Interface name
interface: String,
#[serde(default = "new_mac")]
mac: String,
nic_tag: String,
ip: String,
netmask: String,
gateway: String,
primary: Option<bool>,
}
/// Jail configuration values
#[derive(Debug, Serialize, Deserialize)]
pub struct JailConfig {
......@@ -38,6 +52,10 @@ pub struct JailConfig {
/// locked memory (memorylocked)
pub max_locked_memory: Option<u64>,
/// networks
#[serde(default = "empty_nics")]
nics: Vec<NIC>,
/// maximum number of porocesses (maxproc)
#[serde(default = "dflt_max_lwp")]
pub max_lwps: u64,
......@@ -127,4 +145,12 @@ fn dflt_max_lwp() -> u64 {
fn new_uuid() -> String {
Uuid::new_v4().hyphenated().to_string()
}
fn empty_nics() -> Vec<NIC> {
Vec::new()
}
fn new_mac() -> String {
String::from("00:00:00:00:00:00")
}
\ No newline at end of file
......@@ -17,6 +17,7 @@ extern crate serde_derive;
extern crate serde;
extern crate serde_json;
extern crate toml;
extern crate indicatif;
extern crate uuid;
use uuid::Uuid;
......
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