]>
sourceware.org Git - lvm2.git/blob - lib/activate/activate.c
2 * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
3 * Copyright (C) 2004-2009 Red Hat, Inc. All rights reserved.
5 * This file is part of LVM2.
7 * This copyrighted material is made available to anyone wishing to use,
8 * modify, copy, or redistribute it subject to the terms and conditions
9 * of the GNU Lesser General Public License v.2.1.
11 * You should have received a copy of the GNU Lesser General Public License
12 * along with this program; if not, write to the Free Software Foundation,
13 * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 #include "lvm-string.h"
25 #include "toolcontext.h"
26 #include "dev_manager.h"
36 #define _skip(fmt, args...) log_very_verbose("Skipping: " fmt , ## args)
38 int lvm1_present(struct cmd_context
*cmd
)
42 if (dm_snprintf(path
, sizeof(path
), "%s/lvm/global", cmd
->proc_dir
)
44 log_error("LVM1 proc global snprintf failed");
48 if (path_exists(path
))
54 int list_segment_modules(struct dm_pool
*mem
, const struct lv_segment
*seg
,
55 struct dm_list
*modules
)
58 struct lv_segment
*seg2
, *snap_seg
;
61 if (seg
->segtype
->ops
->modules_needed
&&
62 !seg
->segtype
->ops
->modules_needed(mem
, seg
, modules
)) {
63 log_error("module string allocation failed");
67 if (lv_is_origin(seg
->lv
))
68 dm_list_iterate(snh
, &seg
->lv
->snapshot_segs
)
69 if (!list_lv_modules(mem
,
70 dm_list_struct_base(snh
,
76 if (lv_is_cow(seg
->lv
)) {
77 snap_seg
= find_cow(seg
->lv
);
78 if (snap_seg
->segtype
->ops
->modules_needed
&&
79 !snap_seg
->segtype
->ops
->modules_needed(mem
, snap_seg
,
81 log_error("snap_seg module string allocation failed");
86 for (s
= 0; s
< seg
->area_count
; s
++) {
87 switch (seg_type(seg
, s
)) {
89 seg2
= find_seg_by_le(seg_lv(seg
, s
), seg_le(seg
, s
));
90 if (seg2
&& !list_segment_modules(mem
, seg2
, modules
))
102 int list_lv_modules(struct dm_pool
*mem
, const struct logical_volume
*lv
,
103 struct dm_list
*modules
)
105 struct lv_segment
*seg
;
107 dm_list_iterate_items(seg
, &lv
->segments
)
108 if (!list_segment_modules(mem
, seg
, modules
))
114 #ifndef DEVMAPPER_SUPPORT
115 void set_activation(int act
)
117 static int warned
= 0;
122 log_error("Compiled without libdevmapper support. "
123 "Can't enable activation.");
131 int library_version(char *version
, size_t size
)
135 int driver_version(char *version
, size_t size
)
139 int target_version(const char *target_name
, uint32_t *maj
,
140 uint32_t *min
, uint32_t *patchlevel
)
144 int target_present(struct cmd_context
*cmd
, const char *target_name
,
149 int lv_info(struct cmd_context
*cmd
, const struct logical_volume
*lv
, struct lvinfo
*info
,
150 int with_open_count
, int with_read_ahead
)
154 int lv_info_by_lvid(struct cmd_context
*cmd
, const char *lvid_s
,
155 struct lvinfo
*info
, int with_open_count
, int with_read_ahead
)
159 int lv_snapshot_percent(const struct logical_volume
*lv
, float *percent
,
160 percent_range_t
*percent_range
)
164 int lv_mirror_percent(struct cmd_context
*cmd
, struct logical_volume
*lv
,
165 int wait
, float *percent
, percent_range_t
*percent_range
,
170 int lvs_in_vg_activated(struct volume_group
*vg
)
174 int lvs_in_vg_activated_by_uuid_only(struct volume_group
*vg
)
178 int lvs_in_vg_opened(struct volume_group
*vg
)
182 int lv_suspend(struct cmd_context
*cmd
, const char *lvid_s
)
186 int lv_suspend_if_active(struct cmd_context
*cmd
, const char *lvid_s
)
190 int lv_resume(struct cmd_context
*cmd
, const char *lvid_s
)
194 int lv_resume_if_active(struct cmd_context
*cmd
, const char *lvid_s
)
198 int lv_deactivate(struct cmd_context
*cmd
, const char *lvid_s
)
202 int lv_activation_filter(struct cmd_context
*cmd
, const char *lvid_s
,
207 int lv_activate(struct cmd_context
*cmd
, const char *lvid_s
, int exclusive
)
211 int lv_activate_with_filter(struct cmd_context
*cmd
, const char *lvid_s
, int exclusive
)
216 int lv_mknodes(struct cmd_context
*cmd
, const struct logical_volume
*lv
)
221 int pv_uses_vg(struct physical_volume
*pv
,
222 struct volume_group
*vg
)
227 void activation_release(void)
232 void activation_exit(void)
237 #else /* DEVMAPPER_SUPPORT */
239 static int _activation
= 1;
241 void set_activation(int act
)
243 if (act
== _activation
)
248 log_verbose("Activation enabled. Device-mapper kernel "
249 "driver will be used.");
251 log_warn("WARNING: Activation disabled. No device-mapper "
252 "interaction will be attempted.");
260 static int _passes_activation_filter(struct cmd_context
*cmd
,
261 struct logical_volume
*lv
)
263 const struct config_node
*cn
;
264 struct config_value
*cv
;
268 if (!(cn
= find_config_tree_node(cmd
, "activation/volume_list"))) {
269 /* If no host tags defined, activate */
270 if (dm_list_empty(&cmd
->tags
))
273 /* If any host tag matches any LV or VG tag, activate */
274 if (str_list_match_list(&cmd
->tags
, &lv
->tags
) ||
275 str_list_match_list(&cmd
->tags
, &lv
->vg
->tags
))
282 for (cv
= cn
->v
; cv
; cv
= cv
->next
) {
283 if (cv
->type
!= CFG_STRING
) {
284 log_error("Ignoring invalid string in config file "
285 "activation/volume_list");
290 log_error("Ignoring empty string in config file "
291 "activation/volume_list");
299 log_error("Ignoring empty tag in config file "
300 "activation/volume_list");
303 /* If any host tag matches any LV or VG tag, activate */
304 if (!strcmp(str
, "*")) {
305 if (str_list_match_list(&cmd
->tags
, &lv
->tags
)
306 || str_list_match_list(&cmd
->tags
,
312 /* If supplied tag matches LV or VG tag, activate */
313 if (str_list_match_item(&lv
->tags
, str
) ||
314 str_list_match_item(&lv
->vg
->tags
, str
))
319 if (!strchr(str
, '/')) {
320 /* vgname supplied */
321 if (!strcmp(str
, lv
->vg
->name
))
327 if (dm_snprintf(path
, sizeof(path
), "%s/%s", lv
->vg
->name
,
329 log_error("dm_snprintf error from %s/%s", lv
->vg
->name
,
333 if (!strcmp(path
, str
))
340 int library_version(char *version
, size_t size
)
345 return dm_get_library_version(version
, size
);
348 int driver_version(char *version
, size_t size
)
353 log_very_verbose("Getting driver version");
355 return dm_driver_version(version
, size
);
358 int target_version(const char *target_name
, uint32_t *maj
,
359 uint32_t *min
, uint32_t *patchlevel
)
363 struct dm_versions
*target
, *last_target
;
365 log_very_verbose("Getting target version for %s", target_name
);
366 if (!(dmt
= dm_task_create(DM_DEVICE_LIST_VERSIONS
)))
369 if (!dm_task_run(dmt
)) {
370 log_debug("Failed to get %s target version", target_name
);
371 /* Assume this was because LIST_VERSIONS isn't supported */
375 target
= dm_task_get_versions(dmt
);
378 last_target
= target
;
380 if (!strcmp(target_name
, target
->name
)) {
382 *maj
= target
->version
[0];
383 *min
= target
->version
[1];
384 *patchlevel
= target
->version
[2];
388 target
= (void *) target
+ target
->next
;
389 } while (last_target
!= target
);
392 dm_task_destroy(dmt
);
397 int module_present(struct cmd_context
*cmd
, const char *target_name
)
404 if (dm_snprintf(module
, sizeof(module
), "dm-%s", target_name
) < 0) {
405 log_error("module_present module name too long: %s",
410 argv
[0] = MODPROBE_CMD
;
414 ret
= exec_cmd(cmd
, argv
);
419 int target_present(struct cmd_context
*cmd
, const char *target_name
,
422 uint32_t maj
, min
, patchlevel
;
429 if (target_version(target_name
, &maj
, &min
, &patchlevel
))
432 if (!module_present(cmd
, target_name
))
437 return target_version(target_name
, &maj
, &min
, &patchlevel
);
441 * Returns 1 if info structure populated, else 0 on failure.
443 static int _lv_info(struct cmd_context
*cmd
, const struct logical_volume
*lv
, int with_mknodes
,
444 struct lvinfo
*info
, int with_open_count
, int with_read_ahead
, unsigned by_uuid_only
)
446 struct dm_info dminfo
;
453 !(name
= build_dm_name(cmd
->mem
, lv
->vg
->name
, lv
->name
, NULL
)))
456 log_debug("Getting device info for %s", name
);
457 if (!dev_manager_info(lv
->vg
->cmd
->mem
, name
, lv
, with_mknodes
,
458 with_open_count
, with_read_ahead
, &dminfo
,
459 &info
->read_ahead
)) {
461 dm_pool_free(cmd
->mem
, name
);
465 info
->exists
= dminfo
.exists
;
466 info
->suspended
= dminfo
.suspended
;
467 info
->open_count
= dminfo
.open_count
;
468 info
->major
= dminfo
.major
;
469 info
->minor
= dminfo
.minor
;
470 info
->read_only
= dminfo
.read_only
;
471 info
->live_table
= dminfo
.live_table
;
472 info
->inactive_table
= dminfo
.inactive_table
;
475 dm_pool_free(cmd
->mem
, name
);
480 int lv_info(struct cmd_context
*cmd
, const struct logical_volume
*lv
, struct lvinfo
*info
,
481 int with_open_count
, int with_read_ahead
)
483 return _lv_info(cmd
, lv
, 0, info
, with_open_count
, with_read_ahead
, 0);
486 int lv_info_by_lvid(struct cmd_context
*cmd
, const char *lvid_s
,
487 struct lvinfo
*info
, int with_open_count
, int with_read_ahead
)
489 struct logical_volume
*lv
;
491 if (!(lv
= lv_from_lvid(cmd
, lvid_s
, 0)))
494 return _lv_info(cmd
, lv
, 0, info
, with_open_count
, with_read_ahead
, 0);
498 * Returns 1 if percent set, else 0 on failure.
500 int lv_snapshot_percent(const struct logical_volume
*lv
, float *percent
,
501 percent_range_t
*percent_range
)
504 struct dev_manager
*dm
;
509 if (!(dm
= dev_manager_create(lv
->vg
->cmd
, lv
->vg
->name
)))
512 if (!(r
= dev_manager_snapshot_percent(dm
, lv
, percent
, percent_range
)))
515 dev_manager_destroy(dm
);
520 /* FIXME Merge with snapshot_percent */
521 int lv_mirror_percent(struct cmd_context
*cmd
, struct logical_volume
*lv
,
522 int wait
, float *percent
, percent_range_t
*percent_range
,
526 struct dev_manager
*dm
;
529 /* If mirrored LV is temporarily shrinked to 1 area (= linear),
530 * it should be considered in-sync. */
531 if (dm_list_size(&lv
->segments
) == 1 && first_seg(lv
)->area_count
== 1) {
539 if (!lv_info(cmd
, lv
, &info
, 0, 0))
545 if (!(dm
= dev_manager_create(lv
->vg
->cmd
, lv
->vg
->name
)))
548 if (!(r
= dev_manager_mirror_percent(dm
, lv
, wait
, percent
,
549 percent_range
, event_nr
)))
552 dev_manager_destroy(dm
);
557 static int _lv_active(struct cmd_context
*cmd
, struct logical_volume
*lv
,
558 unsigned by_uuid_only
)
562 if (!_lv_info(cmd
, lv
, 0, &info
, 0, 0, by_uuid_only
)) {
570 static int _lv_open_count(struct cmd_context
*cmd
, struct logical_volume
*lv
)
574 if (!lv_info(cmd
, lv
, &info
, 1, 0)) {
579 return info
.open_count
;
582 static int _lv_activate_lv(struct logical_volume
*lv
)
585 struct dev_manager
*dm
;
587 if (!(dm
= dev_manager_create(lv
->vg
->cmd
, lv
->vg
->name
)))
590 if (!(r
= dev_manager_activate(dm
, lv
)))
593 dev_manager_destroy(dm
);
597 static int _lv_preload(struct logical_volume
*lv
, int *flush_required
)
600 struct dev_manager
*dm
;
602 if (!(dm
= dev_manager_create(lv
->vg
->cmd
, lv
->vg
->name
)))
605 if (!(r
= dev_manager_preload(dm
, lv
, flush_required
)))
608 dev_manager_destroy(dm
);
612 static int _lv_deactivate(struct logical_volume
*lv
)
615 struct dev_manager
*dm
;
617 if (!(dm
= dev_manager_create(lv
->vg
->cmd
, lv
->vg
->name
)))
620 if (!(r
= dev_manager_deactivate(dm
, lv
)))
623 dev_manager_destroy(dm
);
627 static int _lv_suspend_lv(struct logical_volume
*lv
, int lockfs
, int flush_required
)
630 struct dev_manager
*dm
;
632 if (!(dm
= dev_manager_create(lv
->vg
->cmd
, lv
->vg
->name
)))
635 if (!(r
= dev_manager_suspend(dm
, lv
, lockfs
, flush_required
)))
638 dev_manager_destroy(dm
);
643 * These two functions return the number of visible LVs in the state,
646 static int _lvs_in_vg_activated(struct volume_group
*vg
, unsigned by_uuid_only
)
654 dm_list_iterate_items(lvl
, &vg
->lvs
) {
655 if (lv_is_visible(lvl
->lv
))
656 count
+= (_lv_active(vg
->cmd
, lvl
->lv
, by_uuid_only
) == 1);
662 int lvs_in_vg_activated_by_uuid_only(struct volume_group
*vg
)
664 return _lvs_in_vg_activated(vg
, 1);
667 int lvs_in_vg_activated(struct volume_group
*vg
)
669 return _lvs_in_vg_activated(vg
, 0);
672 int lvs_in_vg_opened(const struct volume_group
*vg
)
674 const struct lv_list
*lvl
;
680 dm_list_iterate_items(lvl
, &vg
->lvs
) {
681 if (lv_is_visible(lvl
->lv
))
682 count
+= (_lv_open_count(vg
->cmd
, lvl
->lv
) > 0);
689 * Determine whether an LV is active locally or in a cluster.
690 * Assumes vg lock held.
692 * 0 - not active locally or on any node in cluster
693 * 1 - active either locally or some node in the cluster
695 int lv_is_active(struct logical_volume
*lv
)
699 if (_lv_active(lv
->vg
->cmd
, lv
, 0))
702 if (!vg_is_clustered(lv
->vg
))
705 if ((ret
= remote_lock_held(lv
->lvid
.s
)) >= 0)
709 * Old compatibility code if locking doesn't support lock query
710 * FIXME: check status to not deactivate already activate device
712 if (activate_lv_excl(lv
->vg
->cmd
, lv
)) {
713 deactivate_lv(lv
->vg
->cmd
, lv
);
718 * Exclusive local activation failed so assume it is active elsewhere.
724 * Returns 0 if an attempt to (un)monitor the device failed.
725 * Returns 1 otherwise.
727 int monitor_dev_for_events(struct cmd_context
*cmd
,
728 struct logical_volume
*lv
, int monitor
)
731 int i
, pending
= 0, monitored
;
733 struct dm_list
*tmp
, *snh
, *snht
;
734 struct lv_segment
*seg
;
735 int (*monitor_fn
) (struct lv_segment
*s
, int e
);
738 /* skip dmeventd code altogether */
739 if (dmeventd_monitor_mode() == DMEVENTD_MONITOR_IGNORE
)
743 * Nothing to do if dmeventd configured not to be used.
745 if (monitor
&& !dmeventd_monitor_mode())
749 * In case of a snapshot device, we monitor lv->snapshot->lv,
750 * not the actual LV itself.
753 return monitor_dev_for_events(cmd
, lv
->snapshot
->lv
, monitor
);
756 * In case this LV is a snapshot origin, we instead monitor
757 * each of its respective snapshots (the origin itself does
758 * not need to be monitored).
760 * TODO: This may change when snapshots of mirrors are allowed.
762 if (lv_is_origin(lv
)) {
763 dm_list_iterate_safe(snh
, snht
, &lv
->snapshot_segs
)
764 if (!monitor_dev_for_events(cmd
, dm_list_struct_base(snh
,
765 struct lv_segment
, origin_list
)->cow
, monitor
))
770 dm_list_iterate(tmp
, &lv
->segments
) {
771 seg
= dm_list_item(tmp
, struct lv_segment
);
773 /* Recurse for AREA_LV */
774 for (s
= 0; s
< seg
->area_count
; s
++) {
775 if (seg_type(seg
, s
) != AREA_LV
)
777 if (!monitor_dev_for_events(cmd
, seg_lv(seg
, s
),
779 log_error("Failed to %smonitor %s",
781 seg_lv(seg
, s
)->name
);
786 if (!seg_monitored(seg
) || (seg
->status
& PVMOVE
))
791 /* Check monitoring status */
792 if (seg
->segtype
->ops
->target_monitored
)
793 monitored
= seg
->segtype
->ops
->target_monitored(seg
, &pending
);
795 continue; /* segtype doesn't support registration */
798 * FIXME: We should really try again if pending
800 monitored
= (pending
) ? 0 : monitored
;
804 log_verbose("%s/%s already monitored.", lv
->vg
->name
, lv
->name
);
805 else if (seg
->segtype
->ops
->target_monitor_events
)
806 monitor_fn
= seg
->segtype
->ops
->target_monitor_events
;
809 log_verbose("%s/%s already not monitored.", lv
->vg
->name
, lv
->name
);
810 else if (seg
->segtype
->ops
->target_unmonitor_events
)
811 monitor_fn
= seg
->segtype
->ops
->target_unmonitor_events
;
818 log_verbose("%sonitoring %s/%s", monitor
? "M" : "Not m", lv
->vg
->name
, lv
->name
);
820 /* FIXME specify events */
821 if (!monitor_fn(seg
, 0)) {
822 log_error("%s/%s: %s segment monitoring function failed.",
823 lv
->vg
->name
, lv
->name
, seg
->segtype
->name
);
827 /* Check [un]monitor results */
828 /* Try a couple times if pending, but not forever... */
829 for (i
= 0; i
< 10; i
++) {
831 monitored
= seg
->segtype
->ops
->target_monitored(seg
, &pending
);
833 (!monitored
&& monitor
) ||
834 (monitored
&& !monitor
))
835 log_very_verbose("%s/%s %smonitoring still pending: waiting...",
836 lv
->vg
->name
, lv
->name
, monitor
? "" : "un");
842 r
= (monitored
&& monitor
) || (!monitored
&& !monitor
);
851 static int _lv_suspend(struct cmd_context
*cmd
, const char *lvid_s
,
852 int error_if_not_suspended
)
854 struct logical_volume
*lv
= NULL
, *lv_pre
= NULL
;
856 int r
= 0, lockfs
= 0, flush_required
= 0;
861 if (!(lv
= lv_from_lvid(cmd
, lvid_s
, 0)))
864 /* Use precommitted metadata if present */
865 if (!(lv_pre
= lv_from_lvid(cmd
, lvid_s
, 1)))
869 _skip("Suspending '%s'.", lv
->name
);
874 if (!lv_info(cmd
, lv
, &info
, 0, 0))
877 if (!info
.exists
|| info
.suspended
) {
878 r
= error_if_not_suspended
? 0 : 1;
882 lv_calculate_readahead(lv
, NULL
);
884 /* If VG was precommitted, preload devices for the LV */
885 if ((lv_pre
->vg
->status
& PRECOMMITTED
)) {
886 if (!_lv_preload(lv_pre
, &flush_required
)) {
887 /* FIXME Revert preloading */
892 if (!monitor_dev_for_events(cmd
, lv
, 0))
893 /* FIXME Consider aborting here */
898 if (lv_is_origin(lv_pre
) || lv_is_cow(lv_pre
))
901 if (!_lv_suspend_lv(lv
, lockfs
, flush_required
)) {
910 vg_release(lv_pre
->vg
);
917 /* Returns success if the device is not active */
918 int lv_suspend_if_active(struct cmd_context
*cmd
, const char *lvid_s
)
920 return _lv_suspend(cmd
, lvid_s
, 0);
923 int lv_suspend(struct cmd_context
*cmd
, const char *lvid_s
)
925 return _lv_suspend(cmd
, lvid_s
, 1);
928 static int _lv_resume(struct cmd_context
*cmd
, const char *lvid_s
,
929 int error_if_not_active
)
931 struct logical_volume
*lv
;
938 if (!(lv
= lv_from_lvid(cmd
, lvid_s
, 0)))
942 _skip("Resuming '%s'.", lv
->name
);
947 if (!lv_info(cmd
, lv
, &info
, 0, 0))
950 if (!info
.exists
|| !info
.suspended
) {
951 r
= error_if_not_active
? 0 : 1;
955 if (!_lv_activate_lv(lv
))
961 if (!monitor_dev_for_events(cmd
, lv
, 1))
972 /* Returns success if the device is not active */
973 int lv_resume_if_active(struct cmd_context
*cmd
, const char *lvid_s
)
975 return _lv_resume(cmd
, lvid_s
, 0);
978 int lv_resume(struct cmd_context
*cmd
, const char *lvid_s
)
980 return _lv_resume(cmd
, lvid_s
, 1);
983 static int _lv_has_open_snapshots(struct logical_volume
*lv
)
985 struct lv_segment
*snap_seg
;
989 dm_list_iterate_items_gen(snap_seg
, &lv
->snapshot_segs
, origin_list
) {
990 if (!lv_info(lv
->vg
->cmd
, snap_seg
->cow
, &info
, 1, 0)) {
995 if (info
.exists
&& info
.open_count
) {
996 log_error("LV %s/%s has open snapshot %s: "
997 "not deactivating", lv
->vg
->name
, lv
->name
,
998 snap_seg
->cow
->name
);
1006 int lv_deactivate(struct cmd_context
*cmd
, const char *lvid_s
)
1008 struct logical_volume
*lv
;
1015 if (!(lv
= lv_from_lvid(cmd
, lvid_s
, 0)))
1019 _skip("Deactivating '%s'.", lv
->name
);
1024 if (!lv_info(cmd
, lv
, &info
, 1, 0))
1032 if (lv_is_visible(lv
)) {
1033 if (info
.open_count
) {
1034 log_error("LV %s/%s in use: not deactivating",
1035 lv
->vg
->name
, lv
->name
);
1038 if (lv_is_origin(lv
) && _lv_has_open_snapshots(lv
))
1042 lv_calculate_readahead(lv
, NULL
);
1044 if (!monitor_dev_for_events(cmd
, lv
, 0))
1048 r
= _lv_deactivate(lv
);
1052 if (!lv_info(cmd
, lv
, &info
, 1, 0) || info
.exists
)
1061 /* Test if LV passes filter */
1062 int lv_activation_filter(struct cmd_context
*cmd
, const char *lvid_s
,
1065 struct logical_volume
*lv
;
1068 if (!activation()) {
1073 if (!(lv
= lv_from_lvid(cmd
, lvid_s
, 0)))
1076 if (!_passes_activation_filter(cmd
, lv
)) {
1077 log_verbose("Not activating %s/%s due to config file settings",
1078 lv
->vg
->name
, lv
->name
);
1090 static int _lv_activate(struct cmd_context
*cmd
, const char *lvid_s
,
1091 int exclusive
, int filter
)
1093 struct logical_volume
*lv
;
1100 if (!(lv
= lv_from_lvid(cmd
, lvid_s
, 0)))
1103 if (filter
&& !_passes_activation_filter(cmd
, lv
)) {
1104 log_verbose("Not activating %s/%s due to config file settings",
1105 lv
->vg
->name
, lv
->name
);
1109 if ((!lv
->vg
->cmd
->partial_activation
) && (lv
->status
& PARTIAL_LV
)) {
1110 log_error("Refusing activation of partial LV %s. Use --partial to override.",
1116 _skip("Activating '%s'.", lv
->name
);
1121 if (!lv_info(cmd
, lv
, &info
, 0, 0))
1124 if (info
.exists
&& !info
.suspended
&& info
.live_table
) {
1129 lv_calculate_readahead(lv
, NULL
);
1132 lv
->status
|= ACTIVATE_EXCL
;
1135 r
= _lv_activate_lv(lv
);
1139 if (r
&& !monitor_dev_for_events(cmd
, lv
, 1))
1150 int lv_activate(struct cmd_context
*cmd
, const char *lvid_s
, int exclusive
)
1152 return _lv_activate(cmd
, lvid_s
, exclusive
, 0);
1155 /* Activate LV only if it passes filter */
1156 int lv_activate_with_filter(struct cmd_context
*cmd
, const char *lvid_s
, int exclusive
)
1158 return _lv_activate(cmd
, lvid_s
, exclusive
, 1);
1161 int lv_mknodes(struct cmd_context
*cmd
, const struct logical_volume
*lv
)
1167 r
= dm_mknodes(NULL
);
1172 if (!_lv_info(cmd
, lv
, 1, &info
, 0, 0, 0))
1176 if (lv_is_visible(lv
))
1177 r
= dev_manager_lv_mknodes(lv
);
1179 r
= dev_manager_lv_rmnodes(lv
);
1187 * Does PV use VG somewhere in its construction?
1188 * Returns 1 on failure.
1190 int pv_uses_vg(struct physical_volume
*pv
,
1191 struct volume_group
*vg
)
1196 if (!dm_is_dm_major(MAJOR(pv
->dev
->dev
)))
1199 return dev_manager_device_uses_vg(pv
->dev
, vg
);
1202 void activation_release(void)
1204 dev_manager_release();
1207 void activation_exit(void)
This page took 0.08878 seconds and 6 git commands to generate.