mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
Allow VGs with active LVs to be renamed.
This commit is contained in:
parent
bda3982016
commit
c6469d46dd
@ -1,5 +1,6 @@
|
|||||||
Version 2.02.63 -
|
Version 2.02.63 -
|
||||||
================================
|
================================
|
||||||
|
Allow VGs with active LVs to be renamed.
|
||||||
Use UUIDs instead of names while processing event handlers.
|
Use UUIDs instead of names while processing event handlers.
|
||||||
Only pass visible LVs to tools in cmdline VG name/tag expansions without -a.
|
Only pass visible LVs to tools in cmdline VG name/tag expansions without -a.
|
||||||
Use typedefs for toollib process_each functions.
|
Use typedefs for toollib process_each functions.
|
||||||
|
@ -15,9 +15,9 @@
|
|||||||
|
|
||||||
#include "tools.h"
|
#include "tools.h"
|
||||||
|
|
||||||
static struct volume_group *vg_rename_old(struct cmd_context *cmd,
|
static struct volume_group *_get_old_vg_for_rename(struct cmd_context *cmd,
|
||||||
const char *vg_name_old,
|
const char *vg_name_old,
|
||||||
const char *vgid)
|
const char *vgid)
|
||||||
{
|
{
|
||||||
struct volume_group *vg;
|
struct volume_group *vg;
|
||||||
|
|
||||||
@ -29,18 +29,11 @@ static struct volume_group *vg_rename_old(struct cmd_context *cmd,
|
|||||||
return_NULL;
|
return_NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lvs_in_vg_activated(vg)) {
|
|
||||||
unlock_and_release_vg(cmd, vg, vg_name_old);
|
|
||||||
log_error("Volume group \"%s\" still has active LVs",
|
|
||||||
vg_name_old);
|
|
||||||
/* FIXME Remove this restriction */
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
return vg;
|
return vg;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int vg_rename_new(struct cmd_context *cmd,
|
static int _lock_new_vg_for_rename(struct cmd_context *cmd,
|
||||||
const char *vg_name_new)
|
const char *vg_name_new)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
@ -82,7 +75,7 @@ static int vg_rename_path(struct cmd_context *cmd, const char *old_vg_path,
|
|||||||
dev_dir = cmd->dev_dir;
|
dev_dir = cmd->dev_dir;
|
||||||
|
|
||||||
if (!validate_vg_rename_params(cmd, vg_name_old, vg_name_new))
|
if (!validate_vg_rename_params(cmd, vg_name_old, vg_name_new))
|
||||||
return 0;
|
return_0;
|
||||||
|
|
||||||
log_verbose("Checking for existing volume group \"%s\"", vg_name_old);
|
log_verbose("Checking for existing volume group \"%s\"", vg_name_old);
|
||||||
|
|
||||||
@ -119,22 +112,23 @@ static int vg_rename_path(struct cmd_context *cmd, const char *old_vg_path,
|
|||||||
lock_vg_old_first = 0;
|
lock_vg_old_first = 0;
|
||||||
|
|
||||||
if (lock_vg_old_first) {
|
if (lock_vg_old_first) {
|
||||||
vg = vg_rename_old(cmd, vg_name_old, vgid);
|
vg = _get_old_vg_for_rename(cmd, vg_name_old, vgid);
|
||||||
if (!vg)
|
if (!vg)
|
||||||
return 0;
|
return_0;
|
||||||
|
|
||||||
if (!vg_rename_new(cmd, vg_name_new)) {
|
if (!_lock_new_vg_for_rename(cmd, vg_name_new)) {
|
||||||
unlock_and_release_vg(cmd, vg, vg_name_old);
|
unlock_and_release_vg(cmd, vg, vg_name_old);
|
||||||
return 0;
|
return_0;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!vg_rename_new(cmd, vg_name_new)) {
|
if (!_lock_new_vg_for_rename(cmd, vg_name_new))
|
||||||
return 0;
|
return_0;
|
||||||
}
|
|
||||||
|
|
||||||
vg = vg_rename_old(cmd, vg_name_old, vgid);
|
vg = _get_old_vg_for_rename(cmd, vg_name_old, vgid);
|
||||||
if (!vg)
|
if (!vg) {
|
||||||
return 0;
|
unlock_vg(cmd, vg_name_new);
|
||||||
|
return_0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!archive(vg))
|
if (!archive(vg))
|
||||||
@ -170,8 +164,6 @@ static int vg_rename_path(struct cmd_context *cmd, const char *old_vg_path,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/******* FIXME Rename any active LVs! *****/
|
|
||||||
|
|
||||||
backup(vg);
|
backup(vg);
|
||||||
backup_remove(cmd, vg_name_old);
|
backup_remove(cmd, vg_name_old);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user