add api to format disks and create datastores
This commit is contained in:
@ -927,6 +927,15 @@ impl std::fmt::Display for FileSystemType {
|
||||
}
|
||||
}
|
||||
|
||||
impl std::str::FromStr for FileSystemType {
|
||||
type Err = serde_json::Error;
|
||||
|
||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||
use serde::de::IntoDeserializer;
|
||||
Self::deserialize(s.into_deserializer())
|
||||
}
|
||||
}
|
||||
|
||||
/// Create a file system on a disk or disk partition
|
||||
pub fn create_file_system(disk: &Disk, fs_type: FileSystemType) -> Result<(), Error> {
|
||||
|
||||
|
@ -126,6 +126,10 @@ pub fn parse_systemd_timer(filename: &str) -> Result<SectionConfigData, Error> {
|
||||
parse_systemd_config(&TIMER_CONFIG, filename)
|
||||
}
|
||||
|
||||
pub fn parse_systemd_mount(filename: &str) -> Result<SectionConfigData, Error> {
|
||||
parse_systemd_config(&MOUNT_CONFIG, filename)
|
||||
}
|
||||
|
||||
fn save_systemd_config(config: &SectionConfig, filename: &str, data: &SectionConfigData) -> Result<(), Error> {
|
||||
let raw = config.write(filename, &data)?;
|
||||
|
||||
|
Reference in New Issue
Block a user