diff --git a/src/dbus_api/api/manager_3_0/methods.rs b/src/dbus_api/api/manager_3_0/methods.rs index 46a2d256e7..7f9cda5e7e 100644 --- a/src/dbus_api/api/manager_3_0/methods.rs +++ b/src/dbus_api/api/manager_3_0/methods.rs @@ -13,6 +13,7 @@ use futures::executor::block_on; use crate::{ dbus_api::{ + api::shared::EncryptionParams, blockdev::create_dbus_blockdev, consts, filesystem::create_dbus_filesystem, @@ -28,8 +29,6 @@ use crate::{ stratis::StratisError, }; -type EncryptionParams = (Option<(bool, String)>, Option<(bool, (String, String))>); - pub fn destroy_pool(m: &MethodInfo<'_, MTSync, TData>) -> MethodResult { let message: &Message = m.msg; let mut iter = message.iter_init(); @@ -329,6 +328,8 @@ pub fn create_pool(m: &MethodInfo<'_, MTSync, TData>) -> MethodResult { name, &devs.map(Path::new).collect::>(), EncryptionInfo::from_options((key_desc, clevis_info)).as_ref(), + None, + None, ))); match create_result { Ok(pool_uuid_action) => match pool_uuid_action { diff --git a/src/dbus_api/api/manager_3_5/methods.rs b/src/dbus_api/api/manager_3_5/methods.rs index 8cd3a05093..e3f12233da 100644 --- a/src/dbus_api/api/manager_3_5/methods.rs +++ b/src/dbus_api/api/manager_3_5/methods.rs @@ -65,6 +65,8 @@ pub fn create_pool(m: &MethodInfo<'_, MTSync, TData>) -> MethodResult { name, &devs.map(Path::new).collect::>(), EncryptionInfo::from_options((key_desc, clevis_info)).as_ref(), + None, + None, ))); match create_result { Ok(pool_uuid_action) => match pool_uuid_action { diff --git a/src/dbus_api/api/manager_3_8/api.rs b/src/dbus_api/api/manager_3_8/api.rs index 627d7fd955..37067df11c 100644 --- a/src/dbus_api/api/manager_3_8/api.rs +++ b/src/dbus_api/api/manager_3_8/api.rs @@ -6,7 +6,10 @@ use dbus_tree::{Access, EmitsChangedSignal, Factory, MTSync, Method, Property}; use crate::dbus_api::{ api::{ - manager_3_8::{methods::start_pool, props::get_stopped_pools}, + manager_3_8::{ + methods::{create_pool, start_pool}, + props::get_stopped_pools, + }, prop_conv::StoppedOrLockedPools, }, consts, @@ -31,6 +34,50 @@ pub fn start_pool_method(f: &Factory, TData>) -> Method, TData>) -> Method, TData> { + f.method("CreatePool", (), create_pool) + .in_arg(("name", "s")) + .in_arg(("devices", "as")) + // Optional key description of key in the kernel keyring + // b: true if the pool should be encrypted and able to be + // unlocked with a passphrase associated with this key description. + // s: key description + // + // Rust representation: (bool, String) + .in_arg(("key_desc", "(bs)")) + // Optional Clevis information for binding on initialization. + // b: true if the pool should be encrypted and able to be unlocked + // using Clevis. + // s: pin name + // s: JSON config for Clevis use + // + // Rust representation: (bool, (String, String)) + .in_arg(("clevis_info", "(b(ss))")) + // Optional journal size for integrity metadata reservation. + // b: true if the size should be specified. + // false if the default should be used. + // i: Integer representing journal size in bytes. + // + // Rust representation: (bool, u64) + .in_arg(("journal_size", "(bt)")) + // Optional tag size for integrity metadata reservation. + // b: true if the size should be specified. + // false if the default should be used. + // i: Integer representing tag size in bytes. + // + // Rust representation: (bool, u8) + .in_arg(("tag_size", "(by)")) + // In order from left to right: + // b: true if a pool was created and object paths were returned + // o: Object path for Pool + // a(o): Array of object paths for block devices + // + // Rust representation: (bool, (dbus::Path, Vec)) + .out_arg(("result", "(b(oao))")) + .out_arg(("return_code", "q")) + .out_arg(("return_string", "s")) +} + pub fn stopped_pools_property(f: &Factory, TData>) -> Property, TData> { f.property::(consts::STOPPED_POOLS_PROP, ()) .access(Access::Read) diff --git a/src/dbus_api/api/manager_3_8/methods.rs b/src/dbus_api/api/manager_3_8/methods.rs index 5b7a40d943..8f8bdb3929 100644 --- a/src/dbus_api/api/manager_3_8/methods.rs +++ b/src/dbus_api/api/manager_3_8/methods.rs @@ -2,19 +2,30 @@ // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. -use dbus::{arg::OwnedFd, Message, Path}; +use std::path::Path; + +use dbus::{ + arg::{Array, OwnedFd}, + Message, +}; use dbus_tree::{MTSync, MethodInfo, MethodResult}; use futures::executor::block_on; +use devicemapper::Bytes; + use crate::{ dbus_api::{ + api::shared::EncryptionParams, blockdev::create_dbus_blockdev, filesystem::create_dbus_filesystem, pool::create_dbus_pool, types::{DbusErrorEnum, TData, OK_STRING}, util::{engine_to_dbus_err_tuple, get_next_arg, tuple_to_option}, }, - engine::{Name, PoolIdentifier, PoolUuid, StartAction, UnlockMethod}, + engine::{ + CreateAction, EncryptionInfo, KeyDescription, Name, PoolIdentifier, PoolUuid, StartAction, + UnlockMethod, + }, stratis::StratisError, }; @@ -25,8 +36,12 @@ pub fn start_pool(m: &MethodInfo<'_, MTSync, TData>) -> MethodResult { let dbus_context = m.tree.get_data(); let default_return: ( bool, - (Path<'static>, Vec>, Vec>), - ) = (false, (Path::default(), Vec::new(), Vec::new())); + ( + dbus::Path<'static>, + Vec>, + Vec>, + ), + ) = (false, (dbus::Path::default(), Vec::new(), Vec::new())); let return_message = message.method_return(); let id_str: &str = get_next_arg(&mut iter, 0)?; @@ -130,3 +145,102 @@ pub fn start_pool(m: &MethodInfo<'_, MTSync, TData>) -> MethodResult { OK_STRING.to_string(), )]) } + +pub fn create_pool(m: &MethodInfo<'_, MTSync, TData>) -> MethodResult { + let base_path = m.path.get_name(); + let message: &Message = m.msg; + let mut iter = message.iter_init(); + + let name: &str = get_next_arg(&mut iter, 0)?; + let devs: Array<'_, &str, _> = get_next_arg(&mut iter, 1)?; + let (key_desc_tuple, clevis_tuple): EncryptionParams = ( + Some(get_next_arg(&mut iter, 2)?), + Some(get_next_arg(&mut iter, 3)?), + ); + let journal_size_tuple: (bool, u64) = get_next_arg(&mut iter, 4)?; + let tag_size_tuple: (bool, u8) = get_next_arg(&mut iter, 5)?; + + let return_message = message.method_return(); + + let default_return: (bool, (dbus::Path<'static>, Vec>)) = + (false, (dbus::Path::default(), Vec::new())); + + let key_desc = match key_desc_tuple.and_then(tuple_to_option) { + Some(kds) => match KeyDescription::try_from(kds) { + Ok(kd) => Some(kd), + Err(e) => { + let (rc, rs) = engine_to_dbus_err_tuple(&e); + return Ok(vec![return_message.append3(default_return, rc, rs)]); + } + }, + None => None, + }; + + let clevis_info = match clevis_tuple.and_then(tuple_to_option) { + Some((pin, json_string)) => match serde_json::from_str(json_string.as_str()) { + Ok(j) => Some((pin, j)), + Err(e) => { + let (rc, rs) = engine_to_dbus_err_tuple(&StratisError::Serde(e)); + return Ok(vec![return_message.append3(default_return, rc, rs)]); + } + }, + None => None, + }; + + let journal_size = tuple_to_option(journal_size_tuple).map(|i| Bytes::from(i)); + let tag_size = tuple_to_option(tag_size_tuple).map(Bytes::from); + + let dbus_context = m.tree.get_data(); + let create_result = handle_action!(block_on(dbus_context.engine.create_pool( + name, + &devs.map(Path::new).collect::>(), + EncryptionInfo::from_options((key_desc, clevis_info)).as_ref(), + journal_size, + tag_size, + ))); + match create_result { + Ok(pool_uuid_action) => match pool_uuid_action { + CreateAction::Created(uuid) => { + let guard = match block_on(dbus_context.engine.get_pool(PoolIdentifier::Uuid(uuid))) + { + Some(g) => g, + None => { + let (rc, rs) = engine_to_dbus_err_tuple(&StratisError::Msg( + format!("Pool with UUID {uuid} was successfully started but appears to have been removed before it could be exposed on the D-Bus") + )); + return Ok(vec![return_message.append3(default_return, rc, rs)]); + } + }; + + let (pool_name, pool_uuid, pool) = guard.as_tuple(); + let pool_path = + create_dbus_pool(dbus_context, base_path.clone(), &pool_name, pool_uuid, pool); + let mut bd_paths = Vec::new(); + for (bd_uuid, tier, bd) in pool.blockdevs() { + bd_paths.push(create_dbus_blockdev( + dbus_context, + pool_path.clone(), + bd_uuid, + tier, + bd, + )); + } + + Ok(vec![return_message.append3( + (true, (pool_path, bd_paths)), + DbusErrorEnum::OK as u16, + OK_STRING.to_string(), + )]) + } + CreateAction::Identity => Ok(vec![return_message.append3( + default_return, + DbusErrorEnum::OK as u16, + OK_STRING.to_string(), + )]), + }, + Err(x) => { + let (rc, rs) = engine_to_dbus_err_tuple(&x); + Ok(vec![return_message.append3(default_return, rc, rs)]) + } + } +} diff --git a/src/dbus_api/api/manager_3_8/mod.rs b/src/dbus_api/api/manager_3_8/mod.rs index 48fc8b4d99..eb29edbbb5 100644 --- a/src/dbus_api/api/manager_3_8/mod.rs +++ b/src/dbus_api/api/manager_3_8/mod.rs @@ -6,4 +6,4 @@ mod api; mod methods; mod props; -pub use api::{start_pool_method, stopped_pools_property}; +pub use api::{create_pool_method, start_pool_method, stopped_pools_property}; diff --git a/src/dbus_api/api/mod.rs b/src/dbus_api/api/mod.rs index 84533c63bf..3775a53d88 100644 --- a/src/dbus_api/api/mod.rs +++ b/src/dbus_api/api/mod.rs @@ -152,7 +152,7 @@ pub fn get_base_tree<'a>( ) .add( f.interface(consts::MANAGER_INTERFACE_NAME_3_8, ()) - .add_m(manager_3_5::create_pool_method(&f)) + .add_m(manager_3_8::create_pool_method(&f)) .add_m(manager_3_0::set_key_method(&f)) .add_m(manager_3_0::unset_key_method(&f)) .add_m(manager_3_0::list_keys_method(&f)) diff --git a/src/dbus_api/api/shared.rs b/src/dbus_api/api/shared.rs index e2132b6d88..ec21bccc13 100644 --- a/src/dbus_api/api/shared.rs +++ b/src/dbus_api/api/shared.rs @@ -22,6 +22,8 @@ use crate::{ engine::{AllLockReadGuard, DevUuid, Engine, FilesystemUuid, Pool, PoolUuid, StratisUuid}, }; +pub type EncryptionParams = (Option<(bool, String)>, Option<(bool, (String, String))>); + pub fn get_managed_objects_method( f: &Factory, TData>, ) -> Method, TData> { diff --git a/src/engine/engine.rs b/src/engine/engine.rs index dc20fd76fa..ed16f88e6e 100644 --- a/src/engine/engine.rs +++ b/src/engine/engine.rs @@ -381,6 +381,8 @@ pub trait Engine: Debug + Report + Send + Sync { name: &str, blockdev_paths: &[&Path], encryption_info: Option<&EncryptionInfo>, + journal_size: Option, + tag_size: Option, ) -> StratisResult>; /// Handle a libudev event. diff --git a/src/engine/sim_engine/engine.rs b/src/engine/sim_engine/engine.rs index 45f2a034a7..f337c1875a 100644 --- a/src/engine/sim_engine/engine.rs +++ b/src/engine/sim_engine/engine.rs @@ -14,6 +14,8 @@ use futures::executor::block_on; use serde_json::{json, Value}; use tokio::sync::RwLock; +use devicemapper::Bytes; + use crate::{ engine::{ engine::{Engine, HandleEvents, KeyActions, Pool, Report}, @@ -129,6 +131,8 @@ impl Engine for SimEngine { name: &str, blockdev_paths: &[&Path], encryption_info: Option<&EncryptionInfo>, + _: Option, + _: Option, ) -> StratisResult> { validate_name(name)?; let name = Name::new(name.to_owned()); @@ -440,6 +444,8 @@ mod tests { "name", strs_to_paths!(["/dev/one", "/dev/two", "/dev/three"]), None, + None, + None )) .unwrap() .changed() @@ -451,10 +457,11 @@ mod tests { /// Destroying a pool with devices should succeed fn destroy_pool_w_devices() { let engine = SimEngine::default(); - let uuid = test_async!(engine.create_pool("name", strs_to_paths!(["/s/d"]), None)) - .unwrap() - .changed() - .unwrap(); + let uuid = + test_async!(engine.create_pool("name", strs_to_paths!(["/s/d"]), None, None, None)) + .unwrap() + .changed() + .unwrap(); assert!(test_async!(engine.destroy_pool(uuid)).is_ok()); } @@ -463,10 +470,11 @@ mod tests { fn destroy_pool_w_filesystem() { let engine = SimEngine::default(); let pool_name = "pool_name"; - let uuid = test_async!(engine.create_pool(pool_name, strs_to_paths!(["/s/d"]), None)) - .unwrap() - .changed() - .unwrap(); + let uuid = + test_async!(engine.create_pool(pool_name, strs_to_paths!(["/s/d"]), None, None, None)) + .unwrap() + .changed() + .unwrap(); { let mut pool = test_async!(engine.get_mut_pool(PoolIdentifier::Uuid(uuid))).unwrap(); pool.create_filesystems(pool_name, uuid, &[("test", None, None)]) @@ -482,9 +490,9 @@ mod tests { let name = "name"; let engine = SimEngine::default(); let devices = strs_to_paths!(["/s/d"]); - test_async!(engine.create_pool(name, devices, None)).unwrap(); + test_async!(engine.create_pool(name, devices, None, None, None)).unwrap(); assert_matches!( - test_async!(engine.create_pool(name, devices, None)), + test_async!(engine.create_pool(name, devices, None, None, None)), Ok(CreateAction::Identity) ); } @@ -494,11 +502,13 @@ mod tests { fn create_pool_name_collision_different_args() { let name = "name"; let engine = SimEngine::default(); - test_async!(engine.create_pool(name, strs_to_paths!(["/s/d"]), None)).unwrap(); + test_async!(engine.create_pool(name, strs_to_paths!(["/s/d"]), None, None, None)).unwrap(); assert!(test_async!(engine.create_pool( name, strs_to_paths!(["/dev/one", "/dev/two", "/dev/three"]), None, + None, + None, )) .is_err()); } @@ -509,7 +519,7 @@ mod tests { let path = "/s/d"; let engine = SimEngine::default(); assert_matches!( - test_async!(engine.create_pool("name", strs_to_paths!([path, path]), None)) + test_async!(engine.create_pool("name", strs_to_paths!([path, path]), None, None, None)) .unwrap() .changed() .map( @@ -541,6 +551,8 @@ mod tests { name, strs_to_paths!(["/dev/one", "/dev/two", "/dev/three"]), None, + None, + None, )) .unwrap() .changed() @@ -559,6 +571,8 @@ mod tests { "old_name", strs_to_paths!(["/dev/one", "/dev/two", "/dev/three"]), None, + None, + None, )) .unwrap() .changed() @@ -578,6 +592,8 @@ mod tests { "old_name", strs_to_paths!(["/dev/one", "/dev/two", "/dev/three"]), None, + None, + None, )) .unwrap() .changed() @@ -586,6 +602,8 @@ mod tests { new_name, strs_to_paths!(["/dev/four", "/dev/five", "/dev/six"]), None, + None, + None, )) .unwrap(); assert!(test_async!(engine.rename_pool(uuid, new_name)).is_err()); @@ -600,6 +618,8 @@ mod tests { new_name, strs_to_paths!(["/dev/one", "/dev/two", "/dev/three"]), None, + None, + None, )) .unwrap(); assert_matches!( diff --git a/src/engine/sim_engine/pool.rs b/src/engine/sim_engine/pool.rs index 1ad5f6ef17..e3541e1331 100644 --- a/src/engine/sim_engine/pool.rs +++ b/src/engine/sim_engine/pool.rs @@ -897,6 +897,8 @@ mod tests { pool_name, strs_to_paths!(["/dev/one", "/dev/two", "/dev/three"]), None, + None, + None, )) .unwrap() .changed() @@ -917,6 +919,8 @@ mod tests { pool_name, strs_to_paths!(["/dev/one", "/dev/two", "/dev/three"]), None, + None, + None, )) .unwrap() .changed() @@ -945,6 +949,8 @@ mod tests { pool_name, strs_to_paths!(["/dev/one", "/dev/two", "/dev/three"]), None, + None, + None, )) .unwrap() .changed() @@ -976,6 +982,8 @@ mod tests { pool_name, strs_to_paths!(["/dev/one", "/dev/two", "/dev/three"]), None, + None, + None, )) .unwrap() .changed() @@ -996,6 +1004,8 @@ mod tests { pool_name, strs_to_paths!(["/dev/one", "/dev/two", "/dev/three"]), None, + None, + None, )) .unwrap() .changed() @@ -1016,6 +1026,8 @@ mod tests { pool_name, strs_to_paths!(["/dev/one", "/dev/two", "/dev/three"]), None, + None, + None, )) .unwrap() .changed() @@ -1036,6 +1048,8 @@ mod tests { pool_name, strs_to_paths!(["/dev/one", "/dev/two", "/dev/three"]), None, + None, + None, )) .unwrap() .changed() @@ -1064,6 +1078,8 @@ mod tests { pool_name, strs_to_paths!(["/dev/one", "/dev/two", "/dev/three"]), None, + None, + None, )) .unwrap() .changed() @@ -1082,6 +1098,8 @@ mod tests { pool_name, strs_to_paths!(["/dev/one", "/dev/two", "/dev/three"]), None, + None, + None, )) .unwrap() .changed() @@ -1107,6 +1125,8 @@ mod tests { pool_name, strs_to_paths!(["/dev/one", "/dev/two", "/dev/three"]), None, + None, + None, )) .unwrap() .changed() @@ -1130,6 +1150,8 @@ mod tests { pool_name, strs_to_paths!(["/dev/one", "/dev/two", "/dev/three"]), None, + None, + None, )) .unwrap() .changed() @@ -1157,6 +1179,8 @@ mod tests { "pool_name", strs_to_paths!(["/dev/one", "/dev/two", "/dev/three"]), None, + None, + None, )) .unwrap() .changed() diff --git a/src/engine/strat_engine/backstore/backstore/v2.rs b/src/engine/strat_engine/backstore/backstore/v2.rs index 9504ecd06c..6e0748d3a3 100644 --- a/src/engine/strat_engine/backstore/backstore/v2.rs +++ b/src/engine/strat_engine/backstore/backstore/v2.rs @@ -444,7 +444,6 @@ impl Backstore { let data_tier = DataTier::::new( BlockDevMgr::::initialize(pool_uuid, devices, mda_data_size)?, integrity_journal_size, - None, integrity_tag_size, ); diff --git a/src/engine/strat_engine/backstore/data_tier.rs b/src/engine/strat_engine/backstore/data_tier.rs index b6d4a44065..4f74f1d573 100644 --- a/src/engine/strat_engine/backstore/data_tier.rs +++ b/src/engine/strat_engine/backstore/data_tier.rs @@ -125,12 +125,11 @@ impl DataTier { pub fn new( mut block_mgr: BlockDevMgr, integrity_journal_size: Option, - integrity_block_size: Option, integrity_tag_size: Option, ) -> DataTier { let integrity_journal_size = integrity_journal_size.unwrap_or_else(|| DEFAULT_INTEGRITY_JOURNAL_SIZE.sectors()); - let integrity_block_size = integrity_block_size.unwrap_or(DEFAULT_INTEGRITY_BLOCK_SIZE); + let integrity_block_size = DEFAULT_INTEGRITY_BLOCK_SIZE; let integrity_tag_size = integrity_tag_size.unwrap_or(DEFAULT_INTEGRITY_TAG_SIZE); for (_, bd) in block_mgr.blockdevs_mut() { // NOTE: over-allocates integrity metadata slightly. Some of the @@ -484,7 +483,7 @@ mod tests { ) .unwrap(); - let mut data_tier = DataTier::::new(mgr, None, None, None); + let mut data_tier = DataTier::::new(mgr, None, None); data_tier.invariant(); // A data_tier w/ some devices but nothing allocated diff --git a/src/engine/strat_engine/engine.rs b/src/engine/strat_engine/engine.rs index c539805a5d..38434f07dd 100644 --- a/src/engine/strat_engine/engine.rs +++ b/src/engine/strat_engine/engine.rs @@ -17,7 +17,7 @@ use tokio::{ task::{spawn_blocking, JoinHandle}, }; -use devicemapper::DmNameBuf; +use devicemapper::{Bytes, DmNameBuf}; use crate::{ engine::{ @@ -494,9 +494,20 @@ impl Engine for StratEngine { name: &str, blockdev_paths: &[&Path], encryption_info: Option<&EncryptionInfo>, + journal_size: Option, + tag_size: Option, ) -> StratisResult> { validate_name(name)?; let name = Name::new(name.to_owned()); + let rounded_journal_size = match journal_size { + Some(b) => { + if b % 4096u64 != Bytes(0) { + return Err(StratisError::Msg(format!("{b} is not a multiple of 4096"))); + } + Some(b.sectors()) + } + None => None, + }; validate_paths(blockdev_paths)?; @@ -558,6 +569,8 @@ impl Engine for StratEngine { &cloned_name, unowned_devices, cloned_enc_info.as_ref(), + rounded_journal_size, + tag_size, ) })??; pools.insert(Name::new(name.to_string()), pool_uuid, AnyPool::V2(pool)); @@ -909,7 +922,7 @@ mod test { let engine = StratEngine::initialize().unwrap(); let name1 = "name1"; - let uuid1 = test_async!(engine.create_pool(name1, paths, None)) + let uuid1 = test_async!(engine.create_pool(name1, paths, None, None, None)) .unwrap() .changed() .unwrap(); @@ -1014,13 +1027,13 @@ mod test { let engine = StratEngine::initialize().unwrap(); let name1 = "name1"; - let uuid1 = test_async!(engine.create_pool(name1, paths1, None)) + let uuid1 = test_async!(engine.create_pool(name1, paths1, None, None, None)) .unwrap() .changed() .unwrap(); let name2 = "name2"; - let uuid2 = test_async!(engine.create_pool(name2, paths2, None)) + let uuid2 = test_async!(engine.create_pool(name2, paths2, None, None, None)) .unwrap() .changed() .unwrap(); @@ -1480,7 +1493,7 @@ mod test { fn test_start_stop(paths: &[&Path]) { let engine = StratEngine::initialize().unwrap(); let name = "pool_name"; - let uuid = test_async!(engine.create_pool(name, paths, None)) + let uuid = test_async!(engine.create_pool(name, paths, None, None, None)) .unwrap() .changed() .unwrap(); diff --git a/src/engine/strat_engine/pool/v2.rs b/src/engine/strat_engine/pool/v2.rs index 288cd85ae1..97b430a82a 100644 --- a/src/engine/strat_engine/pool/v2.rs +++ b/src/engine/strat_engine/pool/v2.rs @@ -153,6 +153,8 @@ impl StratPool { name: &str, devices: UnownedDevices, encryption_info: Option<&EncryptionInfo>, + journal_size: Option, + tag_size: Option, ) -> StratisResult<(PoolUuid, StratPool)> { let pool_uuid = PoolUuid::new_v4(); @@ -164,8 +166,8 @@ impl StratPool { devices, MDADataSize::default(), encryption_info, - None, - None, + journal_size, + tag_size, )?; let thinpool = ThinPool::::new( @@ -1306,7 +1308,8 @@ mod tests { stratis_devices.error_on_not_empty().unwrap(); let name = "stratis-test-pool"; - let (uuid, mut pool) = StratPool::initialize(name, unowned_devices2, None).unwrap(); + let (uuid, mut pool) = + StratPool::initialize(name, unowned_devices2, None, None, None).unwrap(); invariant(&pool, name); let metadata1 = pool.record(name); @@ -1394,7 +1397,8 @@ mod tests { stratis_devices.error_on_not_empty().unwrap(); let name = "stratis-test-pool"; - let (uuid, mut pool) = StratPool::initialize(name, unowned_devices, None).unwrap(); + let (uuid, mut pool) = + StratPool::initialize(name, unowned_devices, None, None, None).unwrap(); invariant(&pool, name); pool.init_cache(uuid, name, cache_path, true).unwrap(); @@ -1434,7 +1438,8 @@ mod tests { stratis_devices.error_on_not_empty().unwrap(); let name = "stratis-test-pool"; - let (pool_uuid, mut pool) = StratPool::initialize(name, unowned_devices1, None).unwrap(); + let (pool_uuid, mut pool) = + StratPool::initialize(name, unowned_devices1, None, None, None).unwrap(); invariant(&pool, name); let fs_name = "stratis_test_filesystem"; @@ -1518,7 +1523,8 @@ mod tests { let (stratis_devices, unowned_devices) = devices.unpack(); stratis_devices.error_on_not_empty().unwrap(); - let (uuid, mut pool) = StratPool::initialize(name, unowned_devices, None).unwrap(); + let (uuid, mut pool) = + StratPool::initialize(name, unowned_devices, None, None, None).unwrap(); invariant(&pool, name); assert_eq!(pool.action_avail, ActionAvailability::Full); @@ -1534,7 +1540,7 @@ mod tests { let (stratis_devices, unowned_devices) = devices.unpack(); stratis_devices.error_on_not_empty().unwrap(); - let (_, mut pool) = StratPool::initialize(name, unowned_devices, None).unwrap(); + let (_, mut pool) = StratPool::initialize(name, unowned_devices, None, None, None).unwrap(); invariant(&pool, name); assert_eq!(pool.action_avail, ActionAvailability::Full); @@ -1574,7 +1580,7 @@ mod tests { stratis_devices.error_on_not_empty().unwrap(); let (pool_uuid, mut pool) = - StratPool::initialize(pool_name, unowned_devices, None).unwrap(); + StratPool::initialize(pool_name, unowned_devices, None, None, None).unwrap(); let (_, fs_uuid, _) = pool .create_filesystems( @@ -1684,7 +1690,7 @@ mod tests { fn test_grow_physical_pre_grow(paths: &[&Path]) { let pool_name = Name::new("pool".to_string()); let engine = StratEngine::initialize().unwrap(); - let pool_uuid = test_async!(engine.create_pool(&pool_name, paths, None)) + let pool_uuid = test_async!(engine.create_pool(&pool_name, paths, None, None, None)) .unwrap() .changed() .unwrap(); diff --git a/src/jsonrpc/server/pool.rs b/src/jsonrpc/server/pool.rs index 104c9459ae..bbb365b509 100644 --- a/src/jsonrpc/server/pool.rs +++ b/src/jsonrpc/server/pool.rs @@ -45,7 +45,10 @@ pub async fn pool_create<'a>( enc_info: Option<&'a EncryptionInfo>, ) -> StratisResult { Ok( - match engine.create_pool(name, blockdev_paths, enc_info).await? { + match engine + .create_pool(name, blockdev_paths, enc_info, None, None) + .await? + { CreateAction::Created(_) => true, CreateAction::Identity => false, },