Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 115875 | Differences between
and this patch

Collapse All | Expand All

(-)evms-2.5.3.org/doc/evms.conf (+19 lines)
Lines 239-241 Link Here
239
        device_size_prompt = yes
239
        device_size_prompt = yes
240
}
240
}
241
241
242
# User devmapper section
243
# This allows us to use a device-mapper device directly as a disk
244
# without the need for loopback
245
# Be careful not to specify any targets that are created by evms
246
# This can be useful for any devices created via dmraid or other means
247
248
# In order for this to work "dm*" has to be in the list of includes
249
250
devmapper {
251
	# This needs to be set to yes to enable
252
	#dm_user = yes
253
	
254
	# List of targets to discover as disks
255
	# These are the target names as seen with "dmsetup ls"
256
	# only specific targets can be used
257
	# we need to avoid evms created targets
258
	#dm_user_targets = [ raid1_device raid0_device ]
259
}
260
(-)evms-2.5.3.org/engine/dm-targets.c (-8 / +39 lines)
Lines 800-827 Link Here
800
 * Fill in a mirror target structure based on an ASCII table string of the form:
800
 * Fill in a mirror target structure based on an ASCII table string of the form:
801
 *   <log_type> <num_log_params> [<log_params>]* <num_mirrors> [<major>:<minor> <start_lba>]{2,}
801
 *   <log_type> <num_log_params> [<log_params>]* <num_mirrors> [<major>:<minor> <start_lba>]{2,}
802
 *
802
 *
803
 * Currently, log_type will always be "core", num_log_params is 1, and
803
 * Currently, log_type will always be "core", num_log_params is 1 or 2, and
804
 * log_params is chunk-size (in sectors).
804
 * log_params is chunk-size (in sectors).
805
 **/
805
 **/
