1 | /* Copyright © 2005-2008 Roger Leigh <rleigh@debian.org> |
---|
2 | * |
---|
3 | * schroot is free software: you can redistribute it and/or modify it |
---|
4 | * under the terms of the GNU General Public License as published by |
---|
5 | * the Free Software Foundation, either version 3 of the License, or |
---|
6 | * (at your option) any later version. |
---|
7 | * |
---|
8 | * schroot is distributed in the hope that it will be useful, but |
---|
9 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
11 | * General Public License for more details. |
---|
12 | * |
---|
13 | * You should have received a copy of the GNU General Public License |
---|
14 | * along with this program. If not, see |
---|
15 | * <http://www.gnu.org/licenses/>. |
---|
16 | * |
---|
17 | *********************************************************************/ |
---|
18 | |
---|
19 | #ifndef SBUILD_CHROOT_LVM_SNAPSHOT_H |
---|
20 | #define SBUILD_CHROOT_LVM_SNAPSHOT_H |
---|
21 | |
---|
22 | #include <sbuild/sbuild-chroot-block-device-base.h> |
---|
23 | |
---|
24 | namespace sbuild |
---|
25 | { |
---|
26 | |
---|
27 | /** |
---|
28 | * A chroot stored on an LVM logical volume (LV). |
---|
29 | * |
---|
30 | * A snapshot LV will be created and mounted on demand. |
---|
31 | */ |
---|
32 | class chroot_lvm_snapshot : public chroot_block_device_base |
---|
33 | { |
---|
34 | protected: |
---|
35 | /// The constructor. |
---|
36 | chroot_lvm_snapshot (); |
---|
37 | |
---|
38 | /// The copy constructor. |
---|
39 | chroot_lvm_snapshot (const chroot_lvm_snapshot& rhs); |
---|
40 | |
---|
41 | friend class chroot; |
---|
42 | |
---|
43 | public: |
---|
44 | /// The destructor. |
---|
45 | virtual ~chroot_lvm_snapshot (); |
---|
46 | |
---|
47 | virtual chroot::ptr |
---|
48 | clone () const; |
---|
49 | |
---|
50 | virtual chroot::ptr |
---|
51 | clone_session (std::string const& session_id, |
---|
52 | std::string const& user, |
---|
53 | bool root) const; |
---|
54 | |
---|
55 | virtual chroot::ptr |
---|
56 | clone_source () const; |
---|
57 | |
---|
58 | /** |
---|
59 | * Get the logical volume snapshot device name. This is used by |
---|
60 | * lvcreate. |
---|
61 | * |
---|
62 | * @returns the device name. |
---|
63 | */ |
---|
64 | std::string const& |
---|
65 | get_snapshot_device () const; |
---|
66 | |
---|
67 | /** |
---|
68 | * Set the logical volume snapshot device name. This is used by |
---|
69 | * lvcreate. |
---|
70 | * |
---|
71 | * @param snapshot_device the device name. |
---|
72 | */ |
---|
73 | void |
---|
74 | set_snapshot_device (std::string const& snapshot_device); |
---|
75 | |
---|
76 | /** |
---|
77 | * Get the logical volume snapshot options. These are used by |
---|
78 | * lvcreate. |
---|
79 | * |
---|
80 | * @returns the options. |
---|
81 | */ |
---|
82 | std::string const& |
---|
83 | get_snapshot_options () const; |
---|
84 | |
---|
85 | /** |
---|
86 | * Set the logical volume snapshot options. These are used by |
---|
87 | * lvcreate. |
---|
88 | * |
---|
89 | * @param snapshot_options the options. |
---|
90 | */ |
---|
91 | void |
---|
92 | set_snapshot_options (std::string const& snapshot_options); |
---|
93 | |
---|
94 | virtual std::string const& |
---|
95 | get_chroot_type () const; |
---|
96 | |
---|
97 | virtual void |
---|
98 | setup_env (chroot const& chroot, |
---|
99 | environment& env) const; |
---|
100 | |
---|
101 | virtual session_flags |
---|
102 | get_session_flags (chroot const& chroot) const; |
---|
103 | |
---|
104 | protected: |
---|
105 | virtual void |
---|
106 | setup_lock (chroot::setup_type type, |
---|
107 | bool lock, |
---|
108 | int status); |
---|
109 | |
---|
110 | virtual void |
---|
111 | get_details (chroot const& chroot, |
---|
112 | format_detail& detail) const; |
---|
113 | |
---|
114 | virtual void |
---|
115 | get_keyfile (chroot const& chroot, |
---|
116 | keyfile& keyfile) const; |
---|
117 | |
---|
118 | virtual void |
---|
119 | set_keyfile (chroot& chroot, |
---|
120 | keyfile const& keyfile, |
---|
121 | string_list& used_keys); |
---|
122 | |
---|
123 | private: |
---|
124 | /// LVM snapshot device name for lvcreate. |
---|
125 | std::string snapshot_device; |
---|
126 | /// LVM snapshot options for lvcreate. |
---|
127 | std::string snapshot_options; |
---|
128 | }; |
---|
129 | |
---|
130 | } |
---|
131 | |
---|
132 | #endif /* SBUILD_CHROOT_LVM_SNAPSHOT_H */ |
---|
133 | |
---|
134 | /* |
---|
135 | * Local Variables: |
---|
136 | * mode:C++ |
---|
137 | * End: |
---|
138 | */ |
---|