/// Define that a new volume group is to be created
Define that a new volume group is to be created
Define that a new volume group is to be created
pub fn volume_group_create(
        &mut self,
        name: &str,
        with: &HashSet<DeviceEntity>,
    ) -> Result<(), Error> {
        let mut extents = 0;
        {
            let devices = &self.components.devices;
            let queued = &self.components.queued_changes;
            for &entity in with {
                match devices.pvs.get(entity).or_else(|| queued.pvs.get(entity)) {
                    Some(pvdata) => {
                        extents += pvdata.0.size_bytes / LVM_DEFAULT_EXTENT_SIZE;
                    }
                    None => return Err(Error::ExpectedLvmPv),
                }
            }
        }
        let vg_entity = self.entities.vgs.insert(EntityFlags::CREATE);
        let lvm_vg = LvmVg {
            name: Box::from(name),
            extent_size: LVM_DEFAULT_EXTENT_SIZE,
            extents,
            extents_free: extents,
        };
        self.components.queued_changes.volume_groups.insert(vg_entity, lvm_vg);
        for &entity in with {
            self.components.queued_changes.pv_parents.insert(entity, vg_entity);
        }
        Ok(())
    }
pub fn volume_group_create ( & mut self , name : & str , with : & HashSet < DeviceEntity > , ) -> Result < ( ) , Error > { let mut extents = 0 ; { let devices = & self . components . devices ; let queued = & self . components . queued_changes ; for & entity in with { match devices . pvs . get ( entity ) . or_else ( | | queued . pvs . get ( entity ) ) { Some ( pvdata ) => { extents += pvdata . 0 . size_bytes / LVM_DEFAULT_EXTENT_SIZE ; } None => return Err ( Error :: ExpectedLvmPv ) , } } } let vg_entity = self . entities . vgs . insert ( EntityFlags :: CREATE ) ; let lvm_vg = LvmVg { name : Box :: from ( name ) , extent_size : LVM_DEFAULT_EXTENT_SIZE , extents , extents_free : extents , } ; self . components . queued_changes . volume_groups . insert ( vg_entity , lvm_vg ) ; for & entity in with { self . components . queued_changes . pv_parents . insert ( entity , vg_entity ) ; } Ok ( ( ) ) }
Define that a new volume group is to be created
Define that a new volume group is to be created
&mut self
name
&str
with
&HashSet<DeviceEntity>