806
static int mirror_translate_params(dm_target_t *target)
806
static int mirror_translate_params(dm_target_t *target)
807
{
807
{
808
	dm_target_mirror_t *mirror = target->data.mirror;
808
	dm_target_mirror_t *mirror = target->data.mirror;
809
	char *params = target->params;
809
	char *params = target->params;
810
	int i, rc;
810
	int i, rc, num_opts;
811
811
812
	LOG_PROC_ENTRY();
812
	LOG_PROC_ENTRY();
813
813
814
	/* Skip "core 1" at the start of the string. */
814
	/* Skip "core" at the start of the string. */
815
	params = next_token(params);
816
	params = next_token(params);
815
	params = next_token(params);
817
816
818
	rc = sscanf(params, "%u %u", &mirror->chunk_size, &mirror->num_mirrors);
817
	/* get the number of options for core and the chunk size */
818
	rc = sscanf(params, "%u %u", &num_opts, &mirror->chunk_size);
819
	if (rc != 2) {
819
	if (rc != 2) {
820
		rc = EINVAL;
820
		rc = EINVAL;
821
		goto out;
821
		goto out;
822
	}
822
	}
823
824
	params = next_token(params);
823
	params = next_token(params);
824
825
	/* skip the options for core based on num_opts */
826
	for (i = 0; i < num_opts; i++) {
827
		params = next_token(params);
828
	}
829
830
	/* get the number of mirrors */
831
	rc = sscanf(params, "%u", &mirror->num_mirrors);
832
	if (rc != 1) {
833
		rc = EINVAL;
834
		goto out;
835
	}
825
	params = next_token(params);
836
	params = next_token(params);
826
837
827
	for (i = 0; i < mirror->num_mirrors; i++) {
838
	for (i = 0; i < mirror->num_mirrors; i++) {
Lines 855-867 Link Here
855
static int mirror_pretranslate_params(char *params, u_int32_t *num_devs,
866
static int mirror_pretranslate_params(char *params, u_int32_t *num_devs,
856
				      u_int32_t *num_groups)
867
				      u_int32_t *num_groups)
857
{
868
{
858
	int rc;
869
	int rc, i, num_opts = 0;
870
	char *num_devs_point;
859
871
860
	LOG_PROC_ENTRY();
872
	LOG_PROC_ENTRY();
861
873
862
	rc = sscanf(params, "%*s %*d %*u %u", num_devs);
874
	/* The mirror target can have more than 1 option
875
	this affects the location of the number of member disks */
876
877
	rc = sscanf(params, "%*s %u", &num_opts);
878
	if (rc != 1) {
879
		rc = EINVAL;
880
		goto out;
881
	}
882
883
	/* skip "core <num_opts>" */
884
	num_devs_point = next_token(params);
885
	num_devs_point = next_token(params);
886
887
	/* skip the options for core based on num_opts */
888
	for (i = 0; i < num_opts; i++) {
889
		num_devs_point = next_token(params);
890
	}
891
892
	rc = sscanf(num_devs_point, "%u", num_devs);
863
	rc = (rc != 1) ? EINVAL : 0;
893
	rc = (rc != 1) ? EINVAL : 0;
864
894
895
out:
865
	LOG_PROC_EXIT_INT(rc);
896
	LOG_PROC_EXIT_INT(rc);
866
	return rc;
897
	return rc;
867
}
898
}
(-)evms-2.5.3.org/plugins/disk/localdskmgr.c (-1 / +102 lines)
Lines 1315-1327 Link Here
1315
	rc = EngFncs->dm_get_targets(disk, &targets);
1315
	rc = EngFncs->dm_get_targets(disk, &targets);
1316
	if (rc) {
1316
	if (rc) {
1317
		LOG_ERROR("Error getting DM mapping for disk %s.\n", disk->name);
1317
		LOG_ERROR("Error getting DM mapping for disk %s.\n", disk->name);
1318
		rc=0;
1318
		goto out;
1319
		goto out;
1319
	}
1320
	}
1320
1321
1321
	/* Reject all non-multipath devices. */
1322
	/* Reject all non-multipath devices. */
1322
	if (targets->type != DM_TARGET_MULTIPATH) {
1323
	if (targets->type != DM_TARGET_MULTIPATH) {
1323
		LOG_DEBUG("Disk %s is not a multipath device.\n", disk->name);
1324
		LOG_DEBUG("Disk %s is not a multipath device.\n", disk->name);
1324
		rc = EINVAL;
1325
		//rc = EINVAL;
1325
		goto out;
1326
		goto out;
1326
	}
1327
	}
1327
1328
Lines 1382-1387 Link Here
1382
}
1383
}
1383
1384
1384
/**
1385
/**
1386
 * check_user_devicemapper
1387
 *
1388
 * Check if this disk is a User created DM device.
1389
 **/
1390
static int check_user_devicemapper(storage_object_t * disk)
1391
{
1392
	dm_device_list_t * dm_list, * dm_entry;
1393
	dm_target_t * targets = NULL;
1394
	local_disk_t * ld = disk->private_data;
1395
	int rc = 0, dm_user_targets_count = 0, i, dmup_len;
1396
	boolean user_dm_enable;
1397
	const char * const * dm_user_targets;
1398
	char * dm_user_prefix = "dm/";
1399
1400
	LOG_ENTRY();
1401
1402
	/* Get the list of active DM devices. */
1403
	dm_list = get_dm_device_list();
1404
	if (!dm_list) {
1405
		LOG_WARNING("Cannot get list of DM devices.\n");
1406
		goto out;
1407
	}
1408
1409
	/* Search the DM list for an entry that matches this disk. */
1410
	dm_entry = find_disk_in_dm_devices(disk, dm_list);
1411
	if (!dm_entry) {
1412
		LOG_DEBUG("Disk %s is not a DM device.\n", disk->name);
1413
		goto out;
1414
	}
1415
1416
	user_dm_enable = FALSE;
1417
	EngFncs->get_config_bool("devmapper.dm_user", &user_dm_enable);
1418
1419
	EngFncs->get_config_string_array("devmapper.dm_user_targets",
1420
					 &dm_user_targets_count, &dm_user_targets);
1421
1422
	if (user_dm_enable == FALSE) {
1423
		LOG_DEBUG("devmapper.dm_user not enabled.\n");
1424
		rc = EINVAL;
1425
		goto out;
1426
	}
1427
1428
	/* search the named targets in the config for the DM name*/
1429
	user_dm_enable = FALSE;
1430
	for (i = 0; i < dm_user_targets_count; i++) {		
1431
		if (strncmp(dm_user_targets[i], dm_entry->name, EVMS_NAME_SIZE) == 0) {
1432
			user_dm_enable = TRUE;
1433
		}
1434
	}
1435
1436
	if (user_dm_enable == FALSE) {
1437
		LOG_DEBUG("%s not found in devmapper.dm_user_targets.\n", dm_entry->name);
1438
		rc = EINVAL;
1439
		goto out;
1440
	}
1441
1442
	/* Get the DM mapping for this disk. */
1443
	/* we can use this in the future if we need to, and it's good to check */
1444
	strncpy(disk->name, dm_entry->name, EVMS_NAME_SIZE);
1445
	rc = EngFncs->dm_get_targets(disk, &targets);
1446
	if (rc) {
1447
		LOG_ERROR("Error getting DM mapping for disk %s.\n", disk->name);
1448
		goto out;
1449
	}
1450
1451
	/* Copy the DM name to this disk. */
1452
	dmup_len = strlen(dm_user_prefix);
1453
	LOG_DEBUG("Changing disk name from %s to %s%s.\n",
1454
		  disk->name, dm_user_prefix ,dm_entry->name);
1455
1456
	strncpy(disk->name, dm_user_prefix, dmup_len);
1457
	strncpy((disk->name)+dmup_len, dm_entry->name, EVMS_NAME_SIZE-dmup_len);
1458
1459
	/* Reject all multipath devices that
1460
	 * were created by other EVMS plugins.
1461
	 */
1462
	rc = check_multipath_name(disk);
1463
	if (rc) {
1464
		LOG_DEBUG("Multipath disk %s belongs to another EVMS plugin.\n",
1465
			  disk->name);
1466
		goto out;
1467
	}
1468
1469
	ld->flags |= LD_FLAG_USERDM;
1470
1471
out:
1472
	/*EngFncs->dm_deallocate_targets(targets); */
1473
	LOG_EXIT_INT(rc);
1474
	return rc;
1475
}
1476
1477
/**
1385
 * get_geometry
1478
 * get_geometry
1386
 *
1479
 *
1387
 * Use the HDIO_GETGEO_BIG or HDIO_GETGEO ioctl to get the disk's geometry.
1480
 * Use the HDIO_GETGEO_BIG or HDIO_GETGEO ioctl to get the disk's geometry.
Lines 1445-1450 Link Here
1445
	if (disk->dev_major == LOOP_MAJOR ||
1538
	if (disk->dev_major == LOOP_MAJOR ||
1446
	    disk->dev_major == NBD_MAJOR ||
1539
	    disk->dev_major == NBD_MAJOR ||
1447
	    disk->dev_major == DRBD_MAJOR ||
1540
	    disk->dev_major == DRBD_MAJOR ||
1541
		ld->flags & LD_FLAG_USERDM ||
1448
	    ld->flags & LD_FLAG_MULTIPATH) {
1542
	    ld->flags & LD_FLAG_MULTIPATH) {
1449
		LOG_DEBUG("Creating fake geometry for disk %s.\n", disk->name);
1543
		LOG_DEBUG("Creating fake geometry for disk %s.\n", disk->name);
1450
		disk->geometry.heads = 255;
1544
		disk->geometry.heads = 255;
Lines 1709-1714 Link Here
1709
			continue;
1803
			continue;
1710
		}
1804
		}
1711
1805
1806
		/* Check for User created DM devices. */
1807
		rc = check_user_devicemapper(&working_disk);
1808
		if (rc) {
1809
			close_dev(&working_disk);
1810
			continue;
1811
		}
1812
1712
		/* Get the disk's geometry. */
1813
		/* Get the disk's geometry. */
1713
		rc = get_geometry(&working_disk);
1814
		rc = get_geometry(&working_disk);
1714
		if (rc) {
1815
		if (rc) {
(-)evms-2.5.3.org/plugins/disk/localdskmgr.h (-1 / +1 lines)
Lines 80-85 Link Here
80
#define LD_FLAG_MULTIPATH	(1 << 0)
80
#define LD_FLAG_MULTIPATH	(1 << 0)
81
#define LD_FLAG_IDE		(1 << 1)
81
#define LD_FLAG_IDE		(1 << 1)
82
#define LD_FLAG_SCSI		(1 << 2)
82
#define LD_FLAG_SCSI		(1 << 2)
83
#define LD_FLAG_USERDM		(1 << 3)
83
84
84
extern engine_functions_t *EngFncs;
85
extern engine_functions_t *EngFncs;
85
extern plugin_record_t    *my_plugin_record;
86
extern plugin_record_t    *my_plugin_record;
86
------------------------------------------------------
87
 </pre><br><center>
87
 </pre><br><center>
88
   <a href="?q=configure">Configure</a> | 
88
   <a href="?q=configure">Configure</a> | 
89
   <a href="?q=about">About&nbsp;MARC</a> |
89
   <a href="?q=about">About&nbsp;MARC</a> |
90
   <a href="?q=about#Begware">Support MARC</a> |
90
   <a href="?q=about#Begware">Support MARC</a> |
91
   <a href="mailto:webguy@theaimsgroup.com?subject=Add a list to MARC">Got&nbsp;a&nbsp;list&nbsp;to&nbsp;add?</a> |
91
   <a href="mailto:webguy@theaimsgroup.com?subject=Add a list to MARC">Got&nbsp;a&nbsp;list&nbsp;to&nbsp;add?</a> |
92
   Sponsored&nbsp;by&nbsp;<a href="http://www.10East.com/">10East</a>&nbsp;and&nbsp;<a href="http://www.korelogic.com/">KoreLogic</a>
92
   Sponsored&nbsp;by&nbsp;<a href="http://www.10East.com/">10East</a>&nbsp;and&nbsp;<a href="http://www.korelogic.com/">KoreLogic</a>

Return to bug 115875