summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorBryn M. Reeves <breeves@redhat.com>2007-11-02 14:54:40 +0000
committerBryn M. Reeves <breeves@redhat.com>2007-11-02 14:54:40 +0000
commit9c1dbeb3f18b34de8199e4a31d2465dd3b9624f4 (patch)
tree2c630cc2b6934afad98e25f5e8b4d7f441ec2827 /tools
parent8b98c12815d53ea182cfc8f36b28bb4a111e18f1 (diff)
downloadlvm2-9c1dbeb3f18b34de8199e4a31d2465dd3b9624f4.tar.gz
lvm2-9c1dbeb3f18b34de8199e4a31d2465dd3b9624f4.tar.xz
lvm2-9c1dbeb3f18b34de8199e4a31d2465dd3b9624f4.zip
Convert pvchange, pvdisplay, pvscan to use is_orphan()
Diffstat (limited to 'tools')
-rw-r--r--tools/pvchange.c13
-rw-r--r--tools/pvdisplay.c4
-rw-r--r--tools/pvscan.c6
3 files changed, 12 insertions, 11 deletions
diff --git a/tools/pvchange.c b/tools/pvchange.c
index 007f6a7d..9fc47b03 100644
--- a/tools/pvchange.c
+++ b/tools/pvchange.c
@@ -51,7 +51,8 @@ static int _pvchange_single(struct cmd_context *cmd, struct physical_volume *pv,
}
/* If in a VG, must change using volume group. */
- if (*pv_vg_name(pv)) {
+ /* FIXME: handle PVs with no MDAs */
+ if (!is_orphan(pv)) {
log_verbose("Finding volume group of physical volume \"%s\"",
pv_name);
@@ -115,7 +116,7 @@ static int _pvchange_single(struct cmd_context *cmd, struct physical_volume *pv,
}
if (arg_count(cmd, allocatable_ARG)) {
- if (!*pv_vg_name(pv) &&
+ if (is_orphan(pv) &&
!(pv->fmt->features & FMT_ORPHAN_ALLOCATABLE)) {
log_error("Allocatability not supported by orphan "
"%s format PV %s", pv->fmt->name, pv_name);
@@ -127,7 +128,7 @@ static int _pvchange_single(struct cmd_context *cmd, struct physical_volume *pv,
if (allocatable && (pv_status(pv) & ALLOCATABLE_PV)) {
log_error("Physical volume \"%s\" is already "
"allocatable", pv_name);
- if (*pv_vg_name(pv))
+ if (!is_orphan(pv))
unlock_vg(cmd, pv_vg_name(pv));
else
unlock_vg(cmd, ORPHAN);
@@ -137,7 +138,7 @@ static int _pvchange_single(struct cmd_context *cmd, struct physical_volume *pv,
if (!allocatable && !(pv_status(pv) & ALLOCATABLE_PV)) {
log_error("Physical volume \"%s\" is already "
"unallocatable", pv_name);
- if (*pv_vg_name(pv))
+ if (!is_orphan(pv))
unlock_vg(cmd, pv_vg_name(pv));
else
unlock_vg(cmd, ORPHAN);
@@ -180,7 +181,7 @@ static int _pvchange_single(struct cmd_context *cmd, struct physical_volume *pv,
return 0;
}
log_verbose("Changing uuid of %s to %s.", pv_name, uuid);
- if (*pv_vg_name(pv)) {
+ if (!is_orphan(pv)) {
orig_vg_name = pv_vg_name(pv);
orig_pe_alloc_count = pv_pe_alloc_count(pv);
pv->vg_name = ORPHAN;
@@ -196,7 +197,7 @@ static int _pvchange_single(struct cmd_context *cmd, struct physical_volume *pv,
}
log_verbose("Updating physical volume \"%s\"", pv_name);
- if (*pv_vg_name(pv)) {
+ if (!is_orphan(pv)) {
if (!vg_write(vg) || !vg_commit(vg)) {
unlock_vg(cmd, pv_vg_name(pv));
log_error("Failed to store physical volume \"%s\" in "
diff --git a/tools/pvdisplay.c b/tools/pvdisplay.c
index 40ffe36c..e77bbce2 100644
--- a/tools/pvdisplay.c
+++ b/tools/pvdisplay.c
@@ -56,7 +56,7 @@ static int _pvdisplay_single(struct cmd_context *cmd,
pv = pvl->pv;
}
- if (!*pv_vg_name(pv))
+ if (is_orphan(pv))
size = pv_size(pv);
else
size = (pv_pe_count(pv) - pv_pe_alloc_count(pv)) *
@@ -72,7 +72,7 @@ static int _pvdisplay_single(struct cmd_context *cmd,
log_print("Physical volume \"%s\" of volume group \"%s\" "
"is exported", pv_name, pv_vg_name(pv));
- if (!pv_vg_name(pv))
+ if (is_orphan(pv))
log_print("\"%s\" is a new physical volume of \"%s\"",
pv_name, display_size(cmd, size));
diff --git a/tools/pvscan.c b/tools/pvscan.c
index 1463daa0..54b62b74 100644
--- a/tools/pvscan.c
+++ b/tools/pvscan.c
@@ -62,7 +62,7 @@ static void _pvscan_display_single(struct cmd_context *cmd,
sprintf(pv_tmp_name, "%s", pv_dev_name(pv));
}
- if (!*pv_vg_name(pv)) {
+ if (is_orphan(pv)) {
log_print("PV %-*s %-*s %s [%s]",
pv_max_name_len, pv_tmp_name,
vg_max_name_len, " ",
@@ -144,7 +144,7 @@ int pvscan(struct cmd_context *cmd, int argc __attribute((unused)),
if ((arg_count(cmd, exported_ARG)
&& !(pv_status(pv) & EXPORTED_VG))
- || (arg_count(cmd, novolumegroup_ARG) && (*pv_vg_name(pv)))) {
+ || (arg_count(cmd, novolumegroup_ARG) && (!is_orphan(pv)))) {
list_del(&pvl->list);
continue;
}
@@ -161,7 +161,7 @@ int pvscan(struct cmd_context *cmd, int argc __attribute((unused)),
********/
pvs_found++;
- if (!*pv_vg_name(pv)) {
+ if (is_orphan(pv)) {
new_pvs_found++;
size_new += pv_size(pv);
size_total += pv_size(pv);