Line data Source code
1 : #include <glib.h>
2 : #include <glib-object.h>
3 : #include <blockdev/utils.h>
4 :
5 :
6 : #ifndef BD_LVM_API
7 : #define BD_LVM_API
8 :
9 : GQuark bd_lvm_error_quark (void);
10 :
11 :
12 : #define BD_LVM_ERROR bd_lvm_error_quark ()
13 : typedef enum {
14 : BD_LVM_ERROR_TECH_UNAVAIL,
15 : BD_LVM_ERROR_FAIL,
16 : BD_LVM_ERROR_PARSE,
17 : BD_LVM_ERROR_NOEXIST,
18 : BD_LVM_ERROR_DM_ERROR,
19 : BD_LVM_ERROR_NOT_ROOT,
20 : BD_LVM_ERROR_CACHE_INVAL,
21 : BD_LVM_ERROR_CACHE_NOCACHE,
22 : BD_LVM_ERROR_NOT_SUPPORTED,
23 : BD_LVM_ERROR_VDO_POLICY_INVAL,
24 : BD_LVM_ERROR_DEVICES_DISABLED,
25 : } BDLVMError;
26 :
27 : typedef enum {
28 : BD_LVM_CACHE_POOL_STRIPED = 1 << 0,
29 : BD_LVM_CACHE_POOL_RAID1 = 1 << 1,
30 : BD_LVM_CACHE_POOL_RAID5 = 1 << 2,
31 : BD_LVM_CACHE_POOL_RAID6 = 1 << 3,
32 : BD_LVM_CACHE_POOL_RAID10 = 1 << 4,
33 :
34 : BD_LVM_CACHE_POOL_META_STRIPED = 1 << 10,
35 : BD_LVM_CACHE_POOL_META_RAID1 = 1 << 11,
36 : BD_LVM_CACHE_POOL_META_RAID5 = 1 << 12,
37 : BD_LVM_CACHE_POOL_META_RAID6 = 1 << 13,
38 : BD_LVM_CACHE_POOL_META_RAID10 = 1 << 14,
39 : } BDLVMCachePoolFlags;
40 :
41 : typedef enum {
42 : BD_LVM_CACHE_MODE_UNKNOWN,
43 : BD_LVM_CACHE_MODE_WRITETHROUGH,
44 : BD_LVM_CACHE_MODE_WRITEBACK,
45 : } BDLVMCacheMode;
46 :
47 : typedef enum {
48 : BD_LVM_VDO_MODE_UNKNOWN,
49 : BD_LVM_VDO_MODE_RECOVERING,
50 : BD_LVM_VDO_MODE_READ_ONLY,
51 : BD_LVM_VDO_MODE_NORMAL,
52 : } BDLVMVDOOperatingMode;
53 :
54 : typedef enum {
55 : BD_LVM_VDO_COMPRESSION_UNKNOWN,
56 : BD_LVM_VDO_COMPRESSION_ONLINE,
57 : BD_LVM_VDO_COMPRESSION_OFFLINE,
58 : } BDLVMVDOCompressionState;
59 :
60 : typedef enum {
61 : BD_LVM_VDO_INDEX_UNKNOWN,
62 : BD_LVM_VDO_INDEX_ERROR,
63 : BD_LVM_VDO_INDEX_CLOSED,
64 : BD_LVM_VDO_INDEX_OPENING,
65 : BD_LVM_VDO_INDEX_CLOSING,
66 : BD_LVM_VDO_INDEX_OFFLINE,
67 : BD_LVM_VDO_INDEX_ONLINE,
68 : } BDLVMVDOIndexState;
69 :
70 : typedef enum {
71 : BD_LVM_VDO_WRITE_POLICY_UNKNOWN,
72 : BD_LVM_VDO_WRITE_POLICY_AUTO,
73 : BD_LVM_VDO_WRITE_POLICY_SYNC,
74 : BD_LVM_VDO_WRITE_POLICY_ASYNC,
75 : } BDLVMVDOWritePolicy;
76 :
77 :
78 : #define BD_LVM_TYPE_PVDATA (bd_lvm_pvdata_get_type ())
79 : GType bd_lvm_pvdata_get_type ();
80 :
81 :
82 : typedef struct BDLVMPVdata {
83 : gchar *pv_name;
84 : gchar *pv_uuid;
85 : guint64 pv_free;
86 : guint64 pv_size;
87 : guint64 pe_start;
88 : gchar *vg_name;
89 : gchar *vg_uuid;
90 : guint64 vg_size;
91 : guint64 vg_free;
92 : guint64 vg_extent_size;
93 : guint64 vg_extent_count;
94 : guint64 vg_free_count;
95 : guint64 vg_pv_count;
96 : gchar **pv_tags;
97 : gboolean missing;
98 : } BDLVMPVdata;
99 :
100 : /**
101 : * BDLVMPVdata:
102 : * @pv_name: name of the PV
103 : * @pv_uuid: UUID of the PV
104 : * @pv_free: size of the free space in the PV
105 : * @pv_size: size of the PV
106 : * @pe_start: start of the physical extents area (i.e. offset of the first PE)
107 : * @vg_name: name of the VG the PV belongs to
108 : * @vg_uuid: UUID of the VG the PV belongs to
109 : * @vg_size: size of the VG the PV belongs to
110 : * @vg_free: size of the free space in the PV's VG
111 : * @vg_extent_size: extent size used by the PV's VG
112 : * @vg_extent_count: number of extents in the PV's VG
113 : * @vg_free_count: number of free extents in the PV's VG
114 : * @vg_pv_count: number of PVs that belong to this PV's VG
115 : * @pv_tags: (array zero-terminated=1): list of LVM tags for this PV
116 : * @missing: whether this PV is missing from the system or not
117 : */
118 : /**
119 : * bd_lvm_pvdata_copy: (skip)
120 : * @data: (nullable): %BDLVMPVdata to copy
121 : *
122 : * Creates a new copy of @data.
123 : */
124 : BDLVMPVdata* bd_lvm_pvdata_copy (BDLVMPVdata *data);
125 :
126 :
127 : /**
128 : * bd_lvm_pvdata_free: (skip)
129 : * @data: (nullable): %BDLVMPVdata to free
130 : *
131 : * Frees @data.
132 : */
133 : void bd_lvm_pvdata_free (BDLVMPVdata *data);
134 :
135 :
136 :
137 : #define BD_LVM_TYPE_VGDATA (bd_lvm_vgdata_get_type ())
138 : GType bd_lvm_vgdata_get_type ();
139 :
140 :
141 : typedef struct BDLVMVGdata {
142 : gchar *name;
143 : gchar *uuid;
144 : guint64 size;
145 : guint64 free;
146 : guint64 extent_size;
147 : guint64 extent_count;
148 : guint64 free_count;
149 : guint64 pv_count;
150 : gboolean exported;
151 : gchar **vg_tags;
152 : } BDLVMVGdata;
153 :
154 : /**
155 : * BDLVMVGdata:
156 : * @name: name of the VG
157 : * @uuid: UUID of the VG
158 : * @size: size of the VG
159 : * @free: size of the free space in the VG
160 : * @extent_size: extent size used by the VG
161 : * @extent_count: number of extents in the VG
162 : * @free_count: number of free extents in the VG
163 : * @pv_count: number of PVs that belong to the VG
164 : * @exported: whether the VG is exported or not
165 : * @vg_tags: (array zero-terminated=1): list of LVM tags for this VG
166 : */
167 : /**
168 : * bd_lvm_vgdata_copy: (skip)
169 : * @data: (nullable): %BDLVMVGdata to copy
170 : *
171 : * Creates a new copy of @data.
172 : */
173 : BDLVMVGdata* bd_lvm_vgdata_copy (BDLVMVGdata *data);
174 :
175 :
176 : /**
177 : * bd_lvm_vgdata_free: (skip)
178 : * @data: (nullable): %BDLVMVGdata to free
179 : *
180 : * Frees @data.
181 : */
182 : void bd_lvm_vgdata_free (BDLVMVGdata *data);
183 :
184 :
185 :
186 : #define BD_LVM_TYPE_SEGDATA (bd_lvm_segdata_get_type ())
187 : GType bd_lvm_segdata_get_type ();
188 :
189 :
190 : typedef struct BDLVMSEGdata {
191 : guint64 size_pe;
192 : guint64 pv_start_pe;
193 : gchar *pvdev;
194 : } BDLVMSEGdata;
195 :
196 : /**
197 : * BDLVMSEGdata:
198 : * @size_pe: Size of this segment in extents
199 : * @pv_start_pe: Where it starts in the physical volume in extents
200 : * @pvdev: Device name of the physical volume or NULL
201 : */
202 : /**
203 : * bd_lvm_segdata_copy: (skip)
204 : * @data: (nullable): %BDLVMSEGdata to copy
205 : *
206 : * Creates a new copy of @data.
207 : */
208 : BDLVMSEGdata* bd_lvm_segdata_copy (BDLVMSEGdata *data);
209 :
210 :
211 : /**
212 : * bd_lvm_segdata_free: (skip)
213 : * @data: (nullable): %BDLVMSEGdata to free
214 : *
215 : * Frees @data.
216 : */
217 : void bd_lvm_segdata_free (BDLVMSEGdata *data);
218 :
219 :
220 :
221 0 : static BDLVMSEGdata **copy_segs (BDLVMSEGdata **segs) {
222 : int i, len;
223 : BDLVMSEGdata **new_segs;
224 :
225 0 : if (segs == NULL)
226 0 : return NULL;
227 :
228 0 : for (len = 0; segs[len]; len++)
229 : ;
230 :
231 0 : new_segs = g_new0 (BDLVMSEGdata *, len+1);
232 0 : for (i = 0; i < len; i++)
233 0 : new_segs[i] = bd_lvm_segdata_copy (segs[i]);
234 :
235 0 : return new_segs;
236 : }
237 :
238 149 : static void free_segs (BDLVMSEGdata **segs) {
239 : int i;
240 :
241 149 : if (segs == NULL)
242 128 : return;
243 :
244 39 : for (i = 0; segs[i]; i++)
245 18 : bd_lvm_segdata_free (segs[i]);
246 21 : (g_free) (segs);
247 : }
248 :
249 : #define BD_LVM_TYPE_LVDATA (bd_lvm_lvdata_get_type ())
250 : GType bd_lvm_lvdata_get_type ();
251 :
252 :
253 : typedef struct BDLVMLVdata {
254 : gchar *lv_name;
255 : gchar *vg_name;
256 : gchar *uuid;
257 : guint64 size;
258 : gchar *attr;
259 : gchar *segtype;
260 : gchar *origin;
261 : gchar *pool_lv;
262 : gchar *data_lv;
263 : gchar *metadata_lv;
264 : gchar *roles;
265 : gchar *move_pv;
266 : guint64 data_percent;
267 : guint64 metadata_percent;
268 : guint64 copy_percent;
269 : gchar **lv_tags;
270 : gchar **data_lvs;
271 : gchar **metadata_lvs;
272 : BDLVMSEGdata **segs;
273 : } BDLVMLVdata;
274 :
275 : /**
276 : * BDLVMLVdata:
277 : * @lv_name: name of the LV
278 : * @vg_name: name of the VG the LV belongs to
279 : * @uuid: UUID of the LV
280 : * @size: size of the LV
281 : * @attr: attributes of the LV
282 : * @segtype: segment type of the LV
283 : * @origin: origin of the LV (for snapshots, etc.)
284 : * @pool_lv: pool LV of the LV (for thin and cached LVs)
285 : * @data_lv: data LV of the LV (for thin and cache pools)
286 : * @metadata_lv: metadata LV of the LV (for thin and cache pools)
287 : * @roles: comma separated list of this LV's roles
288 : * @move_pv: source physical volume of a temporary logical volume created with the pvmove command
289 : * @data_percent: available data space in a thin pool
290 : * @metadata_percent: available metadata space in a thin pool
291 : * @copy_percent: synchronization percentage of a mirrored logical volume
292 : * @lv_tags: (array zero-terminated=1): list of LVM tags for this LV
293 : * @data_lvs: (nullable) (array zero-terminated=1): list of data sub-LVs this LV (for raids, etc).
294 : * @metadata_lvs: (nullable) (array zero-terminated=1): list of metadata sub-LVS for this LV (for raids, etc).
295 : * @segs: (nullable) (array zero-terminated=1): The segments of this LV.
296 : *
297 : * The @segs, @data_lvs, and @metadata_lvs fields are only filled by a
298 : * call to bd_lvm_lvinfo_tree or bd_lvm_lvs_tree. They are all NULL
299 : * normally. If they are filled, they follow these rules:
300 : *
301 : * A LV is either stored directly on physical volumes, or is made up
302 : * of sub-LVs. If it is stored on PVs, the @segs list is non-empty
303 : * and the @data_lvs and @metadata_lvs fields are both NULL. If it is
304 : * made up of sub-LVs, then @segs is NULL, @data_lvs is non-empty and
305 : * @metadata_lvs might or might not be empty but is non-NULL. The
306 : * sub-LVs contained in @data_lv and @metadata_lv are always included
307 : * in @data_lvs and @metadata_lvs, respectively.
308 : *
309 : * For a partial LV, the @segs list might not be complete; i.e., the
310 : * sum of the sizes of the listed segments might not be equal to the
311 : * size reported for the LV itself.
312 : *
313 : * Also, the order of entries in @segs must be assumed to be random;
314 : * it does not correspond to the order of segments in the logical
315 : * volume itself.
316 : */
317 : /**
318 : * bd_lvm_lvdata_copy: (skip)
319 : * @data: (nullable): %BDLVMLVdata to copy
320 : *
321 : * Creates a new copy of @data.
322 : */
323 : BDLVMLVdata* bd_lvm_lvdata_copy (BDLVMLVdata *data);
324 :
325 :
326 : /**
327 : * bd_lvm_lvdata_free: (skip)
328 : * @data: (nullable): %BDLVMLVdata to free
329 : *
330 : * Frees @data.
331 : */
332 : void bd_lvm_lvdata_free (BDLVMLVdata *data);
333 :
334 :
335 :
336 : #define BD_LVM_TYPE_VDOPOOLDATA (bd_lvm_vdopooldata_get_type ())
337 : GType bd_lvm_vdopooldata_get_type ();
338 :
339 :
340 :
341 : typedef struct BDLVMVDOPooldata {
342 : BDLVMVDOOperatingMode operating_mode;
343 : BDLVMVDOCompressionState compression_state;
344 : BDLVMVDOIndexState index_state;
345 : BDLVMVDOWritePolicy write_policy;
346 : guint64 used_size;
347 : gint32 saving_percent;
348 : guint64 index_memory_size;
349 : gboolean deduplication;
350 : gboolean compression;
351 : } BDLVMVDOPooldata;
352 :
353 : /**
354 : * BDLVMVDOPooldata:
355 : * @operating_mode: operating mode of the VDO pool (e.g. %BD_LVM_VDO_MODE_NORMAL)
356 : * @compression_state: state of the compression
357 : * @index_state: state of the VDO index
358 : * @write_policy: write policy of the VDO LV
359 : * @used_size: currently used space
360 : * @saving_percent: percentage of physical blocks saved
361 : * @index_memory_size: index memory size of the VDO volume
362 : * @deduplication: whether deduplication is enabled
363 : * @compression: whether compression is enabled
364 : */
365 : /**
366 : * bd_lvm_vdopooldata_copy: (skip)
367 : * @data: (nullable): %BDLVMVDOPooldata to copy
368 : *
369 : * Creates a new copy of @data.
370 : */
371 : BDLVMVDOPooldata* bd_lvm_vdopooldata_copy (BDLVMVDOPooldata *data);
372 :
373 :
374 : /**
375 : * bd_lvm_vdopooldata_free: (skip)
376 : * @data: (nullable): %BDLVMVDOPooldata to free
377 : *
378 : * Frees @data.
379 : */
380 : void bd_lvm_vdopooldata_free (BDLVMVDOPooldata *data);
381 :
382 :
383 :
384 : #define BD_LVM_TYPE_VDO_STATS (bd_lvm_vdo_stats_get_type ())
385 : GType bd_lvm_vdo_stats_get_type ();
386 :
387 :
388 : typedef struct BDLVMVDOStats {
389 : gint64 block_size;
390 : gint64 logical_block_size;
391 : gint64 physical_blocks;
392 : gint64 data_blocks_used;
393 : gint64 overhead_blocks_used;
394 : gint64 logical_blocks_used;
395 : gint64 used_percent;
396 : gint64 saving_percent;
397 : gdouble write_amplification_ratio;
398 : } BDLVMVDOStats;
399 :
400 : /**
401 : * BDLVMVDOStats:
402 : * @block_size: The block size of a VDO volume, in bytes.
403 : * @logical_block_size: The logical block size, in bytes.
404 : * @physical_blocks: The total number of physical blocks allocated for a VDO volume.
405 : * @data_blocks_used: The number of physical blocks currently in use by a VDO volume
406 : * to store data.
407 : * @overhead_blocks_used: The number of physical blocks currently in use by a VDO volume
408 : * to store VDO metadata.
409 : * @logical_blocks_used: The number of logical blocks currently mapped.
410 : * @used_percent: The percentage of physical blocks used on a VDO volume
411 : * (= used blocks / allocated blocks * 100).
412 : * @saving_percent: The percentage of physical blocks saved on a VDO volume
413 : * (= [logical blocks used - physical blocks used] / logical blocks used).
414 : * @write_amplification_ratio: The average number of block writes to the underlying storage
415 : * per block written to the VDO device.
416 : */
417 : /**
418 : * bd_lvm_vdo_stats_copy: (skip)
419 : * @stats: (nullable): %BDLVMVDOStats to copy
420 : *
421 : * Creates a new copy of @stats.
422 : */
423 : BDLVMVDOStats* bd_lvm_vdo_stats_copy (BDLVMVDOStats *stats);
424 :
425 :
426 : /**
427 : * bd_lvm_vdo_stats_free: (skip)
428 : * @stats: (nullable): %BDLVMVDOStats to free
429 : *
430 : * Frees @stats.
431 : */
432 : void bd_lvm_vdo_stats_free (BDLVMVDOStats *stats);
433 :
434 :
435 :
436 : #define BD_LVM_TYPE_CACHE_STATS (bd_lvm_cache_stats_get_type ())
437 : GType bd_lvm_cache_stats_get_type ();
438 :
439 :
440 : typedef struct BDLVMCacheStats {
441 : guint64 block_size;
442 : guint64 cache_size;
443 : guint64 cache_used;
444 : guint64 md_block_size;
445 : guint64 md_size;
446 : guint64 md_used;
447 : guint64 read_hits;
448 : guint64 read_misses;
449 : guint64 write_hits;
450 : guint64 write_misses;
451 : BDLVMCacheMode mode;
452 : } BDLVMCacheStats;
453 :
454 : /**
455 : * BDLVMCacheStats:
456 : * @block_size: block size used by the cache
457 : * @cache_size: size of the cache
458 : * @cache_used: size of the used space in the cache
459 : * @md_block_size: block size used for cache metadata
460 : * @md_size: size of the metadata space of the cache
461 : * @md_used: size of the used metadata space in the cache
462 : * @read_hits: number of read hits
463 : * @read_misses: number of read misses
464 : * @write_hits: number of write hits
465 : * @write_misses: number of write misses
466 : * @mode: mode the cache is operating in
467 : */
468 : /**
469 : * bd_lvm_cache_stats_copy: (skip)
470 : * @data: (nullable): %BDLVMCacheStats to copy
471 : *
472 : * Creates a new copy of @data.
473 : */
474 : BDLVMCacheStats* bd_lvm_cache_stats_copy (BDLVMCacheStats *data);
475 :
476 :
477 : /**
478 : * bd_lvm_cache_stats_free: (skip)
479 : * @data: (nullable): %BDLVMCacheStats to free
480 : *
481 : * Frees @data.
482 : */
483 : void bd_lvm_cache_stats_free (BDLVMLVdata *data);
484 :
485 :
486 :
487 : typedef enum {
488 : BD_LVM_TECH_BASIC = 0,
489 : BD_LVM_TECH_BASIC_SNAP,
490 : BD_LVM_TECH_THIN,
491 : BD_LVM_TECH_CACHE,
492 : BD_LVM_TECH_CALCS,
493 : BD_LVM_TECH_THIN_CALCS,
494 : BD_LVM_TECH_CACHE_CALCS,
495 : BD_LVM_TECH_GLOB_CONF,
496 : BD_LVM_TECH_VDO,
497 : BD_LVM_TECH_WRITECACHE,
498 : BD_LVM_TECH_DEVICES,
499 : BD_LVM_TECH_SHARED,
500 : BD_LVM_TECH_CONFIG,
501 : BD_LVM_TECH_VG_CFG_BACKUP_RESTORE,
502 : } BDLVMTech;
503 :
504 : typedef enum {
505 : BD_LVM_TECH_MODE_CREATE = 1 << 0,
506 : BD_LVM_TECH_MODE_REMOVE = 1 << 2,
507 : BD_LVM_TECH_MODE_MODIFY = 1 << 3,
508 : BD_LVM_TECH_MODE_QUERY = 1 << 4,
509 : } BDLVMTechMode;
510 :
511 :
512 : /**
513 : * bd_lvm_is_tech_avail:
514 : * @tech: the queried tech
515 : * @mode: a bit mask of queried modes of operation (#BDLVMTechMode) for @tech
516 : * @error: (out) (optional): place to store error (details about why the @tech-@mode combination is not available)
517 : *
518 : * Returns: whether the @tech-@mode combination is available -- supported by the
519 : * plugin implementation and having all the runtime dependencies available
520 : */
521 : gboolean bd_lvm_is_tech_avail (BDLVMTech tech, guint64 mode, GError **error);
522 :
523 :
524 : /**
525 : * bd_lvm_is_supported_pe_size:
526 : * @size: size (in bytes) to test
527 : * @error: (out) (optional): place to store error (if any)
528 : *
529 : * Returns: whether the given size is supported physical extent size or not
530 : *
531 : * Tech category: %BD_LVM_TECH_CALCS no mode (it is ignored)
532 : */
533 : gboolean bd_lvm_is_supported_pe_size (guint64 size, GError **error);
534 :
535 :
536 : /**
537 : * bd_lvm_get_supported_pe_sizes:
538 : * @error: (out) (optional): place to store error (if any)
539 : *
540 : * Returns: (transfer full) (array fixed-size=25): list of supported PE sizes
541 : *
542 : * Tech category: %BD_LVM_TECH_CALCS no mode (it is ignored)
543 : */
544 : guint64 * bd_lvm_get_supported_pe_sizes (GError **error);
545 :
546 :
547 : /**
548 : * bd_lvm_get_max_lv_size:
549 : * @error: (out) (optional): place to store error (if any)
550 : *
551 : * Returns: maximum LV size in bytes
552 : *
553 : * Tech category: %BD_LVM_TECH_CALCS no mode (it is ignored)
554 : */
555 : guint64 bd_lvm_get_max_lv_size (GError **error);
556 :
557 :
558 : /**
559 : * bd_lvm_round_size_to_pe:
560 : * @size: size to be rounded
561 : * @pe_size: physical extent (PE) size or 0 to use the default
562 : * @roundup: whether to round up or down (ceil or floor)
563 : * @error: (out) (optional): place to store error (if any)
564 : *
565 : * Returns: @size rounded to @pe_size according to the @roundup
566 : *
567 : * Rounds given @size up/down to a multiple of @pe_size according to the value
568 : * of the @roundup parameter. If the rounded value is too big to fit in the
569 : * return type, the result is rounded down (floored) regardless of the @roundup
570 : * parameter.
571 : *
572 : * Tech category: %BD_LVM_TECH_CALCS no mode (it is ignored)
573 : */
574 : guint64 bd_lvm_round_size_to_pe (guint64 size, guint64 pe_size, gboolean roundup, GError **error);
575 :
576 :
577 : /**
578 : * bd_lvm_get_lv_physical_size:
579 : * @lv_size: LV size
580 : * @pe_size: PE size
581 : * @error: (out) (optional): place to store error (if any)
582 : *
583 : * Returns: space taken on disk(s) by the LV with given @size
584 : *
585 : * Gives number of bytes needed for an LV with the size @lv_size on an LVM stack
586 : * using given @pe_size.
587 : *
588 : * Tech category: %BD_LVM_TECH_CALCS no mode (it is ignored)
589 : */
590 : guint64 bd_lvm_get_lv_physical_size (guint64 lv_size, guint64 pe_size, GError **error);
591 :
592 :
593 : /**
594 : * bd_lvm_get_thpool_padding:
595 : * @size: size of the thin pool
596 : * @pe_size: PE size or 0 if the default value should be used
597 : * @included: if padding is already included in the size
598 : * @error: (out) (optional): place to store error (if any)
599 : *
600 : * Returns: size of the padding needed for a thin pool with the given @size
601 : * according to the @pe_size and @included
602 : *
603 : * Tech category: %BD_LVM_TECH_THIN_CALCS no mode (it is ignored)
604 : */
605 : guint64 bd_lvm_get_thpool_padding (guint64 size, guint64 pe_size, gboolean included, GError **error);
606 :
607 :
608 : /**
609 : * bd_lvm_get_thpool_meta_size:
610 : * @size: size of the thin pool
611 : * @chunk_size: chunk size of the thin pool or 0 to use the default
612 : * @n_snapshots: ignored
613 : * @error: (out) (optional): place to store error (if any)
614 : *
615 : * Note: This function will be changed in 3.0: the @n_snapshots parameter
616 : * is currently not used and will be removed.
617 : *
618 : * Returns: recommended size of the metadata space for the specified pool
619 : *
620 : * Tech category: %BD_LVM_TECH_THIN_CALCS no mode (it is ignored)
621 : */
622 : guint64 bd_lvm_get_thpool_meta_size (guint64 size, guint64 chunk_size, guint64 n_snapshots, GError **error);
623 :
624 :
625 : /**
626 : * bd_lvm_is_valid_thpool_md_size:
627 : * @size: the size to be tested
628 : * @error: (out) (optional): place to store error (if any)
629 : *
630 : * Returns: whether the given size is a valid thin pool metadata size or not
631 : *
632 : * Tech category: %BD_LVM_TECH_THIN_CALCS no mode (it is ignored)
633 : */
634 : gboolean bd_lvm_is_valid_thpool_md_size (guint64 size, GError **error);
635 :
636 :
637 : /**
638 : * bd_lvm_is_valid_thpool_chunk_size:
639 : * @size: the size to be tested
640 : * @discard: whether discard/TRIM is required to be supported or not
641 : * @error: (out) (optional): place to store error (if any)
642 : *
643 : * Returns: whether the given size is a valid thin pool chunk size or not
644 : *
645 : * Tech category: %BD_LVM_TECH_THIN_CALCS no mode (it is ignored)
646 : */
647 : gboolean bd_lvm_is_valid_thpool_chunk_size (guint64 size, gboolean discard, GError **error);
648 :
649 :
650 : /**
651 : * bd_lvm_pvcreate:
652 : * @device: the device to make PV from
653 : * @data_alignment: data (first PE) alignment or 0 to use the default
654 : * @metadata_size: size of the area reserved for metadata or 0 to use the default
655 : * @extra: (nullable) (array zero-terminated=1): extra options for the PV creation
656 : * (just passed to LVM as is)
657 : * @error: (out) (optional): place to store error (if any)
658 : *
659 : * Returns: whether the PV was successfully created or not
660 : *
661 : * Tech category: %BD_LVM_TECH_BASIC-%BD_LVM_TECH_MODE_CREATE
662 : */
663 : gboolean bd_lvm_pvcreate (const gchar *device, guint64 data_alignment, guint64 metadata_size, const BDExtraArg **extra, GError **error);
664 :
665 :
666 : /**
667 : * bd_lvm_pvresize:
668 : * @device: the device to resize
669 : * @size: the new requested size of the PV or 0 if it should be adjusted to device's size
670 : * @extra: (nullable) (array zero-terminated=1): extra options for the PV resize
671 : * (just passed to LVM as is)
672 : * @error: (out) (optional): place to store error (if any)
673 : *
674 : * Returns: whether the PV's size was successfully changed or not
675 : *
676 : * If given @size different from 0, sets the PV's size to the given value (see
677 : * pvresize(8)). If given @size 0, adjusts the PV's size to the underlying
678 : * block device's size.
679 : *
680 : * Tech category: %BD_LVM_TECH_BASIC-%BD_LVM_TECH_MODE_MODIFY
681 : */
682 : gboolean bd_lvm_pvresize (const gchar *device, guint64 size, const BDExtraArg **extra, GError **error);
683 :
684 :
685 : /**
686 : * bd_lvm_pvremove:
687 : * @device: the PV device to be removed/destroyed
688 : * @extra: (nullable) (array zero-terminated=1): extra options for the PV removal
689 : * (just passed to LVM as is)
690 : * @error: (out) (optional): place to store error (if any)
691 : *
692 : * Returns: whether the PV was successfully removed/destroyed or not
693 : *
694 : * Tech category: %BD_LVM_TECH_BASIC-%BD_LVM_TECH_MODE_REMOVE
695 : */
696 : gboolean bd_lvm_pvremove (const gchar *device, const BDExtraArg **extra, GError **error);
697 :
698 :
699 : /**
700 : * bd_lvm_pvmove:
701 : * @src: the PV device to move extents off of
702 : * @dest: (nullable): the PV device to move extents onto or %NULL
703 : * @extra: (nullable) (array zero-terminated=1): extra options for the PV move
704 : * (just passed to LVM as is)
705 : * @error: (out) (optional): place to store error (if any)
706 : *
707 : * Returns: whether the extents from the @src PV where successfully moved or not
708 : *
709 : * If @dest is %NULL, VG allocation rules are used for the extents from the @src
710 : * PV (see pvmove(8)).
711 : *
712 : * Tech category: %BD_LVM_TECH_BASIC-%BD_LVM_TECH_MODE_MODIFY
713 : */
714 : gboolean bd_lvm_pvmove (const gchar *src, const gchar *dest, const BDExtraArg **extra, GError **error);
715 :
716 :
717 : /**
718 : * bd_lvm_pvscan:
719 : * @device: (nullable): the device to scan for PVs or %NULL
720 : * @update_cache: whether to update the lvmetad cache or not
721 : * @extra: (nullable) (array zero-terminated=1): extra options for the PV scan
722 : * (just passed to LVM as is)
723 : * @error: (out) (optional): place to store error (if any)
724 : *
725 : * Returns: whether the system or @device was successfully scanned for PVs or not
726 : *
727 : * The @device argument is used only if @update_cache is %TRUE. Otherwise the
728 : * whole system is scanned for PVs.
729 : *
730 : * Tech category: %BD_LVM_TECH_BASIC-%BD_LVM_TECH_MODE_QUERY
731 : */
732 : gboolean bd_lvm_pvscan (const gchar *device, gboolean update_cache, const BDExtraArg **extra, GError **error);
733 :
734 :
735 : /**
736 : * bd_lvm_add_pv_tags:
737 : * @device: the device to set PV tags for
738 : * @tags: (array zero-terminated=1): list of tags to add
739 : * @error: (out) (optional): place to store error (if any)
740 : *
741 : * Returns: whether the tags were successfully added to @device or not
742 : *
743 : * Tech category: %BD_LVM_TECH_BASIC-%BD_LVM_TECH_MODE_QUERY
744 : */
745 : gboolean bd_lvm_add_pv_tags (const gchar *device, const gchar **tags, GError **error);
746 :
747 :
748 : /**
749 : * bd_lvm_delete_pv_tags:
750 : * @device: the device to set PV tags for
751 : * @tags: (array zero-terminated=1): list of tags to remove
752 : * @error: (out) (optional): place to store error (if any)
753 : *
754 : * Returns: whether the tags were successfully removed from @device or not
755 : *
756 : * Tech category: %BD_LVM_TECH_BASIC-%BD_LVM_TECH_MODE_QUERY
757 : */
758 : gboolean bd_lvm_delete_pv_tags (const gchar *device, const gchar **tags, GError **error);
759 :
760 :
761 : /**
762 : * bd_lvm_pvinfo:
763 : * @device: a PV to get information about or %NULL
764 : * @error: (out) (optional): place to store error (if any)
765 : *
766 : * Returns: (transfer full): information about the PV on the given @device or
767 : * %NULL in case of error (the @error) gets populated in those cases)
768 : *
769 : * Tech category: %BD_LVM_TECH_BASIC-%BD_LVM_TECH_MODE_QUERY
770 : */
771 : BDLVMPVdata* bd_lvm_pvinfo (const gchar *device, GError **error);
772 :
773 :
774 : /**
775 : * bd_lvm_pvs:
776 : * @error: (out) (optional): place to store error (if any)
777 : *
778 : * Returns: (array zero-terminated=1): information about PVs found in the system
779 : *
780 : * Tech category: %BD_LVM_TECH_BASIC-%BD_LVM_TECH_MODE_QUERY
781 : */
782 : BDLVMPVdata** bd_lvm_pvs (GError **error);
783 :
784 :
785 : /**
786 : * bd_lvm_vgcreate:
787 : * @name: name of the newly created VG
788 : * @pv_list: (array zero-terminated=1): list of PVs the newly created VG should use
789 : * @pe_size: PE size or 0 if the default value should be used
790 : * @extra: (nullable) (array zero-terminated=1): extra options for the VG creation
791 : * (just passed to LVM as is)
792 : * @error: (out) (optional): place to store error (if any)
793 : *
794 : * Returns: whether the VG @name was successfully created or not
795 : *
796 : * Tech category: %BD_LVM_TECH_BASIC-%BD_LVM_TECH_MODE_CREATE
797 : */
798 : gboolean bd_lvm_vgcreate (const gchar *name, const gchar **pv_list, guint64 pe_size, const BDExtraArg **extra, GError **error);
799 :
800 :
801 : /**
802 : * bd_lvm_vgremove:
803 : * @vg_name: name of the to be removed VG
804 : * @extra: (nullable) (array zero-terminated=1): extra options for the VG removal
805 : * (just passed to LVM as is)
806 : * @error: (out) (optional): place to store error (if any)
807 : *
808 : * Returns: whether the VG was successfully removed or not
809 : *
810 : * Tech category: %BD_LVM_TECH_BASIC-%BD_LVM_TECH_MODE_REMOVE
811 : */
812 : gboolean bd_lvm_vgremove (const gchar *vg_name, const BDExtraArg **extra, GError **error);
813 :
814 :
815 : /**
816 : * bd_lvm_vgrename:
817 : * @old_vg_name: old name of the VG to rename
818 : * @new_vg_name: new name for the @old_vg_name VG
819 : * @extra: (nullable) (array zero-terminated=1): extra options for the VG rename
820 : * (just passed to LVM as is)
821 : * @error: (out) (optional): place to store error (if any)
822 : *
823 : * Returns: whether the VG was successfully renamed or not
824 : *
825 : * Tech category: %BD_LVM_TECH_BASIC-%BD_LVM_TECH_MODE_MODIFY
826 : */
827 : gboolean bd_lvm_vgrename (const gchar *old_vg_name, const gchar *new_vg_name, const BDExtraArg **extra, GError **error);
828 :
829 :
830 : /**
831 : * bd_lvm_vgactivate:
832 : * @vg_name: name of the to be activated VG
833 : * @extra: (nullable) (array zero-terminated=1): extra options for the VG activation
834 : * (just passed to LVM as is)
835 : * @error: (out) (optional): place to store error (if any)
836 : *
837 : * Returns: whether the VG was successfully activated or not
838 : *
839 : * Tech category: %BD_LVM_TECH_BASIC-%BD_LVM_TECH_MODE_MODIFY
840 : */
841 : gboolean bd_lvm_vgactivate (const gchar *vg_name, const BDExtraArg **extra, GError **error);
842 :
843 :
844 : /**
845 : * bd_lvm_vgdeactivate:
846 : * @vg_name: name of the to be deactivated VG
847 : * @extra: (nullable) (array zero-terminated=1): extra options for the VG deactivation
848 : * (just passed to LVM as is)
849 : * @error: (out) (optional): place to store error (if any)
850 : *
851 : * Returns: whether the VG was successfully deactivated or not
852 : *
853 : * Tech category: %BD_LVM_TECH_BASIC-%BD_LVM_TECH_MODE_MODIFY
854 : */
855 : gboolean bd_lvm_vgdeactivate (const gchar *vg_name, const BDExtraArg **extra, GError **error);
856 :
857 :
858 : /**
859 : * bd_lvm_vgextend:
860 : * @vg_name: name of the to be extended VG
861 : * @device: PV device to extend the @vg_name VG with
862 : * @extra: (nullable) (array zero-terminated=1): extra options for the VG extension
863 : * (just passed to LVM as is)
864 : * @error: (out) (optional): place to store error (if any)
865 : *
866 : * Returns: whether the VG @vg_name was successfully extended with the given @device or not.
867 : *
868 : * Tech category: %BD_LVM_TECH_BASIC-%BD_LVM_TECH_MODE_MODIFY
869 : */
870 : gboolean bd_lvm_vgextend (const gchar *vg_name, const gchar *device, const BDExtraArg **extra, GError **error);
871 :
872 :
873 : /**
874 : * bd_lvm_vgreduce:
875 : * @vg_name: name of the to be reduced VG
876 : * @device: (nullable): PV device the @vg_name VG should be reduced of or %NULL
877 : * if the VG should be reduced of the missing PVs
878 : * @extra: (nullable) (array zero-terminated=1): extra options for the VG reduction
879 : * (just passed to LVM as is)
880 : * @error: (out) (optional): place to store error (if any)
881 : *
882 : * Returns: whether the VG @vg_name was successfully reduced of the given @device or not
883 : *
884 : * Note: This function does not move extents off of the PV before removing
885 : * it from the VG. You must do that first by calling #bd_lvm_pvmove.
886 : *
887 : * Tech category: %BD_LVM_TECH_BASIC-%BD_LVM_TECH_MODE_MODIFY
888 : */
889 : gboolean bd_lvm_vgreduce (const gchar *vg_name, const gchar *device, const BDExtraArg **extra, GError **error);
890 :
891 :
892 : /**
893 : * bd_lvm_add_vg_tags:
894 : * @vg_name: the VG to set tags on
895 : * @tags: (array zero-terminated=1): list of tags to add
896 : * @error: (out) (optional): place to store error (if any)
897 : *
898 : * Returns: whether the tags were successfully added to @vg_name or not
899 : *
900 : * Tech category: %BD_LVM_TECH_BASIC-%BD_LVM_TECH_MODE_QUERY
901 : */
902 : gboolean bd_lvm_add_vg_tags (const gchar *vg_name, const gchar **tags, GError **error);
903 :
904 :
905 : /**
906 : * bd_lvm_delete_vg_tags:
907 : * @vg_name: the VG to set tags on
908 : * @tags: (array zero-terminated=1): list of tags to remove
909 : * @error: (out) (optional): place to store error (if any)
910 : *
911 : * Returns: whether the tags were successfully removed from @vg_name or not
912 : *
913 : * Tech category: %BD_LVM_TECH_BASIC-%BD_LVM_TECH_MODE_QUERY
914 : */
915 : gboolean bd_lvm_delete_vg_tags (const gchar *vg_name, const gchar **tags, GError **error);
916 :
917 :
918 : /**
919 : * bd_lvm_vglock_start:
920 : * @vg_name: a shared VG to start the lockspace in lvmlockd
921 : * @extra: (nullable) (array zero-terminated=1): extra options for the vgchange command
922 : * (just passed to LVM as is)
923 : * @error: (out) (optional): place to store error (if any)
924 : *
925 : * Returns: whether the lock was successfully started for @vg_name or not
926 : *
927 : * Tech category: %BD_LVM_TECH_SHARED-%BD_LVM_TECH_MODE_MODIFY
928 : */
929 : gboolean bd_lvm_vglock_start (const gchar *vg_name, const BDExtraArg **extra, GError **error);
930 :
931 :
932 : /**
933 : * bd_lvm_vglock_stop:
934 : * @vg_name: a shared VG to stop the lockspace in lvmlockd
935 : * @extra: (nullable) (array zero-terminated=1): extra options for the vgchange command
936 : * (just passed to LVM as is)
937 : * @error: (out) (optional): place to store error (if any)
938 : *
939 : * Returns: whether the lock was successfully stopped for @vg_name or not
940 : *
941 : * Tech category: %BD_LVM_TECH_SHARED-%BD_LVM_TECH_MODE_MODIFY
942 : */
943 : gboolean bd_lvm_vglock_stop (const gchar *vg_name, const BDExtraArg **extra, GError **error);
944 :
945 :
946 : /**
947 : * bd_lvm_vginfo:
948 : * @vg_name: a VG to get information about
949 : * @error: (out) (optional): place to store error (if any)
950 : *
951 : * Returns: (transfer full): information about the @vg_name VG or %NULL in case
952 : * of error (the @error) gets populated in those cases)
953 : *
954 : * Tech category: %BD_LVM_TECH_BASIC-%BD_LVM_TECH_MODE_QUERY
955 : */
956 : BDLVMVGdata* bd_lvm_vginfo (const gchar *vg_name, GError **error);
957 :
958 :
959 : /**
960 : * bd_lvm_vgs:
961 : * @error: (out) (optional): place to store error (if any)
962 : *
963 : * Returns: (array zero-terminated=1): information about VGs found in the system
964 : *
965 : * Tech category: %BD_LVM_TECH_BASIC-%BD_LVM_TECH_MODE_QUERY
966 : */
967 : BDLVMVGdata** bd_lvm_vgs (GError **error);
968 :
969 :
970 : /**
971 : * bd_lvm_lvorigin:
972 : * @vg_name: name of the VG containing the queried LV
973 : * @lv_name: name of the queried LV
974 : * @error: (out) (optional): place to store error (if any)
975 : *
976 : * Returns: (transfer full): the origin volume for the @vg_name/@lv_name LV or
977 : * %NULL if failed to determine (@error) is set in those cases)
978 : *
979 : * Tech category: %BD_LVM_TECH_BASIC-%BD_LVM_TECH_MODE_QUERY
980 : */
981 : gchar* bd_lvm_lvorigin (const gchar *vg_name, const gchar *lv_name, GError **error);
982 :
983 :
984 : /**
985 : * bd_lvm_lvcreate:
986 : * @vg_name: name of the VG to create a new LV in
987 : * @lv_name: name of the to-be-created LV
988 : * @size: requested size of the new LV
989 : * @type: (nullable): type of the new LV ("striped", "raid1",..., see lvcreate (8))
990 : * @pv_list: (nullable) (array zero-terminated=1): list of PVs the newly created LV should use or %NULL
991 : * if not specified
992 : * @extra: (nullable) (array zero-terminated=1): extra options for the LV creation
993 : * (just passed to LVM as is)
994 : * @error: (out) (optional): place to store error (if any)
995 : *
996 : * Returns: whether the given @vg_name/@lv_name LV was successfully created or not
997 : *
998 : * Tech category: %BD_LVM_TECH_BASIC-%BD_LVM_TECH_MODE_CREATE
999 : */
1000 : gboolean bd_lvm_lvcreate (const gchar *vg_name, const gchar *lv_name, guint64 size, const gchar *type, const gchar **pv_list, const BDExtraArg **extra, GError **error);
1001 :
1002 :
1003 : /**
1004 : * bd_lvm_lvremove:
1005 : * @vg_name: name of the VG containing the to-be-removed LV
1006 : * @lv_name: name of the to-be-removed LV
1007 : * @force: whether to force removal or not
1008 : * @extra: (nullable) (array zero-terminated=1): extra options for the LV removal
1009 : * (just passed to LVM as is)
1010 : * @error: (out) (optional): place to store error (if any)
1011 : *
1012 : * Returns: whether the @vg_name/@lv_name LV was successfully removed or not
1013 : *
1014 : * Tech category: %BD_LVM_TECH_BASIC-%BD_LVM_TECH_MODE_REMOVE
1015 : */
1016 : gboolean bd_lvm_lvremove (const gchar *vg_name, const gchar *lv_name, gboolean force, const BDExtraArg **extra, GError **error);
1017 :
1018 :
1019 : /**
1020 : * bd_lvm_lvrename:
1021 : * @vg_name: name of the VG containing the to-be-renamed LV
1022 : * @lv_name: name of the to-be-renamed LV
1023 : * @new_name: new name for the @vg_name/@lv_name LV
1024 : * @extra: (nullable) (array zero-terminated=1): extra options for the LV rename
1025 : * (just passed to LVM as is)
1026 : * @error: (out) (optional): place to store error (if any)
1027 : *
1028 : * Returns: whether the @vg_name/@lv_name LV was successfully renamed to
1029 : * @vg_name/@new_name or not
1030 : *
1031 : * Tech category: %BD_LVM_TECH_BASIC-%BD_LVM_TECH_MODE_MODIFY
1032 : */
1033 : gboolean bd_lvm_lvrename (const gchar *vg_name, const gchar *lv_name, const gchar *new_name, const BDExtraArg **extra, GError **error);
1034 :
1035 :
1036 : /**
1037 : * bd_lvm_lvresize:
1038 : * @vg_name: name of the VG containing the to-be-resized LV
1039 : * @lv_name: name of the to-be-resized LV
1040 : * @size: the requested new size of the LV
1041 : * @extra: (nullable) (array zero-terminated=1): extra options for the LV resize
1042 : * (just passed to LVM as is)
1043 : * @error: (out) (optional): place to store error (if any)
1044 : *
1045 : * Returns: whether the @vg_name/@lv_name LV was successfully resized or not
1046 : *
1047 : * Tech category: %BD_LVM_TECH_BASIC-%BD_LVM_TECH_MODE_MODIFY
1048 : */
1049 : gboolean bd_lvm_lvresize (const gchar *vg_name, const gchar *lv_name, guint64 size, const BDExtraArg **extra, GError **error);
1050 :
1051 :
1052 : /**
1053 : * bd_lvm_lvrepair:
1054 : * @vg_name: name of the VG containing the to-be-repaired LV
1055 : * @lv_name: name of the to-be-repaired LV
1056 : * @pv_list: (array zero-terminated=1): list of PVs to be used for the repair
1057 : * @extra: (nullable) (array zero-terminated=1): extra options for the LV repair
1058 : * (just passed to LVM as is)
1059 : * @error: (out) (optional): place to store error (if any)
1060 : *
1061 : * Returns: whether the @vg_name/@lv_name LV was successfully repaired or not
1062 : *
1063 : * Tech category: %BD_LVM_TECH_BASIC-%BD_LVM_TECH_MODE_MODIFY
1064 : */
1065 : gboolean bd_lvm_lvrepair (const gchar *vg_name, const gchar *lv_name, const gchar **pv_list, const BDExtraArg **extra, GError **error);
1066 :
1067 :
1068 : /**
1069 : * bd_lvm_lvactivate:
1070 : * @vg_name: name of the VG containing the to-be-activated LV
1071 : * @lv_name: name of the to-be-activated LV
1072 : * @ignore_skip: whether to ignore the skip flag or not
1073 : * @shared: whether to activate the LV in shared mode (used for shared LVM setups with lvmlockd,
1074 : * use %FALSE if not sure)
1075 : * @extra: (nullable) (array zero-terminated=1): extra options for the LV activation
1076 : * (just passed to LVM as is)
1077 : * @error: (out) (optional): place to store error (if any)
1078 : *
1079 : * Returns: whether the @vg_name/@lv_name LV was successfully activated or not
1080 : *
1081 : * Tech category: %BD_LVM_TECH_BASIC-%BD_LVM_TECH_MODE_MODIFY
1082 : */
1083 : gboolean bd_lvm_lvactivate (const gchar *vg_name, const gchar *lv_name, gboolean ignore_skip, gboolean shared, const BDExtraArg **extra, GError **error);
1084 :
1085 :
1086 : /**
1087 : * bd_lvm_lvdeactivate:
1088 : * @vg_name: name of the VG containing the to-be-deactivated LV
1089 : * @lv_name: name of the to-be-deactivated LV
1090 : * @extra: (nullable) (array zero-terminated=1): extra options for the LV deactivation
1091 : * (just passed to LVM as is)
1092 : * @error: (out) (optional): place to store error (if any)
1093 : *
1094 : * Returns: whether the @vg_name/@lv_name LV was successfully deactivated or not
1095 : *
1096 : * Tech category: %BD_LVM_TECH_BASIC-%BD_LVM_TECH_MODE_MODIFY
1097 : */
1098 : gboolean bd_lvm_lvdeactivate (const gchar *vg_name, const gchar *lv_name, const BDExtraArg **extra, GError **error);
1099 :
1100 :
1101 : /**
1102 : * bd_lvm_lvsnapshotcreate:
1103 : * @vg_name: name of the VG containing the LV a new snapshot should be created of
1104 : * @origin_name: name of the LV a new snapshot should be created of
1105 : * @snapshot_name: name of the to-be-created snapshot
1106 : * @size: requested size for the snapshot
1107 : * @extra: (nullable) (array zero-terminated=1): extra options for the LV snapshot creation
1108 : * (just passed to LVM as is)
1109 : * @error: (out) (optional): place to store error (if any)
1110 : *
1111 : * Returns: whether the @snapshot_name snapshot of the @vg_name/@origin_name LV
1112 : * was successfully created or not.
1113 : *
1114 : * Tech category: %BD_LVM_TECH_BASIC_SNAP-%BD_LVM_TECH_MODE_CREATE
1115 : */
1116 : gboolean bd_lvm_lvsnapshotcreate (const gchar *vg_name, const gchar *origin_name, const gchar *snapshot_name, guint64 size, const BDExtraArg **extra, GError **error);
1117 :
1118 :
1119 : /**
1120 : * bd_lvm_lvsnapshotmerge:
1121 : * @vg_name: name of the VG containing the to-be-merged LV snapshot
1122 : * @snapshot_name: name of the to-be-merged LV snapshot
1123 : * @extra: (nullable) (array zero-terminated=1): extra options for the LV snapshot merge
1124 : * (just passed to LVM as is)
1125 : * @error: (out) (optional): place to store error (if any)
1126 : *
1127 : * Returns: whether the @vg_name/@snapshot_name LV snapshot was successfully merged or not
1128 : *
1129 : * Tech category: %BD_LVM_TECH_BASIC_SNAP-%BD_LVM_TECH_MODE_MODIFY
1130 : */
1131 : gboolean bd_lvm_lvsnapshotmerge (const gchar *vg_name, const gchar *snapshot_name, const BDExtraArg **extra, GError **error);
1132 :
1133 :
1134 : /**
1135 : * bd_lvm_add_lv_tags:
1136 : * @vg_name: name of the VG that contains the LV to set tags on
1137 : * @lv_name: name of the LV to set tags on
1138 : * @tags: (array zero-terminated=1): list of tags to add
1139 : * @error: (out) (optional): place to store error (if any)
1140 : *
1141 : * Returns: whether the tags were successfully added to @device or not
1142 : *
1143 : * Tech category: %BD_LVM_TECH_BASIC-%BD_LVM_TECH_MODE_QUERY
1144 : */
1145 : gboolean bd_lvm_add_lv_tags (const gchar *vg_name, const gchar *lv_name, const gchar **tags, GError **error);
1146 :
1147 :
1148 : /**
1149 : * bd_lvm_delete_lv_tags:
1150 : * @vg_name: name of the VG that contains the LV to set tags on
1151 : * @lv_name: name of the LV to set tags on
1152 : * @tags: (array zero-terminated=1): list of tags to remove
1153 : * @error: (out) (optional): place to store error (if any)
1154 : *
1155 : * Returns: whether the tags were successfully removed from @device or not
1156 : *
1157 : * Tech category: %BD_LVM_TECH_BASIC-%BD_LVM_TECH_MODE_QUERY
1158 : */
1159 : gboolean bd_lvm_delete_lv_tags (const gchar *vg_name, const gchar *lv_name, const gchar **tags, GError **error);
1160 :
1161 :
1162 : /**
1163 : * bd_lvm_lvinfo:
1164 : * @vg_name: name of the VG that contains the LV to get information about
1165 : * @lv_name: name of the LV to get information about
1166 : * @error: (out) (optional): place to store error (if any)
1167 : *
1168 : * Returns: (transfer full): information about the @vg_name/@lv_name LV or %NULL in case
1169 : * of error (the @error) gets populated in those cases)
1170 : *
1171 : * Tech category: %BD_LVM_TECH_BASIC-%BD_LVM_TECH_MODE_QUERY
1172 : */
1173 : BDLVMLVdata* bd_lvm_lvinfo (const gchar *vg_name, const gchar *lv_name, GError **error);
1174 :
1175 :
1176 : /**
1177 : * bd_lvm_lvinfo_tree:
1178 : * @vg_name: name of the VG that contains the LV to get information about
1179 : * @lv_name: name of the LV to get information about
1180 : * @error: (out) (optional): place to store error (if any)
1181 : *
1182 : * This function will fill out the data_lvs, metadata_lvs, and segs fields as well.
1183 : *
1184 : * Returns: (transfer full): information about the @vg_name/@lv_name LV or %NULL in case
1185 : * of error (the @error) gets populated in those cases)
1186 : *
1187 : * Tech category: %BD_LVM_TECH_BASIC-%BD_LVM_TECH_MODE_QUERY
1188 : */
1189 : BDLVMLVdata* bd_lvm_lvinfo_tree (const gchar *vg_name, const gchar *lv_name, GError **error);
1190 :
1191 :
1192 : /**
1193 : * bd_lvm_lvs:
1194 : * @vg_name: (nullable): name of the VG to get information about LVs from
1195 : * @error: (out) (optional): place to store error (if any)
1196 : *
1197 : * Returns: (array zero-terminated=1): information about LVs found in the given
1198 : * @vg_name VG or in system if @vg_name is %NULL
1199 : *
1200 : * Tech category: %BD_LVM_TECH_BASIC-%BD_LVM_TECH_MODE_QUERY
1201 : */
1202 : BDLVMLVdata** bd_lvm_lvs (const gchar *vg_name, GError **error);
1203 :
1204 :
1205 : /**
1206 : * bd_lvm_lvs_tree:
1207 : * @vg_name: (nullable): name of the VG to get information about LVs from
1208 : * @error: (out) (optional): place to store error (if any)
1209 : *
1210 : * This function will fill out the data_lvs, metadata_lvs, and segs fields as well.
1211 : *
1212 : * Returns: (array zero-terminated=1): information about LVs found in the given
1213 : * @vg_name VG or in system if @vg_name is %NULL.
1214 : *
1215 : * Tech category: %BD_LVM_TECH_BASIC-%BD_LVM_TECH_MODE_QUERY
1216 : */
1217 : BDLVMLVdata** bd_lvm_lvs_tree (const gchar *vg_name, GError **error);
1218 :
1219 :
1220 : /**
1221 : * bd_lvm_thpoolcreate:
1222 : * @vg_name: name of the VG to create a thin pool in
1223 : * @lv_name: name of the to-be-created pool LV
1224 : * @size: requested size of the to-be-created pool
1225 : * @md_size: requested metadata size or 0 to use the default
1226 : * @chunk_size: requested chunk size or 0 to use the default
1227 : * @profile: (nullable): profile to use (see lvm(8) for more information) or %NULL to use
1228 : * the default
1229 : * @extra: (nullable) (array zero-terminated=1): extra options for the thin pool creation
1230 : * (just passed to LVM as is)
1231 : * @error: (out) (optional): place to store error (if any)
1232 : *
1233 : * Returns: whether the @vg_name/@lv_name thin pool was successfully created or not
1234 : *
1235 : * Tech category: %BD_LVM_TECH_THIN-%BD_LVM_TECH_MODE_CREATE
1236 : */
1237 : gboolean bd_lvm_thpoolcreate (const gchar *vg_name, const gchar *lv_name, guint64 size, guint64 md_size, guint64 chunk_size, const gchar *profile, const BDExtraArg **extra, GError **error);
1238 :
1239 :
1240 : /**
1241 : * bd_lvm_thlvcreate:
1242 : * @vg_name: name of the VG containing the thin pool providing extents for the to-be-created thin LV
1243 : * @pool_name: name of the pool LV providing extents for the to-be-created thin LV
1244 : * @lv_name: name of the to-be-created thin LV
1245 : * @size: requested virtual size of the to-be-created thin LV
1246 : * @extra: (nullable) (array zero-terminated=1): extra options for the thin LV creation
1247 : * (just passed to LVM as is)
1248 : * @error: (out) (optional): place to store error (if any)
1249 : *
1250 : * Returns: whether the @vg_name/@lv_name thin LV was successfully created or not
1251 : *
1252 : * Tech category: %BD_LVM_TECH_THIN-%BD_LVM_TECH_MODE_CREATE
1253 : */
1254 : gboolean bd_lvm_thlvcreate (const gchar *vg_name, const gchar *pool_name, const gchar *lv_name, guint64 size, const BDExtraArg **extra, GError **error);
1255 :
1256 :
1257 : /**
1258 : * bd_lvm_thlvpoolname:
1259 : * @vg_name: name of the VG containing the queried thin LV
1260 : * @lv_name: name of the queried thin LV
1261 : * @error: (out) (optional): place to store error (if any)
1262 : *
1263 : * Returns: (transfer full): the name of the pool volume for the @vg_name/@lv_name
1264 : * thin LV or %NULL if failed to determine (@error) is set in those cases)
1265 : *
1266 : * Tech category: %BD_LVM_TECH_THIN-%BD_LVM_TECH_MODE_QUERY
1267 : */
1268 : gchar* bd_lvm_thlvpoolname (const gchar *vg_name, const gchar *lv_name, GError **error);
1269 :
1270 :
1271 : /**
1272 : * bd_lvm_thsnapshotcreate:
1273 : * @vg_name: name of the VG containing the thin LV a new snapshot should be created of
1274 : * @origin_name: name of the thin LV a new snapshot should be created of
1275 : * @snapshot_name: name of the to-be-created snapshot
1276 : * @pool_name: (nullable): name of the thin pool to create the snapshot in or %NULL if not specified
1277 : * @extra: (nullable) (array zero-terminated=1): extra options for the thin LV snapshot creation
1278 : * (just passed to LVM as is)
1279 : * @error: (out) (optional): place to store error (if any)
1280 : *
1281 : * Returns: whether the @snapshot_name snapshot of the @vg_name/@origin_name
1282 : * thin LV was successfully created or not.
1283 : *
1284 : * Tech category: %BD_LVM_TECH_THIN-%BD_LVM_TECH_MODE_CREATE
1285 : */
1286 : gboolean bd_lvm_thsnapshotcreate (const gchar *vg_name, const gchar *origin_name, const gchar *snapshot_name, const gchar *pool_name, const BDExtraArg **extra, GError **error);
1287 :
1288 :
1289 : /**
1290 : * bd_lvm_set_global_config:
1291 : * @new_config: (nullable): string representation of the new global libblockdev LVM
1292 : * configuration to set or %NULL to reset to default
1293 : * @error: (out) (optional): place to store error (if any)
1294 : *
1295 : *
1296 : * Note: This function sets configuration options for LVM calls internally
1297 : * in libblockdev, it doesn't change the global lvm.conf config file.
1298 : * Calling this function with `backup {backup=0 archive=0}` for example
1299 : * means `--config=backup {backup=0 archive=0}"` will be added to all
1300 : * calls libblockdev makes.
1301 : *
1302 : * Returns: whether the new requested global config @new_config was successfully
1303 : * set or not
1304 : *
1305 : * Tech category: %BD_LVM_TECH_GLOB_CONF no mode (it is ignored)
1306 : */
1307 : gboolean bd_lvm_set_global_config (const gchar *new_config, GError **error);
1308 :
1309 :
1310 : /**
1311 : * bd_lvm_get_global_config:
1312 : * @error: (out) (optional): place to store error (if any)
1313 : *
1314 : * Returns: (transfer full): a copy of a string representation of the currently
1315 : * set libblockdev LVM global configuration
1316 : *
1317 : * Note: This function does not change the global `lvm.conf` config
1318 : * file, see %bd_lvm_set_global_config for details.
1319 : *
1320 : * Tech category: %BD_LVM_TECH_GLOB_CONF no mode (it is ignored)
1321 : */
1322 : gchar* bd_lvm_get_global_config (GError **error);
1323 :
1324 :
1325 : /**
1326 : * bd_lvm_set_devices_filter:
1327 : * @devices: (nullable) (array zero-terminated=1): list of devices for lvm commands to work on
1328 : * @error: (out) (optional): place to store error (if any)
1329 : *
1330 : * Returns: whether the devices filter was successfully set or not
1331 : *
1332 : * Tech category: %BD_LVM_TECH_DEVICES no mode (it is ignored)
1333 : */
1334 : gboolean bd_lvm_set_devices_filter (const gchar **devices, GError **error);
1335 :
1336 :
1337 : /**
1338 : * bd_lvm_get_devices_filter:
1339 : * @error: (out) (optional): place to store error (if any)
1340 : *
1341 : * Returns: (transfer full) (array zero-terminated=1): a copy of a string representation of
1342 : * the currently set LVM devices filter
1343 : *
1344 : * Tech category: %BD_LVM_TECH_DEVICES no mode (it is ignored)
1345 : */
1346 : gchar** bd_lvm_get_devices_filter (GError **error);
1347 :
1348 :
1349 : /**
1350 : * bd_lvm_cache_get_default_md_size:
1351 : * @cache_size: size of the cache to determine MD size for
1352 : * @error: (out) (optional): place to store error (if any)
1353 : *
1354 : * Returns: recommended default size of the cache metadata LV or 0 in case of error
1355 : *
1356 : * Tech category: %BD_LVM_TECH_CACHE_CALCS no mode (it is ignored)
1357 : */
1358 : guint64 bd_lvm_cache_get_default_md_size (guint64 cache_size, GError **error);
1359 :
1360 :
1361 : /**
1362 : * bd_lvm_cache_get_mode_str:
1363 : * @mode: mode to get the string representation for
1364 : * @error: (out) (optional): place to store error (if any)
1365 : *
1366 : * Returns: string representation of @mode or %NULL in case of error
1367 : *
1368 : * Tech category: always provided/supported
1369 : */
1370 : const gchar* bd_lvm_cache_get_mode_str (BDLVMCacheMode mode, GError **error);
1371 :
1372 :
1373 : /**
1374 : * bd_lvm_cache_get_mode_from_str:
1375 : * @mode_str: string representation of a cache mode
1376 : * @error: (out) (optional): place to store error (if any)
1377 : *
1378 : * Returns: cache mode for the @mode_str or %BD_LVM_CACHE_MODE_UNKNOWN if
1379 : * failed to determine
1380 : *
1381 : * Tech category: always provided/supported
1382 : */
1383 : BDLVMCacheMode bd_lvm_cache_get_mode_from_str (const gchar *mode_str, GError **error);
1384 :
1385 :
1386 : /**
1387 : * bd_lvm_cache_create_pool:
1388 : * @vg_name: name of the VG to create @pool_name in
1389 : * @pool_name: name of the cache pool LV to create
1390 : * @pool_size: desired size of the cache pool @pool_name
1391 : * @md_size: desired size of the @pool_name cache pool's metadata LV or 0 to
1392 : * use the default
1393 : * @mode: cache mode of the @pool_name cache pool
1394 : * @flags: a combination of (ORed) #BDLVMCachePoolFlags
1395 : * @fast_pvs: (array zero-terminated=1): list of (fast) PVs to create the @pool_name
1396 : * cache pool (and the metadata LV)
1397 : * @error: (out) (optional): place to store error (if any)
1398 : *
1399 : * Returns: whether the cache pool @vg_name/@pool_name was successfully created or not
1400 : *
1401 : * Tech category: %BD_LVM_TECH_CACHE-%BD_LVM_TECH_MODE_CREATE
1402 : */
1403 : gboolean bd_lvm_cache_create_pool (const gchar *vg_name, const gchar *pool_name, guint64 pool_size, guint64 md_size, BDLVMCacheMode mode, BDLVMCachePoolFlags flags, const gchar **fast_pvs, GError **error);
1404 :
1405 :
1406 : /**
1407 : * bd_lvm_cache_attach:
1408 : * @vg_name: name of the VG containing the @data_lv and the @cache_pool_lv LVs
1409 : * @data_lv: data LV to attach the @cache_pool_lv to
1410 : * @cache_pool_lv: cache pool LV to attach to the @data_lv
1411 : * @extra: (nullable) (array zero-terminated=1): extra options for the cache attachment
1412 : * (just passed to LVM as is)
1413 : * @error: (out) (optional): place to store error (if any)
1414 : *
1415 : * Returns: whether the @cache_pool_lv was successfully attached to the @data_lv or not
1416 : *
1417 : * Note: Both @data_lv and @cache_lv will be deactivated before the operation.
1418 : *
1419 : * Tech category: %BD_LVM_TECH_CACHE-%BD_LVM_TECH_MODE_MODIFY
1420 : */
1421 : gboolean bd_lvm_cache_attach (const gchar *vg_name, const gchar *data_lv, const gchar *cache_pool_lv, const BDExtraArg **extra, GError **error);
1422 :
1423 :
1424 : /**
1425 : * bd_lvm_cache_detach:
1426 : * @vg_name: name of the VG containing the @cached_lv
1427 : * @cached_lv: name of the cached LV to detach its cache from
1428 : * @destroy: whether to destroy the cache after detach or not
1429 : * @extra: (nullable) (array zero-terminated=1): extra options for the cache detachment
1430 : * (just passed to LVM as is)
1431 : * @error: (out) (optional): place to store error (if any)
1432 : *
1433 : * Returns: whether the cache was successfully detached from the @cached_lv or not
1434 : *
1435 : * Note: synces the cache first
1436 : *
1437 : * Tech category: %BD_LVM_TECH_CACHE-%BD_LVM_TECH_MODE_MODIFY
1438 : */
1439 : gboolean bd_lvm_cache_detach (const gchar *vg_name, const gchar *cached_lv, gboolean destroy, const BDExtraArg **extra, GError **error);
1440 :
1441 :
1442 : /**
1443 : * bd_lvm_cache_create_cached_lv:
1444 : * @vg_name: name of the VG to create a cached LV in
1445 : * @lv_name: name of the cached LV to create
1446 : * @data_size: size of the data LV
1447 : * @cache_size: size of the cache (or cached LV more precisely)
1448 : * @md_size: size of the cache metadata LV or 0 to use the default
1449 : * @mode: cache mode for the cached LV
1450 : * @flags: a combination of (ORed) #BDLVMCachePoolFlags
1451 : * @slow_pvs: (array zero-terminated=1): list of slow PVs (used for the data LV)
1452 : * @fast_pvs: (array zero-terminated=1): list of fast PVs (used for the cache LV)
1453 : * @error: (out) (optional): place to store error (if any)
1454 : *
1455 : * Returns: whether the cached LV @lv_name was successfully created or not
1456 : *
1457 : * Tech category: %BD_LVM_TECH_CACHE-%BD_LVM_TECH_MODE_CREATE
1458 : */
1459 : gboolean bd_lvm_cache_create_cached_lv (const gchar *vg_name, const gchar *lv_name, guint64 data_size, guint64 cache_size, guint64 md_size, BDLVMCacheMode mode, BDLVMCachePoolFlags flags, const gchar **slow_pvs, const gchar **fast_pvs, GError **error);
1460 :
1461 :
1462 : /**
1463 : * bd_lvm_cache_pool_name:
1464 : * @vg_name: name of the VG containing the @cached_lv
1465 : * @cached_lv: cached LV to get the name of the its pool LV for
1466 : * @error: (out) (optional): place to store error (if any)
1467 : *
1468 : * Returns: name of the cache pool LV used by the @cached_lv or %NULL in case of error
1469 : *
1470 : * Tech category: %BD_LVM_TECH_CACHE-%BD_LVM_TECH_MODE_QUERY
1471 : */
1472 : gchar* bd_lvm_cache_pool_name (const gchar *vg_name, const gchar *cached_lv, GError **error);
1473 :
1474 :
1475 : /**
1476 : * bd_lvm_cache_stats:
1477 : * @vg_name: name of the VG containing the @cached_lv
1478 : * @cached_lv: cached LV to get stats for
1479 : * @error: (out) (optional): place to store error (if any)
1480 : *
1481 : * Returns: stats for the @cached_lv or %NULL in case of error
1482 : *
1483 : * Tech category: %BD_LVM_TECH_CACHE-%BD_LVM_TECH_MODE_QUERY
1484 : */
1485 : BDLVMCacheStats* bd_lvm_cache_stats (const gchar *vg_name, const gchar *cached_lv, GError **error);
1486 :
1487 :
1488 : /**
1489 : * bd_lvm_writecache_attach:
1490 : * @vg_name: name of the VG containing the @data_lv and the @cache_pool_lv LVs
1491 : * @data_lv: data LV to attach the @cache_lv to
1492 : * @cache_lv: cache (fast) LV to attach to the @data_lv
1493 : * @extra: (nullable) (array zero-terminated=1): extra options for the cache attachment
1494 : * (just passed to LVM as is)
1495 : * @error: (out) (optional): place to store error (if any)
1496 : *
1497 : * Returns: whether the @cache_lv was successfully attached to the @data_lv or not
1498 : *
1499 : * Tech category: %BD_LVM_TECH_WRITECACHE-%BD_LVM_TECH_MODE_MODIFY
1500 : */
1501 : gboolean bd_lvm_writecache_attach (const gchar *vg_name, const gchar *data_lv, const gchar *cache_lv, const BDExtraArg **extra, GError **error);
1502 :
1503 :
1504 : /**
1505 : * bd_lvm_writecache_detach:
1506 : * @vg_name: name of the VG containing the @cached_lv
1507 : * @cached_lv: name of the cached LV to detach its cache from
1508 : * @destroy: whether to destroy the cache after detach or not
1509 : * @extra: (nullable) (array zero-terminated=1): extra options for the cache detachment
1510 : * (just passed to LVM as is)
1511 : * @error: (out) (optional): place to store error (if any)
1512 : *
1513 : * Returns: whether the cache was successfully detached from the @cached_lv or not
1514 : *
1515 : * Note: synces the cache first
1516 : *
1517 : * Tech category: %BD_LVM_TECH_WRITECACHE-%BD_LVM_TECH_MODE_MODIFY
1518 : */
1519 : gboolean bd_lvm_writecache_detach (const gchar *vg_name, const gchar *cached_lv, gboolean destroy, const BDExtraArg **extra, GError **error);
1520 :
1521 :
1522 : /**
1523 : * bd_lvm_writecache_create_cached_lv:
1524 : * @vg_name: name of the VG to create a cached LV in
1525 : * @lv_name: name of the cached LV to create
1526 : * @data_size: size of the data LV
1527 : * @cache_size: size of the cache (or cached LV more precisely)
1528 : * @slow_pvs: (array zero-terminated=1): list of slow PVs (used for the data LV)
1529 : * @fast_pvs: (array zero-terminated=1): list of fast PVs (used for the cache LV)
1530 : * @error: (out) (optional): place to store error (if any)
1531 : *
1532 : * Returns: whether the cached LV @lv_name was successfully created or not
1533 : *
1534 : * Tech category: %BD_LVM_TECH_WRITECACHE-%BD_LVM_TECH_MODE_CREATE
1535 : */
1536 : gboolean bd_lvm_writecache_create_cached_lv (const gchar *vg_name, const gchar *lv_name, guint64 data_size, guint64 cache_size, const gchar **slow_pvs, const gchar **fast_pvs, GError **error);
1537 :
1538 :
1539 : /**
1540 : * bd_lvm_thpool_convert:
1541 : * @vg_name: name of the VG to create the new thin pool in
1542 : * @data_lv: name of the LV that should become the data part of the new pool
1543 : * @metadata_lv: name of the LV that should become the metadata part of the new pool
1544 : * @name: (nullable): name for the thin pool (if %NULL, the name @data_lv is inherited)
1545 : * @extra: (nullable) (array zero-terminated=1): extra options for the thin pool creation
1546 : * (just passed to LVM as is)
1547 : * @error: (out) (optional): place to store error (if any)
1548 : *
1549 : * Converts the @data_lv and @metadata_lv into a new thin pool in the @vg_name
1550 : * VG.
1551 : *
1552 : * Returns: whether the new thin pool was successfully created from @data_lv and
1553 : * @metadata_lv or not
1554 : *
1555 : * Tech category: %BD_LVM_TECH_THIN-%BD_LVM_TECH_MODE_CREATE
1556 : */
1557 : gboolean bd_lvm_thpool_convert (const gchar *vg_name, const gchar *data_lv, const gchar *metadata_lv, const gchar *name, const BDExtraArg **extra, GError **error);
1558 :
1559 :
1560 : /**
1561 : * bd_lvm_cache_pool_convert:
1562 : * @vg_name: name of the VG to create the new thin pool in
1563 : * @data_lv: name of the LV that should become the data part of the new pool
1564 : * @metadata_lv: name of the LV that should become the metadata part of the new pool
1565 : * @name: (nullable): name for the thin pool (if %NULL, the name @data_lv is inherited)
1566 : * @extra: (nullable) (array zero-terminated=1): extra options for the thin pool creation
1567 : * (just passed to LVM as is)
1568 : * @error: (out) (optional): place to store error (if any)
1569 : *
1570 : * Converts the @data_lv and @metadata_lv into a new cache pool in the @vg_name
1571 : * VG.
1572 : *
1573 : * Returns: whether the new cache pool was successfully created from @data_lv and
1574 : * @metadata_lv or not
1575 : *
1576 : * Tech category: %BD_LVM_TECH_CACHE-%BD_LVM_TECH_MODE_CREATE
1577 : */
1578 : gboolean bd_lvm_cache_pool_convert (const gchar *vg_name, const gchar *data_lv, const gchar *metadata_lv, const gchar *name, const BDExtraArg **extra, GError **error);
1579 :
1580 :
1581 : /**
1582 : * bd_lvm_vdo_pool_create:
1583 : * @vg_name: name of the VG to create a new LV in
1584 : * @lv_name: name of the to-be-created VDO LV
1585 : * @pool_name: (nullable): name of the to-be-created VDO pool LV or %NULL for default name
1586 : * @data_size: requested size of the data VDO LV (physical size of the @pool_name VDO pool LV)
1587 : * @virtual_size: requested virtual_size of the @lv_name VDO LV
1588 : * @index_memory: amount of index memory (in bytes) or 0 for default
1589 : * @compression: whether to enable compression or not
1590 : * @deduplication: whether to enable deduplication or not
1591 : * @write_policy: write policy for the volume
1592 : * @extra: (nullable) (array zero-terminated=1): extra options for the VDO LV creation
1593 : * (just passed to LVM as is)
1594 : * @error: (out) (optional): place to store error (if any)
1595 : *
1596 : * Returns: whether the given @vg_name/@lv_name VDO LV was successfully created or not
1597 : *
1598 : * Tech category: %BD_LVM_TECH_VDO-%BD_LVM_TECH_MODE_CREATE
1599 : */
1600 : gboolean bd_lvm_vdo_pool_create (const gchar *vg_name, const gchar *lv_name, const gchar *pool_name, guint64 data_size, guint64 virtual_size, guint64 index_memory, gboolean compression, gboolean deduplication, BDLVMVDOWritePolicy write_policy, const BDExtraArg **extra, GError **error);
1601 :
1602 :
1603 : /**
1604 : * bd_lvm_vdo_enable_compression:
1605 : * @vg_name: name of the VG containing the to-be-changed VDO pool LV
1606 : * @pool_name: name of the VDO pool LV to enable compression on
1607 : * @extra: (nullable) (array zero-terminated=1): extra options for the VDO change
1608 : * (just passed to LVM as is)
1609 : * @error: (out) (optional): place to store error (if any)
1610 : *
1611 : * Returns: whether compression was successfully enabled on @vg_name/@pool_name LV or not
1612 : *
1613 : * Tech category: %BD_LVM_TECH_VDO-%BD_LVM_TECH_MODE_MODIFY
1614 : */
1615 : gboolean bd_lvm_vdo_enable_compression (const gchar *vg_name, const gchar *pool_name, const BDExtraArg **extra, GError **error);
1616 :
1617 :
1618 : /**
1619 : * bd_lvm_vdo_disable_compression:
1620 : * @vg_name: name of the VG containing the to-be-changed VDO pool LV
1621 : * @pool_name: name of the VDO pool LV to disable compression on
1622 : * @extra: (nullable) (array zero-terminated=1): extra options for the VDO change
1623 : * (just passed to LVM as is)
1624 : * @error: (out) (optional): place to store error (if any)
1625 : *
1626 : * Returns: whether compression was successfully disabled on @vg_name/@pool_name LV or not
1627 : *
1628 : * Tech category: %BD_LVM_TECH_VDO-%BD_LVM_TECH_MODE_MODIFY
1629 : */
1630 : gboolean bd_lvm_vdo_disable_compression (const gchar *vg_name, const gchar *pool_name, const BDExtraArg **extra, GError **error);
1631 :
1632 :
1633 : /**
1634 : * bd_lvm_vdo_enable_deduplication:
1635 : * @vg_name: name of the VG containing the to-be-changed VDO pool LV
1636 : * @pool_name: name of the VDO pool LV to enable deduplication on
1637 : * @extra: (nullable) (array zero-terminated=1): extra options for the VDO change
1638 : * (just passed to LVM as is)
1639 : * @error: (out) (optional): place to store error (if any)
1640 : *
1641 : * Returns: whether deduplication was successfully enabled on @vg_name/@pool_name LV or not
1642 : *
1643 : * Tech category: %BD_LVM_TECH_VDO-%BD_LVM_TECH_MODE_MODIFY
1644 : */
1645 : gboolean bd_lvm_vdo_enable_deduplication (const gchar *vg_name, const gchar *pool_name, const BDExtraArg **extra, GError **error);
1646 :
1647 :
1648 : /**
1649 : * bd_lvm_vdo_disable_deduplication:
1650 : * @vg_name: name of the VG containing the to-be-changed VDO pool LV
1651 : * @pool_name: name of the VDO pool LV to disable deduplication on
1652 : * @extra: (nullable) (array zero-terminated=1): extra options for the VDO change
1653 : * (just passed to LVM as is)
1654 : * @error: (out) (optional): place to store error (if any)
1655 : *
1656 : * Returns: whether deduplication was successfully disabled on @vg_name/@pool_name LV or not
1657 : *
1658 : * Tech category: %BD_LVM_TECH_VDO-%BD_LVM_TECH_MODE_MODIFY
1659 : */
1660 : gboolean bd_lvm_vdo_disable_deduplication (const gchar *vg_name, const gchar *pool_name, const BDExtraArg **extra, GError **error);
1661 :
1662 :
1663 : /**
1664 : * bd_lvm_vdo_info:
1665 : * @vg_name: name of the VG that contains the LV to get information about
1666 : * @lv_name: name of the LV to get information about
1667 : * @error: (out) (optional): place to store error (if any)
1668 : *
1669 : * Returns: (transfer full): information about the @vg_name/@lv_name LV or %NULL in case
1670 : * of error (the @error) gets populated in those cases)
1671 : *
1672 : * Tech category: %BD_LVM_TECH_VDO-%BD_LVM_TECH_MODE_QUERY
1673 : */
1674 : BDLVMVDOPooldata* bd_lvm_vdo_info (const gchar *vg_name, const gchar *lv_name, GError **error);
1675 :
1676 :
1677 : /**
1678 : * bd_lvm_vdo_resize:
1679 : * @vg_name: name of the VG containing the to-be-resized VDO LV
1680 : * @lv_name: name of the to-be-resized VDO LV
1681 : * @size: the requested new size of the VDO LV
1682 : * @extra: (nullable) (array zero-terminated=1): extra options for the VDO LV resize
1683 : * (just passed to LVM as is)
1684 : * @error: (out) (optional): place to store error (if any)
1685 : *
1686 : * Returns: whether the @vg_name/@lv_name VDO LV was successfully resized or not
1687 : *
1688 : * Note: Reduction needs to process TRIM for reduced disk area to unmap used data blocks
1689 : * from the VDO pool LV and it may take a long time.
1690 : *
1691 : * Tech category: %BD_LVM_TECH_VDO-%BD_LVM_TECH_MODE_MODIFY
1692 : */
1693 : gboolean bd_lvm_vdo_resize (const gchar *vg_name, const gchar *lv_name, guint64 size, const BDExtraArg **extra, GError **error);
1694 :
1695 :
1696 : /**
1697 : * bd_lvm_vdo_pool_resize:
1698 : * @vg_name: name of the VG containing the to-be-resized VDO pool LV
1699 : * @pool_name: name of the to-be-resized VDO pool LV
1700 : * @size: the requested new size of the VDO pool LV
1701 : * @extra: (nullable) (array zero-terminated=1): extra options for the VDO pool LV resize
1702 : * (just passed to LVM as is)
1703 : * @error: (out) (optional): place to store error (if any)
1704 : *
1705 : * Returns: whether the @vg_name/@pool_name VDO pool LV was successfully resized or not
1706 : *
1707 : * Note: Size of the VDO pool LV can be only extended, not reduced.
1708 : *
1709 : * Tech category: %BD_LVM_TECH_VDO-%BD_LVM_TECH_MODE_MODIFY
1710 : */
1711 : gboolean bd_lvm_vdo_pool_resize (const gchar *vg_name, const gchar *pool_name, guint64 size, const BDExtraArg **extra, GError **error);
1712 :
1713 :
1714 : /**
1715 : * bd_lvm_vdo_pool_convert:
1716 : * @vg_name: name of the VG that contains @pool_lv
1717 : * @pool_lv: name of the LV that should become the new VDO pool LV
1718 : * @name: (nullable): name for the VDO LV or %NULL for default name
1719 : * @virtual_size: virtual size for the new VDO LV
1720 : * @index_memory: amount of index memory (in bytes) or 0 for default
1721 : * @compression: whether to enable compression or not
1722 : * @deduplication: whether to enable deduplication or not
1723 : * @write_policy: write policy for the volume
1724 : * @extra: (nullable) (array zero-terminated=1): extra options for the VDO pool creation
1725 : * (just passed to LVM as is)
1726 : * @error: (out) (optional): place to store error (if any)
1727 : *
1728 : * Converts the @pool_lv into a new VDO pool LV in the @vg_name VG and creates a new
1729 : * @name VDO LV with size @virtual_size.
1730 : *
1731 : * Note: All data on @pool_lv will be irreversibly destroyed.
1732 : *
1733 : * Returns: whether the new VDO pool LV was successfully created from @pool_lv and or not
1734 : *
1735 : * Tech category: %BD_LVM_TECH_VDO-%BD_LVM_TECH_MODE_CREATE&%BD_LVM_TECH_MODE_MODIFY
1736 : */
1737 : gboolean bd_lvm_vdo_pool_convert (const gchar *vg_name, const gchar *pool_lv, const gchar *name, guint64 virtual_size, guint64 index_memory, gboolean compression, gboolean deduplication, BDLVMVDOWritePolicy write_policy, const BDExtraArg **extra, GError **error);
1738 :
1739 :
1740 : /**
1741 : * bd_lvm_vdolvpoolname:
1742 : * @vg_name: name of the VG containing the queried VDO LV
1743 : * @lv_name: name of the queried VDO LV
1744 : * @error: (out) (optional): place to store error (if any)
1745 : *
1746 : * Returns: (transfer full): the name of the pool volume for the @vg_name/@lv_name
1747 : * VDO LV or %NULL if failed to determine (@error) is set in those cases)
1748 : *
1749 : * Tech category: %BD_LVM_TECH_VDO-%BD_LVM_TECH_MODE_QUERY
1750 : */
1751 : gchar* bd_lvm_vdolvpoolname (const gchar *vg_name, const gchar *lv_name, GError **error);
1752 :
1753 :
1754 : /**
1755 : * bd_lvm_get_vdo_operating_mode_str:
1756 : * @mode: mode to get the string representation for
1757 : * @error: (out) (optional): place to store error (if any)
1758 : *
1759 : * Returns: string representation of @mode or %NULL in case of error
1760 : *
1761 : * Tech category: always provided/supported
1762 : */
1763 : const gchar* bd_lvm_get_vdo_operating_mode_str (BDLVMVDOOperatingMode mode, GError **error);
1764 :
1765 :
1766 : /**
1767 : * bd_lvm_get_vdo_compression_state_str:
1768 : * @state: state to get the string representation for
1769 : * @error: (out) (optional): place to store error (if any)
1770 : *
1771 : * Returns: string representation of @state or %NULL in case of error
1772 : *
1773 : * Tech category: always provided/supported
1774 : */
1775 : const gchar* bd_lvm_get_vdo_compression_state_str (BDLVMVDOCompressionState state, GError **error);
1776 :
1777 :
1778 : /**
1779 : * bd_lvm_get_vdo_index_state_str:
1780 : * @state: state to get the string representation for
1781 : * @error: (out) (optional): place to store error (if any)
1782 : *
1783 : * Returns: string representation of @state or %NULL in case of error
1784 : *
1785 : * Tech category: always provided/supported
1786 : */
1787 : const gchar* bd_lvm_get_vdo_index_state_str (BDLVMVDOIndexState state, GError **error);
1788 :
1789 :
1790 : /**
1791 : * bd_lvm_get_vdo_write_policy_str:
1792 : * @policy: policy to get the string representation for
1793 : * @error: (out) (optional): place to store error (if any)
1794 : *
1795 : * Returns: string representation of @policy or %NULL in case of error
1796 : *
1797 : * Tech category: always provided/supported
1798 : */
1799 : const gchar* bd_lvm_get_vdo_write_policy_str (BDLVMVDOWritePolicy policy, GError **error);
1800 :
1801 :
1802 : /**
1803 : * bd_lvm_get_vdo_write_policy_from_str:
1804 : * @policy_str: string representation of a policy
1805 : * @error: (out) (optional): place to store error (if any)
1806 : *
1807 : * Returns: write policy for the @policy_str or %BD_LVM_VDO_WRITE_POLICY_UNKNOWN if
1808 : * failed to determine
1809 : *
1810 : * Tech category: always provided/supported
1811 : */
1812 : BDLVMVDOWritePolicy bd_lvm_get_vdo_write_policy_from_str (const gchar *policy_str, GError **error);
1813 :
1814 :
1815 : /**
1816 : * bd_lvm_vdo_get_stats_full:
1817 : * @vg_name: name of the VG that contains @pool_name VDO pool
1818 : * @pool_name: name of the VDO pool to get statistics for
1819 : * @error: (out) (optional): place to store error (if any)
1820 : *
1821 : * Returns: (transfer full) (element-type utf8 utf8): hashtable of type string - string of available
1822 : * statistics or %NULL in case of error
1823 : * (@error gets populated in those cases)
1824 : *
1825 : * Statistics are collected from the values exposed by the kernel `dm-vdo` module.
1826 : *
1827 : * Some of the keys are computed to mimic the information produced by the vdo tools.
1828 : * Please note the contents of the hashtable may vary depending on the actual dm-vdo module version.
1829 : *
1830 : * Tech category: %BD_LVM_TECH_VDO-%BD_LVM_TECH_MODE_QUERY
1831 : */
1832 : GHashTable* bd_lvm_vdo_get_stats_full (const gchar *vg_name, const gchar *pool_name, GError **error);
1833 :
1834 :
1835 : /**
1836 : * bd_lvm_vdo_get_stats:
1837 : * @vg_name: name of the VG that contains @pool_name VDO pool
1838 : * @pool_name: name of the VDO pool to get statistics for
1839 : * @error: (out) (optional): place to store error (if any)
1840 : *
1841 : * Returns: (transfer full): a structure containing selected statistics or %NULL in case of error
1842 : * (@error gets populated in those cases)
1843 : *
1844 : * In contrast to @bd_lvm_vdo_get_stats_full this function will only return selected statistics
1845 : * in a fixed structure. In case a value is not available, -1 would be returned.
1846 : *
1847 : * Tech category: %BD_LVM_TECH_VDO-%BD_LVM_TECH_MODE_QUERY
1848 : */
1849 : BDLVMVDOStats* bd_lvm_vdo_get_stats (const gchar *vg_name, const gchar *pool_name, GError **error);
1850 :
1851 :
1852 : /**
1853 : * bd_lvm_devices_add:
1854 : * @device: device (PV) to add to the devices file
1855 : * @devices_file: (nullable): LVM devices file or %NULL for default
1856 : * @extra: (nullable) (array zero-terminated=1): extra options for the lvmdevices command
1857 : * @error: (out) (optional): place to store error (if any)
1858 : *
1859 : * Returns: whether the @device was successfully added to @devices_file or not
1860 : *
1861 : * Tech category: %BD_LVM_TECH_DEVICES no mode (it is ignored)
1862 : */
1863 : gboolean bd_lvm_devices_add (const gchar *device, const gchar *devices_file, const BDExtraArg **extra, GError **error);
1864 :
1865 :
1866 : /**
1867 : * bd_lvm_devices_delete:
1868 : * @device: device (PV) to delete from the devices file
1869 : * @devices_file: (nullable): LVM devices file or %NULL for default
1870 : * @extra: (nullable) (array zero-terminated=1): extra options for the lvmdevices command
1871 : * @error: (out) (optional): place to store error (if any)
1872 : *
1873 : * Returns: whether the @device was successfully removed from @devices_file or not
1874 : *
1875 : * Tech category: %BD_LVM_TECH_DEVICES no mode (it is ignored)
1876 : */
1877 : gboolean bd_lvm_devices_delete (const gchar *device, const gchar *devices_file, const BDExtraArg **extra, GError **error);
1878 :
1879 :
1880 : /**
1881 : * bd_lvm_config_get:
1882 : * @section: (nullable): LVM config section, e.g. 'global' or %NULL to print the entire config
1883 : * @setting: (nullable): name of the specific setting, e.g. 'umask' or %NULL to print the entire @section
1884 : * @type: type of the config, e.g. 'full' or 'current'
1885 : * @values_only: whether to include only values without keys in the output
1886 : * @global_config: whether to include our internal global config in the call or not
1887 : * @extra: (nullable) (array zero-terminated=1): extra options for the lvmconfig command
1888 : * (just passed to LVM as is)
1889 : * @error: (out) (optional): place to store error (if any)
1890 : *
1891 : * Returns: (transfer full): Requested LVM config @section and @setting configuration or %NULL in case of error.
1892 : *
1893 : * Tech category: %BD_LVM_TECH_CONFIG no mode (it is ignored)
1894 : */
1895 : gchar* bd_lvm_config_get (const gchar *section, const gchar *setting, const gchar *type, gboolean values_only, gboolean global_config, const BDExtraArg **extra, GError **error);
1896 :
1897 :
1898 : /**
1899 : * bd_lvm_vgcfgbackup:
1900 : * @vg_name: name of the VG to backup configuration
1901 : * @backup_file: (nullable): file to save the backup to or %NULL for using the default backup file
1902 : * in /etc/lvm/backup
1903 : * @extra: (nullable) (array zero-terminated=1): extra options for the vgcfgbackup command
1904 : * (just passed to LVM as is)
1905 : * @error: (out) (optional): place to store error (if any)
1906 : *
1907 : * Note: This function does not back up the data content of LVs. See `vgcfbackup(8)` man page
1908 : * for more information.
1909 : *
1910 : * Returns: Whether the backup was successfully created or not.
1911 : *
1912 : * Tech category: %BD_LVM_TECH_VG_CFG_BACKUP_RESTORE no mode (it is ignored)
1913 : */
1914 : gboolean bd_lvm_vgcfgbackup (const gchar *vg_name, const gchar *backup_file, const BDExtraArg **extra, GError **error);
1915 :
1916 :
1917 : /**
1918 : * bd_lvm_vgcfgrestore:
1919 : * @vg_name: name of the VG to restore configuration
1920 : * @backup_file: (nullable): file to restore VG configuration from to or %NULL for using the
1921 : * latest backup in /etc/lvm/backup
1922 : * @extra: (nullable) (array zero-terminated=1): extra options for the vgcfgrestore command
1923 : * (just passed to LVM as is)
1924 : * @error: (out) (optional): place to store error (if any)
1925 : *
1926 : * Note: This function restores VG configuration created by %bd_lvm_vgcfgbackup from given
1927 : * @backup_file or from the latest backup in /etc/lvm/backup.
1928 : *
1929 : * Returns: Whether the configuration was successfully restored or not.
1930 : *
1931 : * Tech category: %BD_LVM_TECH_VG_CFG_BACKUP_RESTORE no mode (it is ignored)
1932 : */
1933 : gboolean bd_lvm_vgcfgrestore (const gchar *vg_name, const gchar *backup_file, const BDExtraArg **extra, GError **error);
1934 :
1935 :
1936 : #endif /* BD_LVM_API */
|