return 1;
}
+static int _targets_present(struct dev_manager *dm, struct list *lvs)
+{
+ struct logical_volume *lv;
+ struct list *lvh;
+ struct segment_type *segtype;
+ int snapshots = 0, mirrors = 0;
+
+ list_iterate(lvh, lvs) {
+ lv = list_item(lvh, struct lv_list)->lv;
+
+ if (!snapshots)
+ if (lv_is_cow(lv) || lv_is_origin(lv))
+ snapshots = 1;
+
+ if (!mirrors)
+ if (lv->status & PVMOVE)
+ mirrors = 1;
+ }
+
+ if (mirrors) {
+ if (!(segtype = get_segtype_from_string(dm->cmd, "mirror"))) {
+ log_error("Can't expand LV: Mirror support "
+ "missing from tools?");
+ return 0;
+ }
+
+ if (!segtype->ops->target_present ||
+ !segtype->ops->target_present()) {
+ log_error("Can't expand LV: Mirror support missing "
+ "from kernel?");
+ return 0;
+ }
+ }
+
+ if (snapshots) {
+ if (!(segtype = get_segtype_from_string(dm->cmd, "snapshot"))) {
+ log_error("Can't expand LV: Snapshot support "
+ "missing from tools?");
+ return 0;
+ }
+
+ if (!segtype->ops->target_present ||
+ !segtype->ops->target_present()) {
+ log_error("Can't expand LV: Snapshot support missing "
+ "from kernel?");
+ return 0;
+ }
+ }
+
+ return 1;
+}
+
static int _fill_in_active_list(struct dev_manager *dm, struct volume_group *vg)
{
char *dlid;
}
}
+ if (!_targets_present(dm, &dm->active_list) ||
+ !_targets_present(dm, &dm->reload_list)) {
+ stack;
+ return 0;
+ }
+
if (!_execute(dm, lv->vg)) {
stack;
return 0;
#include "defaults.h"
#include "lvm-string.h"
#include "targets.h"
+#include "activate.h"
enum {
MIRR_DISABLED,
return 1;
}
+
+static int _target_present(void)
+{
+ static int checked = 0;
+ static int present = 0;
+
+ if (!checked)
+ present = target_present("mirror");
+
+ checked = 1;
+
+ return present;
+}
#endif
static void _destroy(const struct segment_type *segtype)
#ifdef DEVMAPPER_SUPPORT
compose_target_line:_compose_target_line,
target_percent:_target_percent,
+ target_present:_target_present,
#endif
destroy:_destroy,
};
#include "segtypes.h"
#include "text_export.h"
#include "config.h"
+#include "activate.h"
static const char *_name(const struct lv_segment *seg)
{
return 1;
}
+#ifdef DEVMAPPER_SUPPORT
static int _target_percent(void **target_state, struct pool *mem,
struct config_tree *cft, struct lv_segment *seg,
char *params, uint64_t *total_numerator,
return 1;
}
+static int _target_present(void)
+{
+ static int checked = 0;
+ static int present = 0;
+
+ if (!checked)
+ present = target_present("snapshot") &&
+ target_present("snapshot-origin");
+
+ checked = 1;
+
+ return present;
+}
+#endif
+
static void _destroy(const struct segment_type *segtype)
{
dbg_free((void *) segtype);
name:_name,
text_import:_text_import,
text_export:_text_export,
+#ifdef DEVMAPPER_SUPPORT
target_percent:_target_percent,
+ target_present:_target_present,
+#endif
destroy:_destroy,
};
#include "str_list.h"
#include "targets.h"
#include "lvm-string.h"
+#include "activate.h"
static const char *_name(const struct lv_segment *seg)
{
return compose_areas_line(dm, seg, params, paramsize, pos, 0u,
seg->area_count);
}
+
+static int _target_present(void)
+{
+ static int checked = 0;
+ static int present = 0;
+
+ if (!checked)
+ present = target_present("linear") && target_present("striped");
+
+ checked = 1;
+ return present;
+}
#endif
static void _destroy(const struct segment_type *segtype)
merge_segments:_merge_segments,
#ifdef DEVMAPPER_SUPPORT
compose_target_line:_compose_target_line,
+ target_present:_target_present,
#endif
destroy:_destroy,
};