mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-02 01:18:26 +03:00
Attempt to load missing targets using modprobe.
Simplify dev_manager_info().
This commit is contained in:
parent
a653923fe7
commit
f894b4b1b7
@ -1,5 +1,6 @@
|
|||||||
Version 2.02.00 -
|
Version 2.02.00 -
|
||||||
===================================
|
===================================
|
||||||
|
Simplify dev_manager_info().
|
||||||
Attempt to load missing targets using modprobe.
|
Attempt to load missing targets using modprobe.
|
||||||
Add -a to lvscan.
|
Add -a to lvscan.
|
||||||
Move mknodes into libdevmapper.
|
Move mknodes into libdevmapper.
|
||||||
|
@ -37,6 +37,7 @@
|
|||||||
../lib/misc/crc.h
|
../lib/misc/crc.h
|
||||||
../lib/misc/intl.h
|
../lib/misc/intl.h
|
||||||
../lib/misc/lib.h
|
../lib/misc/lib.h
|
||||||
|
../lib/misc/lvm-exec.h
|
||||||
../lib/misc/lvm-file.h
|
../lib/misc/lvm-file.h
|
||||||
../lib/misc/lvm-string.h
|
../lib/misc/lvm-string.h
|
||||||
../lib/misc/selinux.h
|
../lib/misc/selinux.h
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#
|
#
|
||||||
# Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
|
# Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
|
||||||
# Copyright (C) 2004 Red Hat, Inc. All rights reserved.
|
# Copyright (C) 2004-2005 Red Hat, Inc. All rights reserved.
|
||||||
#
|
#
|
||||||
# This file is part of the LVM2.
|
# This file is part of the LVM2.
|
||||||
#
|
#
|
||||||
@ -74,6 +74,7 @@ SOURCES =\
|
|||||||
metadata/segtype.c \
|
metadata/segtype.c \
|
||||||
metadata/snapshot_manip.c \
|
metadata/snapshot_manip.c \
|
||||||
misc/crc.c \
|
misc/crc.c \
|
||||||
|
misc/lvm-exec.c \
|
||||||
misc/lvm-file.c \
|
misc/lvm-file.c \
|
||||||
misc/lvm-string.c \
|
misc/lvm-string.c \
|
||||||
mm/memlock.c \
|
mm/memlock.c \
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
#include "memlock.h"
|
#include "memlock.h"
|
||||||
#include "display.h"
|
#include "display.h"
|
||||||
#include "fs.h"
|
#include "fs.h"
|
||||||
|
#include "lvm-exec.h"
|
||||||
#include "lvm-file.h"
|
#include "lvm-file.h"
|
||||||
#include "lvm-string.h"
|
#include "lvm-string.h"
|
||||||
#include "toolcontext.h"
|
#include "toolcontext.h"
|
||||||
@ -77,7 +78,7 @@ int target_present(const char *target_name)
|
|||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
int lv_info(const struct logical_volume *lv, struct lvinfo *info,
|
int lv_info(struct cmd_context *cmd, const struct logical_volume *lv, struct lvinfo *info,
|
||||||
int with_open_count)
|
int with_open_count)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
@ -256,48 +257,25 @@ int library_version(char *version, size_t size)
|
|||||||
if (!activation())
|
if (!activation())
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (!dm_get_library_version(version, size))
|
return dm_get_library_version(version, size);
|
||||||
return 0;
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int driver_version(char *version, size_t size)
|
int driver_version(char *version, size_t size)
|
||||||
{
|
{
|
||||||
int r = 0;
|
|
||||||
struct dm_task *dmt;
|
|
||||||
|
|
||||||
if (!activation())
|
if (!activation())
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
log_very_verbose("Getting driver version");
|
log_very_verbose("Getting driver version");
|
||||||
if (!(dmt = dm_task_create(DM_DEVICE_VERSION))) {
|
|
||||||
stack;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!dm_task_run(dmt))
|
return dm_driver_version(version, size);
|
||||||
log_error("Failed to get driver version");
|
|
||||||
|
|
||||||
if (!dm_task_get_driver_version(dmt, version, size))
|
|
||||||
goto out;
|
|
||||||
|
|
||||||
r = 1;
|
|
||||||
|
|
||||||
out:
|
|
||||||
dm_task_destroy(dmt);
|
|
||||||
|
|
||||||
return r;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int target_present(const char *target_name)
|
static int _target_present(const char *target_name)
|
||||||
{
|
{
|
||||||
int r = 0;
|
int r = 0;
|
||||||
struct dm_task *dmt;
|
struct dm_task *dmt;
|
||||||
struct dm_versions *target, *last_target;
|
struct dm_versions *target, *last_target;
|
||||||
|
|
||||||
if (!activation())
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
log_very_verbose("Getting target version for %s", target_name);
|
log_very_verbose("Getting target version for %s", target_name);
|
||||||
if (!(dmt = dm_task_create(DM_DEVICE_LIST_VERSIONS))) {
|
if (!(dmt = dm_task_create(DM_DEVICE_LIST_VERSIONS))) {
|
||||||
stack;
|
stack;
|
||||||
@ -329,26 +307,54 @@ int target_present(const char *target_name)
|
|||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
int target_present(const char *target_name)
|
||||||
* Returns 1 if info structure populated, else 0 on failure.
|
|
||||||
*/
|
|
||||||
static int _lv_info(const struct logical_volume *lv, int mknodes,
|
|
||||||
struct lvinfo *info, int with_open_count)
|
|
||||||
{
|
{
|
||||||
int r;
|
char module[128];
|
||||||
struct dev_manager *dm;
|
|
||||||
struct dm_info dminfo;
|
|
||||||
|
|
||||||
if (!activation())
|
if (!activation())
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (!(dm = dev_manager_create(lv->vg->cmd, lv->vg->name))) {
|
#ifdef MODPROBE_CMD
|
||||||
|
if (_target_present(target_name))
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
if (lvm_snprintf(module, sizeof(module), "dm-%s", target_name) < 0) {
|
||||||
|
log_error("target_present module name too long: %s", target_name);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!exec_cmd(MODPROBE_CMD, module, "", "")) {
|
||||||
|
stack;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return _target_present(target_name);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Returns 1 if info structure populated, else 0 on failure.
|
||||||
|
*/
|
||||||
|
static int _lv_info(struct cmd_context *cmd, const struct logical_volume *lv, int with_mknodes,
|
||||||
|
struct lvinfo *info, int with_open_count)
|
||||||
|
{
|
||||||
|
struct dm_info dminfo;
|
||||||
|
char *name;
|
||||||
|
|
||||||
|
if (!activation())
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
if (!(name = build_dm_name(cmd->mem, lv->vg->name, lv->name, NULL))) {
|
||||||
stack;
|
stack;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(r = dev_manager_info(dm, lv, mknodes, with_open_count, &dminfo)))
|
log_debug("Getting device info for %s", name);
|
||||||
|
if (!dev_manager_info(name, lv->lvid.s, with_mknodes, with_open_count, &dminfo)) {
|
||||||
|
dm_pool_free(cmd->mem, name);
|
||||||
stack;
|
stack;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
info->exists = dminfo.exists;
|
info->exists = dminfo.exists;
|
||||||
info->suspended = dminfo.suspended;
|
info->suspended = dminfo.suspended;
|
||||||
@ -357,14 +363,14 @@ static int _lv_info(const struct logical_volume *lv, int mknodes,
|
|||||||
info->minor = dminfo.minor;
|
info->minor = dminfo.minor;
|
||||||
info->read_only = dminfo.read_only;
|
info->read_only = dminfo.read_only;
|
||||||
|
|
||||||
dev_manager_destroy(dm);
|
dm_pool_free(cmd->mem, name);
|
||||||
return r;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int lv_info(const struct logical_volume *lv, struct lvinfo *info,
|
int lv_info(struct cmd_context *cmd, const struct logical_volume *lv, struct lvinfo *info,
|
||||||
int with_open_count)
|
int with_open_count)
|
||||||
{
|
{
|
||||||
return _lv_info(lv, 0, info, with_open_count);
|
return _lv_info(cmd, lv, 0, info, with_open_count);
|
||||||
}
|
}
|
||||||
|
|
||||||
int lv_info_by_lvid(struct cmd_context *cmd, const char *lvid_s,
|
int lv_info_by_lvid(struct cmd_context *cmd, const char *lvid_s,
|
||||||
@ -375,7 +381,7 @@ int lv_info_by_lvid(struct cmd_context *cmd, const char *lvid_s,
|
|||||||
if (!(lv = lv_from_lvid(cmd, lvid_s)))
|
if (!(lv = lv_from_lvid(cmd, lvid_s)))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return _lv_info(lv, 0, info, with_open_count);
|
return _lv_info(cmd, lv, 0, info, with_open_count);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -403,7 +409,7 @@ int lv_snapshot_percent(struct logical_volume *lv, float *percent)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* FIXME Merge with snapshot_percent */
|
/* FIXME Merge with snapshot_percent */
|
||||||
int lv_mirror_percent(struct logical_volume *lv, int wait, float *percent,
|
int lv_mirror_percent(struct cmd_context *cmd, struct logical_volume *lv, int wait, float *percent,
|
||||||
uint32_t *event_nr)
|
uint32_t *event_nr)
|
||||||
{
|
{
|
||||||
int r;
|
int r;
|
||||||
@ -413,7 +419,7 @@ int lv_mirror_percent(struct logical_volume *lv, int wait, float *percent,
|
|||||||
if (!activation())
|
if (!activation())
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (!lv_info(lv, &info, 0)) {
|
if (!lv_info(cmd, lv, &info, 0)) {
|
||||||
stack;
|
stack;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -434,11 +440,11 @@ int lv_mirror_percent(struct logical_volume *lv, int wait, float *percent,
|
|||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int _lv_active(struct logical_volume *lv)
|
static int _lv_active(struct cmd_context *cmd, struct logical_volume *lv)
|
||||||
{
|
{
|
||||||
struct lvinfo info;
|
struct lvinfo info;
|
||||||
|
|
||||||
if (!lv_info(lv, &info, 0)) {
|
if (!lv_info(cmd, lv, &info, 0)) {
|
||||||
stack;
|
stack;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -446,11 +452,11 @@ static int _lv_active(struct logical_volume *lv)
|
|||||||
return info.exists;
|
return info.exists;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int _lv_open_count(struct logical_volume *lv)
|
static int _lv_open_count(struct cmd_context *cmd, struct logical_volume *lv)
|
||||||
{
|
{
|
||||||
struct lvinfo info;
|
struct lvinfo info;
|
||||||
|
|
||||||
if (!lv_info(lv, &info, 1)) {
|
if (!lv_info(cmd, lv, &info, 1)) {
|
||||||
stack;
|
stack;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -524,7 +530,7 @@ int lvs_in_vg_activated(struct volume_group *vg)
|
|||||||
|
|
||||||
list_iterate_items(lvl, &vg->lvs) {
|
list_iterate_items(lvl, &vg->lvs) {
|
||||||
if (lvl->lv->status & VISIBLE_LV)
|
if (lvl->lv->status & VISIBLE_LV)
|
||||||
count += (_lv_active(lvl->lv) == 1);
|
count += (_lv_active(vg->cmd, lvl->lv) == 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
return count;
|
return count;
|
||||||
@ -540,7 +546,7 @@ int lvs_in_vg_opened(struct volume_group *vg)
|
|||||||
|
|
||||||
list_iterate_items(lvl, &vg->lvs) {
|
list_iterate_items(lvl, &vg->lvs) {
|
||||||
if (lvl->lv->status & VISIBLE_LV)
|
if (lvl->lv->status & VISIBLE_LV)
|
||||||
count += (_lv_open_count(lvl->lv) > 0);
|
count += (_lv_open_count(vg->cmd, lvl->lv) > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
return count;
|
return count;
|
||||||
@ -563,7 +569,7 @@ static int _lv_suspend(struct cmd_context *cmd, const char *lvid_s,
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!lv_info(lv, &info, 0)) {
|
if (!lv_info(cmd, lv, &info, 0)) {
|
||||||
stack;
|
stack;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -609,7 +615,7 @@ static int _lv_resume(struct cmd_context *cmd, const char *lvid_s,
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!lv_info(lv, &info, 0)) {
|
if (!lv_info(cmd, lv, &info, 0)) {
|
||||||
stack;
|
stack;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -654,7 +660,7 @@ int lv_deactivate(struct cmd_context *cmd, const char *lvid_s)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!lv_info(lv, &info, 1)) {
|
if (!lv_info(cmd, lv, &info, 1)) {
|
||||||
stack;
|
stack;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -724,7 +730,7 @@ static int _lv_activate(struct cmd_context *cmd, const char *lvid_s,
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!lv_info(lv, &info, 0)) {
|
if (!lv_info(cmd, lv, &info, 0)) {
|
||||||
stack;
|
stack;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -766,7 +772,7 @@ int lv_mknodes(struct cmd_context *cmd, const struct logical_volume *lv)
|
|||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_lv_info(lv, 1, &info, 0)) {
|
if (!_lv_info(cmd, lv, 1, &info, 0)) {
|
||||||
stack;
|
stack;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -52,7 +52,7 @@ int lv_mknodes(struct cmd_context *cmd, const struct logical_volume *lv);
|
|||||||
/*
|
/*
|
||||||
* Returns 1 if info structure has been populated, else 0.
|
* Returns 1 if info structure has been populated, else 0.
|
||||||
*/
|
*/
|
||||||
int lv_info(const struct logical_volume *lv, struct lvinfo *info,
|
int lv_info(struct cmd_context *cmd, const struct logical_volume *lv, struct lvinfo *info,
|
||||||
int with_open_count);
|
int with_open_count);
|
||||||
int lv_info_by_lvid(struct cmd_context *cmd, const char *lvid_s,
|
int lv_info_by_lvid(struct cmd_context *cmd, const char *lvid_s,
|
||||||
struct lvinfo *info, int with_open_count);
|
struct lvinfo *info, int with_open_count);
|
||||||
@ -67,7 +67,7 @@ int lv_activation_filter(struct cmd_context *cmd, const char *lvid_s,
|
|||||||
* Returns 1 if percent has been set, else 0.
|
* Returns 1 if percent has been set, else 0.
|
||||||
*/
|
*/
|
||||||
int lv_snapshot_percent(struct logical_volume *lv, float *percent);
|
int lv_snapshot_percent(struct logical_volume *lv, float *percent);
|
||||||
int lv_mirror_percent(struct logical_volume *lv, int wait, float *percent,
|
int lv_mirror_percent(struct cmd_context *cmd, struct logical_volume *lv, int wait, float *percent,
|
||||||
uint32_t *event_nr);
|
uint32_t *event_nr);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -76,6 +76,4 @@ int lv_mirror_percent(struct logical_volume *lv, int wait, float *percent,
|
|||||||
int lvs_in_vg_activated(struct volume_group *vg);
|
int lvs_in_vg_activated(struct volume_group *vg);
|
||||||
int lvs_in_vg_opened(struct volume_group *vg);
|
int lvs_in_vg_opened(struct volume_group *vg);
|
||||||
|
|
||||||
int lv_setup_cow_store(struct logical_volume *lv);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -267,6 +267,12 @@ static int _info(const char *name, const char *uuid, int mknodes,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int dev_manager_info(const char *name, const char *uuid,
|
||||||
|
int with_mknodes, int with_open_count, struct dm_info *info)
|
||||||
|
{
|
||||||
|
return _info(name, uuid, with_mknodes, with_open_count, info, NULL, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
/* FIXME Interface must cope with multiple targets */
|
/* FIXME Interface must cope with multiple targets */
|
||||||
static int _status_run(const char *name, const char *uuid,
|
static int _status_run(const char *name, const char *uuid,
|
||||||
unsigned long long *s, unsigned long long *l,
|
unsigned long long *s, unsigned long long *l,
|
||||||
@ -986,32 +992,6 @@ void dev_manager_destroy(struct dev_manager *dm)
|
|||||||
dm_pool_destroy(dm->mem);
|
dm_pool_destroy(dm->mem);
|
||||||
}
|
}
|
||||||
|
|
||||||
int dev_manager_info(struct dev_manager *dm, const struct logical_volume *lv,
|
|
||||||
int mknodes, int with_open_count, struct dm_info *info)
|
|
||||||
{
|
|
||||||
char *name;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Build a name for the top layer.
|
|
||||||
*/
|
|
||||||
if (!(name = build_dm_name(dm->mem, lv->vg->name, lv->name, NULL))) {
|
|
||||||
stack;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Try and get some info on this device.
|
|
||||||
*/
|
|
||||||
log_debug("Getting device info for %s", name);
|
|
||||||
if (!_info(name, lv->lvid.s, mknodes, with_open_count, info, NULL,
|
|
||||||
NULL)) {
|
|
||||||
stack;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
int dev_manager_snapshot_percent(struct dev_manager *dm,
|
int dev_manager_snapshot_percent(struct dev_manager *dm,
|
||||||
struct logical_volume *lv, float *percent)
|
struct logical_volume *lv, float *percent)
|
||||||
{
|
{
|
||||||
@ -2208,3 +2188,4 @@ void dev_manager_exit(void)
|
|||||||
{
|
{
|
||||||
dm_lib_exit();
|
dm_lib_exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ void dev_manager_exit(void);
|
|||||||
* (eg, an origin is created before its snapshot, but is not
|
* (eg, an origin is created before its snapshot, but is not
|
||||||
* unsuspended until the snapshot is also created.)
|
* unsuspended until the snapshot is also created.)
|
||||||
*/
|
*/
|
||||||
int dev_manager_info(struct dev_manager *dm, const struct logical_volume *lv,
|
int dev_manager_info(const char *name, const char *uuid,
|
||||||
int mknodes, int with_open_count, struct dm_info *info);
|
int mknodes, int with_open_count, struct dm_info *info);
|
||||||
int dev_manager_snapshot_percent(struct dev_manager *dm,
|
int dev_manager_snapshot_percent(struct dev_manager *dm,
|
||||||
struct logical_volume *lv, float *percent);
|
struct logical_volume *lv, float *percent);
|
||||||
@ -48,7 +48,6 @@ int dev_manager_deactivate(struct dev_manager *dm, struct logical_volume *lv);
|
|||||||
|
|
||||||
int dev_manager_lv_mknodes(const struct logical_volume *lv);
|
int dev_manager_lv_mknodes(const struct logical_volume *lv);
|
||||||
int dev_manager_lv_rmnodes(const struct logical_volume *lv);
|
int dev_manager_lv_rmnodes(const struct logical_volume *lv);
|
||||||
int dev_manager_mknodes(void);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Put the desired changes into effect.
|
* Put the desired changes into effect.
|
||||||
|
@ -317,7 +317,7 @@ void lvdisplay_colons(struct logical_volume *lv)
|
|||||||
{
|
{
|
||||||
int inkernel;
|
int inkernel;
|
||||||
struct lvinfo info;
|
struct lvinfo info;
|
||||||
inkernel = lv_info(lv, &info, 1) && info.exists;
|
inkernel = lv_info(lv->vg->cmd, lv, &info, 1) && info.exists;
|
||||||
|
|
||||||
log_print("%s%s/%s:%s:%d:%d:-1:%d:%" PRIu64 ":%d:-1:%d:%d:%d:%d",
|
log_print("%s%s/%s:%s:%d:%d:-1:%d:%" PRIu64 ":%d:-1:%d:%d:%d:%d",
|
||||||
lv->vg->cmd->dev_dir,
|
lv->vg->cmd->dev_dir,
|
||||||
@ -347,7 +347,7 @@ int lvdisplay_full(struct cmd_context *cmd, struct logical_volume *lv,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
inkernel = lv_info(lv, &info, 1) && info.exists;
|
inkernel = lv_info(cmd, lv, &info, 1) && info.exists;
|
||||||
|
|
||||||
log_print("--- Logical volume ---");
|
log_print("--- Logical volume ---");
|
||||||
|
|
||||||
|
@ -295,7 +295,7 @@ static int _lvkmaj_disp(struct report_handle *rh, struct field *field,
|
|||||||
struct lvinfo info;
|
struct lvinfo info;
|
||||||
uint64_t minusone = UINT64_C(-1);
|
uint64_t minusone = UINT64_C(-1);
|
||||||
|
|
||||||
if (lv_info(lv, &info, 0) && info.exists)
|
if (lv_info(lv->vg->cmd, lv, &info, 0) && info.exists)
|
||||||
return _int_disp(rh, field, &info.major);
|
return _int_disp(rh, field, &info.major);
|
||||||
else
|
else
|
||||||
return _int_disp(rh, field, &minusone);
|
return _int_disp(rh, field, &minusone);
|
||||||
@ -310,7 +310,7 @@ static int _lvkmin_disp(struct report_handle *rh, struct field *field,
|
|||||||
struct lvinfo info;
|
struct lvinfo info;
|
||||||
uint64_t minusone = UINT64_C(-1);
|
uint64_t minusone = UINT64_C(-1);
|
||||||
|
|
||||||
if (lv_info(lv, &info, 0) && info.exists)
|
if (lv_info(lv->vg->cmd, lv, &info, 0) && info.exists)
|
||||||
return _int_disp(rh, field, &info.minor);
|
return _int_disp(rh, field, &info.minor);
|
||||||
else
|
else
|
||||||
return _int_disp(rh, field, &minusone);
|
return _int_disp(rh, field, &minusone);
|
||||||
@ -366,7 +366,7 @@ static int _lvstatus_disp(struct report_handle *rh, struct field *field,
|
|||||||
else
|
else
|
||||||
repstr[3] = '-';
|
repstr[3] = '-';
|
||||||
|
|
||||||
if (lv_info(lv, &info, 1) && info.exists) {
|
if (lv_info(lv->vg->cmd, lv, &info, 1) && info.exists) {
|
||||||
if (info.suspended)
|
if (info.suspended)
|
||||||
repstr[4] = 's'; /* Suspended */
|
repstr[4] = 's'; /* Suspended */
|
||||||
else
|
else
|
||||||
@ -848,7 +848,7 @@ static int _snpercent_disp(struct report_handle *rh, struct field *field,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!(snap_seg = find_cow(lv)) ||
|
if (!(snap_seg = find_cow(lv)) ||
|
||||||
(lv_info(snap_seg->cow, &info, 0) && !info.exists)) {
|
(lv_info(lv->vg->cmd, snap_seg->cow, &info, 0) && !info.exists)) {
|
||||||
field->report_string = "";
|
field->report_string = "";
|
||||||
*sortval = UINT64_C(0);
|
*sortval = UINT64_C(0);
|
||||||
field->sort_value = sortval;
|
field->sort_value = sortval;
|
||||||
@ -894,7 +894,7 @@ static int _copypercent_disp(struct report_handle *rh, struct field *field,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ((!(lv->status & PVMOVE) && !(lv->status & MIRRORED)) ||
|
if ((!(lv->status & PVMOVE) && !(lv->status & MIRRORED)) ||
|
||||||
!lv_mirror_percent(lv, 0, &percent, NULL)) {
|
!lv_mirror_percent(lv->vg->cmd, lv, 0, &percent, NULL)) {
|
||||||
field->report_string = "";
|
field->report_string = "";
|
||||||
*sortval = UINT64_C(0);
|
*sortval = UINT64_C(0);
|
||||||
field->sort_value = sortval;
|
field->sort_value = sortval;
|
||||||
|
@ -262,7 +262,7 @@ static int lvchange_persistent(struct cmd_context *cmd,
|
|||||||
log_error("Major number must be specified with -My");
|
log_error("Major number must be specified with -My");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (lv_info(lv, &info, 0) && info.exists &&
|
if (lv_info(cmd, lv, &info, 0) && info.exists &&
|
||||||
!arg_count(cmd, force_ARG)) {
|
!arg_count(cmd, force_ARG)) {
|
||||||
if (yes_no_prompt("Logical volume %s will be "
|
if (yes_no_prompt("Logical volume %s will be "
|
||||||
"deactivated temporarily. "
|
"deactivated temporarily. "
|
||||||
|
@ -53,7 +53,7 @@ static int lvremove_single(struct cmd_context *cmd, struct logical_volume *lv,
|
|||||||
|
|
||||||
/* FIXME Ensure not referred to by another existing LVs */
|
/* FIXME Ensure not referred to by another existing LVs */
|
||||||
|
|
||||||
if (lv_info(lv, &info, 1)) {
|
if (lv_info(cmd, lv, &info, 1)) {
|
||||||
if (info.open_count) {
|
if (info.open_count) {
|
||||||
log_error("Can't remove open logical volume \"%s\"",
|
log_error("Can't remove open logical volume \"%s\"",
|
||||||
lv->name);
|
lv->name);
|
||||||
|
@ -388,7 +388,7 @@ static int _lvresize(struct cmd_context *cmd, struct lvresize_params *lp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (lp->mirrors && activation() &&
|
if (lp->mirrors && activation() &&
|
||||||
lv_info(lv, &info, 0) && info.exists) {
|
lv_info(cmd, lv, &info, 0) && info.exists) {
|
||||||
log_error("Mirrors cannot be resized while active yet.");
|
log_error("Mirrors cannot be resized while active yet.");
|
||||||
return ECMD_FAILED;
|
return ECMD_FAILED;
|
||||||
}
|
}
|
||||||
@ -402,7 +402,7 @@ static int _lvresize(struct cmd_context *cmd, struct lvresize_params *lp)
|
|||||||
|
|
||||||
memset(&info, 0, sizeof(info));
|
memset(&info, 0, sizeof(info));
|
||||||
|
|
||||||
if (lv_info(lv, &info, 0) && info.exists) {
|
if (lv_info(cmd, lv, &info, 0) && info.exists) {
|
||||||
log_error("Snapshot origin volumes can be resized "
|
log_error("Snapshot origin volumes can be resized "
|
||||||
"only while inactive: try lvchange -an");
|
"only while inactive: try lvchange -an");
|
||||||
return ECMD_FAILED;
|
return ECMD_FAILED;
|
||||||
@ -421,7 +421,7 @@ static int _lvresize(struct cmd_context *cmd, struct lvresize_params *lp)
|
|||||||
if (lp->resize == LV_REDUCE || lp->resizefs) {
|
if (lp->resize == LV_REDUCE || lp->resizefs) {
|
||||||
memset(&info, 0, sizeof(info));
|
memset(&info, 0, sizeof(info));
|
||||||
|
|
||||||
if (!lv_info(lv, &info, 1) && driver_version(NULL, 0)) {
|
if (!lv_info(cmd, lv, &info, 1) && driver_version(NULL, 0)) {
|
||||||
log_error("lv_info failed: aborting");
|
log_error("lv_info failed: aborting");
|
||||||
return ECMD_FAILED;
|
return ECMD_FAILED;
|
||||||
}
|
}
|
||||||
|
@ -96,7 +96,7 @@ static int vgconvert_single(struct cmd_context *cmd, const char *vg_name,
|
|||||||
continue;
|
continue;
|
||||||
if (lvnum_from_lvid(&lv->lvid) < MAX_RESTRICTED_LVS)
|
if (lvnum_from_lvid(&lv->lvid) < MAX_RESTRICTED_LVS)
|
||||||
continue;
|
continue;
|
||||||
if (lv_info(lv, &info, 0) && info.exists) {
|
if (lv_info(cmd, lv, &info, 0) && info.exists) {
|
||||||
log_error("Logical volume %s must be "
|
log_error("Logical volume %s must be "
|
||||||
"deactivated before conversion.",
|
"deactivated before conversion.",
|
||||||
lv->name);
|
lv->name);
|
||||||
|
Loading…
Reference in New Issue
Block a user