sbuild
1.7.1
|
A chroot stored on an LVM logical volume (LV). More...
#include <lvm-snapshot.h>
Public Types | |
typedef std::shared_ptr < lvm_snapshot > | ptr |
A shared_ptr to a chroot facet object. | |
typedef std::shared_ptr< const lvm_snapshot > | const_ptr |
A shared_ptr to a const chroot facet object. | |
![]() | |
typedef chroot::error | error |
Exception type. | |
![]() | |
enum | session_flags { SESSION_NOFLAGS = 0, SESSION_CREATE = 1 << 0, SESSION_CLONE = 1 << 1, SESSION_PURGE = 1 << 2 } |
Chroot session properties. More... | |
typedef std::shared_ptr< facet > | ptr |
A shared_ptr to a chroot facet object. | |
typedef std::shared_ptr< const facet > | const_ptr |
A shared_ptr to a const chroot facet object. | |
![]() | |
typedef std::shared_ptr< storage > | ptr |
A shared_ptr to a chroot storage object. | |
typedef std::shared_ptr< const storage > | const_ptr |
A shared_ptr to a const chroot storage object. | |
![]() | |
typedef std::shared_ptr < session_setup > | ptr |
A shared_ptr to a chroot session_setup object. | |
typedef std::shared_ptr< const session_setup > | const_ptr |
A shared_ptr to a const chroot session_setup object. | |
![]() | |
typedef std::shared_ptr < source_setup > | ptr |
A shared_ptr to a chroot source_setup object. | |
typedef std::shared_ptr< const source_setup > | const_ptr |
A shared_ptr to a const chroot source_setup object. | |
Public Member Functions | |
virtual | ~lvm_snapshot () |
The destructor. | |
virtual std::string const & | get_name () const |
Get the name of the chroot facet. More... | |
facet::ptr | clone () const |
Copy the chroot facet. More... | |
std::string const & | get_snapshot_device () const |
Get the logical volume snapshot device name. More... | |
void | set_snapshot_device (const std::string &snapshot_device) |
Set the logical volume snapshot device name. More... | |
std::string const & | get_snapshot_options () const |
Get the logical volume snapshot options. More... | |
void | set_snapshot_options (const std::string &snapshot_options) |
Set the logical volume snapshot options. More... | |
virtual void | setup_env (environment &env) const |
Set environment. More... | |
virtual session_flags | get_session_flags () const |
Get the session flags of the chroot. More... | |
![]() | |
virtual | ~block_device_base () |
The destructor. | |
std::string const & | get_device () const |
Get the block device of the chroot. More... | |
void | set_device (const std::string &device) |
Set the block device of the chroot. More... | |
virtual std::string | get_path () const |
Get the path to the chroot. More... | |
![]() | |
virtual | ~facet () |
The destructor. | |
![]() | |
virtual | ~storage () |
The destructor. | |
![]() | |
virtual | ~session_setup () |
The destructor. | |
![]() | |
virtual | ~source_setup () |
The destructor. | |
Static Public Member Functions | |
static ptr | create () |
Create a chroot facet. More... | |
Protected Member Functions | |
lvm_snapshot () | |
The constructor. | |
lvm_snapshot (const lvm_snapshot &rhs) | |
The copy constructor. | |
void | set_chroot (chroot &chroot, bool copy) |
Set containing chroot. More... | |
virtual void | setup_lock (chroot::setup_type type, bool lock, int status) |
virtual void | get_details (format_detail &detail) const |
Get detailed information about the chroot for output. More... | |
virtual void | get_used_keys (string_list &used_keys) const |
Get a list of the keys used during keyfile parsing. More... | |
virtual void | get_keyfile (keyfile &keyfile) const |
Copy the chroot properties into a keyfile. More... | |
virtual void | set_keyfile (const keyfile &keyfile) |
Set the chroot properties from a keyfile. More... | |
virtual void | chroot_session_setup (const chroot &parent, const std::string &session_id, const std::string &alias, const std::string &user, bool root) |
Set up a newly-cloned session chroot. More... | |
virtual void | chroot_source_setup (const chroot &parent) |
Set up a newly-cloned source chroot. More... | |
![]() | |
block_device_base () | |
The constructor. | |
block_device_base (const block_device_base &rhs) | |
The copy constructor. | |
![]() | |
facet () | |
The constructor. | |
![]() | |
storage () | |
The constructor. | |
![]() | |
session_setup () | |
The constructor. | |
![]() | |
source_setup () | |
The constructor. | |
Private Attributes | |
std::string | snapshot_device |
LVM snapshot device name for lvcreate. | |
std::string | snapshot_options |
LVM snapshot options for lvcreate. | |
Friends | |
class | chroot |
Additional Inherited Members | |
![]() | |
std::string | device |
The block device to use. | |
A chroot stored on an LVM logical volume (LV).
A snapshot LV will be created and mounted on demand.
|
protectedvirtual |
Set up a newly-cloned session chroot.
parent | the parent of the cloned chroot. |
session_id | the identifier (session_id) for the new session. |
alias | used to initially identify the chroot. |
user | the user creating the session. |
root | true if the user has root access, otherwise false. |
Implements sbuild::chroot::facet::session_setup.
References sbuild::chroot::facet::block_device_base::device, sbuild::dirname(), sbuild::chroot::facet::block_device_base::get_device(), sbuild::chroot::chroot::get_name(), sbuild::chroot::facet::facet::owner, and set_snapshot_device().
|
protectedvirtual |
Set up a newly-cloned source chroot.
parent | the parent of the cloned chroot. |
Implements sbuild::chroot::facet::source_setup.
References sbuild::chroot::facet::block_device::create(), sbuild::chroot::facet::facet::owner, and sbuild::chroot::chroot::replace_facet().
|
virtual |
Copy the chroot facet.
This is a virtual copy constructor.
Implements sbuild::chroot::facet::facet.
References lvm_snapshot().
|
static |
|
protectedvirtual |
Get detailed information about the chroot for output.
detail | the details to output to. |
Reimplemented from sbuild::chroot::facet::block_device_base.
References sbuild::_(), sbuild::format_detail::add(), sbuild::chroot::facet::block_device_base::get_details(), get_snapshot_device(), get_snapshot_options(), snapshot_device, and snapshot_options.
|
protectedvirtual |
Copy the chroot properties into a keyfile.
The keyfile group with the name of the chroot will be set; if it already exists, it will be removed before setting it.
keyfile | the keyfile to use. |
Reimplemented from sbuild::chroot::facet::block_device_base.
References sbuild::chroot::chroot::get_facet(), sbuild::chroot::facet::block_device_base::get_keyfile(), sbuild::chroot::chroot::get_name(), get_snapshot_device(), get_snapshot_options(), sbuild::chroot::facet::facet::owner, and sbuild::keyfile::set_object_value().
|
virtual |
Get the name of the chroot facet.
Implements sbuild::chroot::facet::facet.
|
virtual |
Get the session flags of the chroot.
These determine how the Session controlling the chroot will operate.
chroot | the chroot to use. |
Reimplemented from sbuild::chroot::facet::facet.
References sbuild::chroot::chroot::get_facet(), sbuild::chroot::facet::facet::owner, sbuild::chroot::facet::facet::SESSION_NOFLAGS, and sbuild::chroot::facet::facet::SESSION_PURGE.
std::string const & sbuild::chroot::facet::lvm_snapshot::get_snapshot_device | ( | ) | const |
Get the logical volume snapshot device name.
This is used by lvcreate.
References snapshot_device.
Referenced by get_details(), get_keyfile(), and setup_env().
std::string const & sbuild::chroot::facet::lvm_snapshot::get_snapshot_options | ( | ) | const |
Get the logical volume snapshot options.
These are used by lvcreate.
References snapshot_options.
Referenced by get_details(), get_keyfile(), and setup_env().
|
protectedvirtual |
Get a list of the keys used during keyfile parsing.
Reimplemented from sbuild::chroot::facet::block_device_base.
References sbuild::chroot::facet::block_device_base::get_used_keys().
|
protectedvirtual |
Set containing chroot.
The copy parameter is used to inform the facet if it is new or a copy; this is intended to allow additional facets to only be added if the facet is new, for example, to avoid re-adding removed facets when copying a chroot.
chroot | the chroot containing this facet. |
copy | true if the facet has been copied, or false if this is a new instance. |
Reimplemented from sbuild::chroot::facet::block_device_base.
References sbuild::chroot::chroot::add_facet(), sbuild::chroot::facet::session_clonable::create(), sbuild::chroot::facet::source_clonable::create(), sbuild::chroot::chroot::get_facet(), sbuild::chroot::facet::facet::owner, and sbuild::chroot::facet::block_device_base::set_chroot().
|
protectedvirtual |
Set the chroot properties from a keyfile.
The chroot name must have previously been set, so that the correct keyfile group may be determined.
keyfile | the keyfile to get the properties from. |
Reimplemented from sbuild::chroot::facet::block_device_base.
References sbuild::chroot::chroot::get_facet(), sbuild::chroot::chroot::get_name(), sbuild::keyfile::get_object_value(), sbuild::chroot::facet::facet::owner, sbuild::keyfile::PRIORITY_DEPRECATED, sbuild::keyfile::PRIORITY_DISALLOWED, sbuild::keyfile::PRIORITY_REQUIRED, sbuild::chroot::facet::block_device_base::set_keyfile(), set_snapshot_device(), and set_snapshot_options().
void sbuild::chroot::facet::lvm_snapshot::set_snapshot_device | ( | const std::string & | snapshot_device) |
Set the logical volume snapshot device name.
This is used by lvcreate.
snapshot_device | the device name. |
References sbuild::chroot::chroot::DEVICE_ABS, sbuild::chroot::chroot::get_facet(), sbuild::is_absname(), sbuild::chroot::facet::facet::owner, and snapshot_device.
Referenced by chroot_session_setup(), and set_keyfile().
void sbuild::chroot::facet::lvm_snapshot::set_snapshot_options | ( | const std::string & | snapshot_options) |
Set the logical volume snapshot options.
These are used by lvcreate.
snapshot_options | the options. |
References snapshot_options.
Referenced by set_keyfile().
|
virtual |
Set environment.
Set the environment that the setup scripts will see during execution.
env | the environment to set. |
Reimplemented from sbuild::chroot::facet::block_device_base.
References sbuild::environment::add(), sbuild::basename(), get_snapshot_device(), get_snapshot_options(), and sbuild::chroot::facet::block_device_base::setup_env().