예제 #1
0
/*
 * run_repair is a close copy to
 * plugins/mirror/dmeventd_mirror.c:_remove_failed_devices()
 */
static int run_repair(const char *device)
{
	int r;
#define CMD_SIZE 256	/* FIXME Use system restriction */
	char cmd_str[CMD_SIZE];

	if (!dmeventd_lvm2_command(dmeventd_lvm2_pool(), cmd_str, sizeof(cmd_str),
				  "lvscan --cache", device))
		return -1;

	r = dmeventd_lvm2_run(cmd_str);

	if (!r)
		syslog(LOG_INFO, "Re-scan of RAID device %s failed.", device);

	if (!dmeventd_lvm2_command(dmeventd_lvm2_pool(), cmd_str, sizeof(cmd_str),
				  "lvconvert --config devices{ignore_suspended_devices=1} "
				  "--repair --use-policies", device))
		return -1;

	/* if repair goes OK, report success even if lvscan has failed */
	r = dmeventd_lvm2_run(cmd_str);

	if (!r)
		syslog(LOG_INFO, "Repair of RAID device %s failed.", device);

	return (r) ? 0 : -1;
}
예제 #2
0
static int _extend(struct dso_state *state)
{
#if THIN_DEBUG
	syslog(LOG_INFO, "dmeventd executes: %s.\n", state->cmd_str);
#endif
	return (dmeventd_lvm2_run(state->cmd_str) == ECMD_PROCESSED);
}