public inbox for lvm2-cvs@sourceware.org help / color / mirror / Atom feed
From: wysochanski@sourceware.org To: lvm-devel@redhat.com, lvm2-cvs@sourceware.org Subject: LVM2 ./WHATS_NEW lib/metadata/metadata.c lib/m ... Date: Thu, 12 Jul 2007 05:04:00 -0000 [thread overview] Message-ID: <20070712050443.13625.qmail@sourceware.org> (raw) CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: wysochanski@sourceware.org 2007-07-12 05:04:42 Modified files: . : WHATS_NEW lib/metadata : metadata.c metadata.h Log message: Turn _add_pv_to_vg() into external library function add_pv_to_vg() Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.653&r2=1.654 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata.c.diff?cvsroot=lvm2&r1=1.125&r2=1.126 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata.h.diff?cvsroot=lvm2&r1=1.167&r2=1.168 --- LVM2/WHATS_NEW 2007/07/11 23:33:12 1.653 +++ LVM2/WHATS_NEW 2007/07/12 05:04:39 1.654 @@ -1,6 +1,7 @@ Version 2.02.27 - ================================ - Add pv_read_path external library function. + Turn _add_pv_to_vg() into external library function add_pv_to_vg(). + Add pv_read_path() external library function. Tidy clvmd-openais of redundant bits, and improve an error report. Cope with find_seg_by_le() failure in check_lv_segments(). Call dev_iter_destroy() if _process_all_devs() is interrupted by sigint. --- LVM2/lib/metadata/metadata.c 2007/07/12 04:12:04 1.125 +++ LVM2/lib/metadata/metadata.c 2007/07/12 05:04:41 1.126 @@ -66,10 +66,21 @@ return MAX(65536UL, lvm_getpagesize()) >> SECTOR_SHIFT; } -static int _add_pv_to_vg(struct volume_group *vg, const char *pv_name) +/** + * add_pv_to_vg - Add a physical volume to a volume group + * @vg - volume group to add to + * @pv_name - name of the pv (to be removed) + * @pv - physical volume to add to volume group + * + * Returns: + * 0 - failure + * 1 - success + * FIXME: remove pv_name - obtain safely from pv + */ +int add_pv_to_vg(struct volume_group *vg, const char *pv_name, + struct physical_volume *pv) { struct pv_list *pvl; - struct physical_volume *pv; struct format_instance *fid = vg->fid; struct dm_pool *mem = fid->fmt->cmd->mem; @@ -81,12 +92,6 @@ return 0; } - if (!(pv = pv_read_path(fid->fmt->cmd, pv_name))) { - log_error("%s not identified as an existing physical volume", - pv_name); - return 0; - } - if (*pv->vg_name) { log_error("Physical volume '%s' is already in volume group " "'%s'", pv_name, pv->vg_name); @@ -246,11 +251,19 @@ int vg_extend(struct volume_group *vg, int pv_count, char **pv_names) { int i; + struct physical_volume *pv; /* attach each pv */ - for (i = 0; i < pv_count; i++) - if (!_add_pv_to_vg(vg, pv_names[i])) + for (i = 0; i < pv_count; i++) { + if (!(pv = pv_read_path(vg->fid->fmt->cmd, pv_names[i]))) { + log_error("%s not identified as an existing " + "physical volume", pv_names[i]); goto bad; + } + + if (!add_pv_to_vg(vg, pv_names[i], pv)) + goto bad; + } /* FIXME Decide whether to initialise and add new mdahs to format instance */ @@ -1854,7 +1867,7 @@ * non-NULL - PV handle corresponding to device path * */ -pv_t *pv_read_path(const struct cmd_context *cmd, const char *pv_name) +pv_t *pv_read_path(struct cmd_context *cmd, const char *pv_name) { struct list mdas; --- LVM2/lib/metadata/metadata.h 2007/07/11 23:33:12 1.167 +++ LVM2/lib/metadata/metadata.h 2007/07/12 05:04:42 1.168 @@ -654,6 +654,8 @@ uint32_t vg_status(vg_t *vg); -pv_t *pv_read_path(const struct cmd_context *cmd, const char *pv_name); +pv_t *pv_read_path(struct cmd_context *cmd, const char *pv_name); +int add_pv_to_vg(struct volume_group *vg, const char *pv_name, + struct physical_volume *pv); #endif
next reply other threads:[~2007-07-12 5:04 UTC|newest] Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top 2007-07-12 5:04 wysochanski [this message] -- strict thread matches above, loose matches on Subject: below -- 2011-11-04 22:49 zkabelac 2011-08-10 20:17 zkabelac 2010-09-23 12:02 prajnoha 2010-07-07 2:53 agk 2010-03-31 17:21 mbroz 2009-03-16 14:35 mbroz 2008-06-23 19:04 wysochanski 2008-04-22 12:54 agk 2007-07-12 15:38 wysochanski 2007-07-11 23:33 wysochanski 2007-06-06 19:40 wysochanski 2007-04-25 20:03 wysochanski 2007-02-07 13:29 agk 2005-04-18 14:56 agk 2004-06-19 19:27 agk
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=20070712050443.13625.qmail@sourceware.org \ --to=wysochanski@sourceware.org \ --cc=lvm-devel@redhat.com \ --cc=lvm2-cvs@sourceware.org \ /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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).