From: Takahiro Yasui <tyasui@redhat.com>
To: lvm-devel@redhat.com
Subject: [RFC][PATCH 5/5] update device lists by lvm commands
Date: Tue, 29 Sep 2009 20:28:22 -0400 [thread overview]
Message-ID: <4AC2A626.50404@redhat.com> (raw)
dmeventd keeps information of PVs which belongs to the VG and the
information needs to be updated when the structure of VG is changed
by LVM commands: vgextend, vgmerge, vgreduce and vgsplit.
Signed-off-by: Takahiro Yasui <tyasui@redhat.com>
---
tools/toollib.c | 29 +++++++++++++++++++++++++++++
tools/toollib.h | 2 ++
tools/vgextend.c | 3 +++
tools/vgmerge.c | 3 +++
tools/vgreduce.c | 4 ++++
tools/vgsplit.c | 7 +++++++
6 files changed, 48 insertions(+)
Index: LVM2.02.54-20090928/tools/toollib.c
===================================================================
--- LVM2.02.54-20090928.orig/tools/toollib.c
+++ LVM2.02.54-20090928/tools/toollib.c
@@ -1247,3 +1247,32 @@ int vg_refresh_visible(struct cmd_contex
return r;
}
+
+void vg_monitor_update(struct cmd_context *cmd, struct volume_group *vg)
+{
+ struct lv_list *lvl;
+ struct logical_volume *lv;
+ struct lvinfo info;
+ int lv_active;
+
+ if (dmeventd_monitor_mode() == DMEVENTD_MONITOR_IGNORE)
+ return;
+
+ dm_list_iterate_items(lvl, &vg->lvs) {
+ lv = lvl->lv;
+
+ if (!lv_info(cmd, lv, &info, 0, 0))
+ lv_active = 0;
+ else
+ lv_active = info.exists;
+
+ /*
+ * FIXME: Need to consider all cases... PVMOVE, etc
+ */
+ if ((lv->status & PVMOVE) || !lv_active)
+ continue;
+
+ if (monitor_dev_for_events(cmd, lv, 0))
+ monitor_dev_for_events(cmd, lv, 1);
+ }
+}
Index: LVM2.02.54-20090928/tools/toollib.h
===================================================================
--- LVM2.02.54-20090928.orig/tools/toollib.h
+++ LVM2.02.54-20090928/tools/toollib.h
@@ -105,4 +105,6 @@ int fill_vg_create_params(struct cmd_con
int lv_refresh(struct cmd_context *cmd, struct logical_volume *lv);
int vg_refresh_visible(struct cmd_context *cmd, struct volume_group *vg);
+
+void vg_monitor_update(struct cmd_context *cmd, struct volume_group *vg);
#endif
Index: LVM2.02.54-20090928/tools/vgextend.c
===================================================================
--- LVM2.02.54-20090928.orig/tools/vgextend.c
+++ LVM2.02.54-20090928/tools/vgextend.c
@@ -69,6 +69,9 @@ int vgextend(struct cmd_context *cmd, in
log_print("Volume group \"%s\" successfully extended", vg_name);
r = ECMD_PROCESSED;
+ /* update monitoring information */
+ vg_monitor_update(cmd, vg);
+
bad:
unlock_vg(cmd, VG_ORPHANS);
unlock_and_release_vg(cmd, vg, vg_name);
Index: LVM2.02.54-20090928/tools/vgmerge.c
===================================================================
--- LVM2.02.54-20090928.orig/tools/vgmerge.c
+++ LVM2.02.54-20090928/tools/vgmerge.c
@@ -144,6 +144,9 @@ static int _vgmerge_single(struct cmd_co
log_print("Volume group \"%s\" successfully merged into \"%s\"",
vg_from->name, vg_to->name);
r = ECMD_PROCESSED;
+
+ /* update monitoring information */
+ vg_monitor_update(cmd, vg_to);
bad:
if (lock_vg_from_first) {
unlock_and_release_vg(cmd, vg_to, vg_name_to);
Index: LVM2.02.54-20090928/tools/vgreduce.c
===================================================================
--- LVM2.02.54-20090928.orig/tools/vgreduce.c
+++ LVM2.02.54-20090928/tools/vgreduce.c
@@ -571,6 +571,10 @@ int vgreduce(struct cmd_context *cmd, in
_vgreduce_single);
}
+
+ /* update monitoring information */
+ vg_monitor_update(cmd, vg);
+
out:
init_ignore_suspended_devices(saved_ignore_suspended_devices);
unlock_and_release_vg(cmd, vg, vg_name);
Index: LVM2.02.54-20090928/tools/vgsplit.c
===================================================================
--- LVM2.02.54-20090928.orig/tools/vgsplit.c
+++ LVM2.02.54-20090928/tools/vgsplit.c
@@ -488,6 +488,13 @@ int vgsplit(struct cmd_context *cmd, int
r = ECMD_PROCESSED;
+ /*
+ * update monitoring information of "vg_to"
+ *
+ * Note: update is not necessary to "vg_from" because it contains
+ * no active LVs.
+ */
+ vg_monitor_update(cmd, vg_to);
bad:
if (lock_vg_from_first) {
unlock_and_release_vg(cmd, vg_to, vg_name_to);
--
Takahiro Yasui
Hitachi Computer Products (America), Inc.
reply other threads:[~2009-09-30 0:28 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4AC2A626.50404@redhat.com \
--to=tyasui@redhat.com \
--cc=lvm-devel@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.