示例#1
0
文件: pvresize.c 项目: tasleson/lvm2
static int _pvresize_single(struct cmd_context *cmd,
			    struct volume_group *vg,
			    struct physical_volume *pv,
			    struct processing_handle *handle)
{
	struct pvresize_params *params = (struct pvresize_params *) handle->custom_handle;

	if (!params) {
		log_error(INTERNAL_ERROR "Invalid resize params.");
		return ECMD_FAILED;
	}
	params->total++;

	if (vg && vg_is_exported(vg)) {
		log_error("Volume group %s is exported", vg->name);
		return ECMD_FAILED;
	}

	/*
	 * Needed to change a property on an orphan PV.
	 * i.e. the global lock is only needed for orphans.
	 * Convert sh to ex.
	 */
	if (is_orphan(pv)) {
		if (!lockd_gl(cmd, "ex", 0))
			return_ECMD_FAILED;
		cmd->lockd_gl_disable = 1;
	}

	if (!pv_resize_single(cmd, vg, pv, params->new_size, arg_is_set(cmd, yes_ARG)))
		return_ECMD_FAILED;

	params->done++;

	return ECMD_PROCESSED;
}
示例#2
0
文件: vgscan.c 项目: andyvand/cyglvm2
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program; if not, write to the Free Software Foundation,
 * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

#include "tools.h"

static int _lvmetad;

static int vgscan_single(struct cmd_context *cmd, const char *vg_name,
			 struct volume_group *vg,
			 void *handle __attribute__((unused)))
{
	log_print("Found %svolume group \"%s\" using metadata type %s",
		  vg_is_exported(vg) ? "exported " : "", vg_name,
		  vg->fid->fmt->name);

	check_current_backup(vg);

	/* keep lvmetad up to date, restore the "active" state temporarily */
	lvmetad_set_active(_lvmetad);
	if (!lvmetad_vg_update(vg))
		stack;
	lvmetad_set_active(0);

	return ECMD_PROCESSED;
}

int vgscan(struct cmd_context *cmd, int argc, char **argv)
{