Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 81447 Details for
Bug 115875
Use EVMS for cryptsetup-luks DM objects
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Updated dm input patch for EVMS 2.5.5
dev_mapper_input.patch (text/plain), 11.26 KB, created by
Brad Allen
on 2006-03-05 13:33:25 UTC
(
hide
)
Description:
Updated dm input patch for EVMS 2.5.5
Filename:
MIME Type:
Creator:
Brad Allen
Created:
2006-03-05 13:33:25 UTC
Size:
11.26 KB
patch
obsolete
>Comments from original patch for 2.5.3: >from URL http://marc.theaimsgroup.com/?l=evms-devel&m=112887246404441&w=2 > ><head><title>'[Evms-devel] [PATCH] 2.5.3 device-mapper input' - MARC</title></head> ><META NAME="robots" CONTENT="noarchive"> > ><body bgcolor="#000000" text="#ffffff" link="#ffffff" vlink="#ddddff"> ><pre><b>[<a href="?l=evms-devel&m=112853428509330&w=2">prev in list</a>] [<a href="?l=evms-devel&m=112888799008508&w=2">next in list</a>] [<font color="#c0c0c0">prev in thread</font>] [<font color="#c0c0c0">next in thread</font>] </b> ><b><font size=+1> >List: <a href="?l=evms-devel&r=1&w=2">evms-devel</a> >Subject: [Evms-devel] [PATCH] 2.5.3 device-mapper input >From: <a href="?a=108404336000003&r=1&w=2"><garlicbread () ntlworld ! com></a> >Date: <a href="?l=evms-devel&r=1&w=2&b=200510">2005-10-09 15:22:10</a> >Message-ID: <a href="?i=20051009142313.TJFF8556.aamta10-winn.ispmail.ntl.com%20()%20smtp%20!%20ntlworld%20!%20com">20051009142313.TJFF8556.aamta10-winn.ispmail.ntl.com () smtp ! ntlworld ! com</a></font> >[<a href="?l=evms-devel&m=112887246404441&q=raw">Download message RAW</a>]</b> > >Hi, Some of you may find this interesting >a patch against evms 2.5.3 to enable device-mapper devices for input into evms >This is useful for things such as layering evms on top of dmraid and dm-crypt without \ >the need for loop back devices (I've tried this with dmraid and I think this should \ >also work for dm-crypt) I'm posting this from a web-mail system at the moment so I \ >hope the patch gets through okay > >a better approach would probably be to have a seperate plugin to control the aspects \ >of device-mapper raid / crypt within evms perhaps as some form of region layer but at \ >the moment I'm trying to see if I can write a reiser4 plugin > >only device mapper targets stated in the new config section will be picked up (no \ >wildcards) devices will show up with a prefix of dm/<dm target> >it's best to specify the entire disk target and let evms determine the seperate \ >partitions for itself > >it may even be possible to layer an evms volume on top of another evms volume \ >(assuming your crazy enough to try) but I wouldn't advise it :) > > >----------------------------------------- >Email sent from <a href="http://www.ntlworld.com">www.ntlworld.com</a> >Virus-checked using McAfee(R) Software >Visit <a href="http://www.ntlworld.com/security">www.ntlworld.com/security</a> for more information > > ><a href="?l=evms-devel&m=112887246404441&q=p3"><b>["evms-2.5.3-userdm-0.1.patch" (text/x-patch)]</b></a> > >[... then the patch followed ...] > >------------------------------------------------------- >This SF.Net email is sponsored by: >Power Architecture Resource Center: Free content, downloads, discussions, >and more. <a href="http://solutions.newsforge.com/ibmarch.tmpl">http://solutions.newsforge.com/ibmarch.tmpl</a> >_______________________________________________ >Evms-devel mailing list >Evms-devel@lists.sourceforge.net >To subscribe/unsubscribe, please visit: ><a href="https://lists.sourceforge.net/lists/listinfo/evms-devel">https://lists.sourceforge.net/lists/listinfo/evms-devel</a> > ><b>[<a href="?l=evms-devel&m=112853428509330&w=2">prev in list</a>] [<a href="?l=evms-devel&m=112888799008508&w=2">next in list</a>] [<font color="#c0c0c0">prev in thread</font>] [<font color="#c0c0c0">next in thread</font>] </b> ></pre> > </pre><br><center> > <a href="?q=configure">Configure</a> | > > <a href="?q=about">About MARC</a> | > <a href="?q=about#Begware">Support MARC</a> | > <a href="mailto:webguy@theaimsgroup.com?subject=Add a list to MARC">Got a list to add?</a> | > Sponsored by <a href="http://www.10East.com/">10East</a> and <a href="http://www.korelogic.com/">KoreLogic</a> ></center> ></body> ></html> > >Here is the patch: I assigned it USE flag "evmsdminput" in Gentoo -u > >diff -x'*~' -Nru /usr/src/evms/compare/evms-2.5.5/doc/evms.conf evms-2.5.5/doc/evms.conf >--- /usr/src/evms/compare/evms-2.5.5/doc/evms.conf 2006-02-23 07:49:43.000000000 -0800 >+++ evms-2.5.5/doc/evms.conf 2006-03-05 12:20:26.485719200 -0800 >@@ -251,6 +251,25 @@ > device_size_prompt = yes > } > >+# User devmapper section >+# This allows us to use a device-mapper device directly as a disk >+# without the need for loopback >+# Be careful not to specify any targets that are created by evms >+# This can be useful for any devices created via dmraid or other means >+ >+# In order for this to work "dm*" has to be in the list of includes >+ >+devmapper { >+ # This needs to be set to yes to enable >+ #dm_user = yes >+ >+ # List of targets to discover as disks >+ # These are the target names as seen with "dmsetup ls" >+ # only specific targets can be used >+ # we need to avoid evms created targets >+ #dm_user_targets = [ raid1_device raid0_device ] >+} >+ > # MD plugin section > > md { >diff -x'*~' -Nru /usr/src/evms/compare/evms-2.5.5/engine/dm-targets.c evms-2.5.5/engine/dm-targets.c >--- /usr/src/evms/compare/evms-2.5.5/engine/dm-targets.c 2005-11-07 07:46:41.000000000 -0800 >+++ evms-2.5.5/engine/dm-targets.c 2006-03-05 12:30:13.348119613 -0800 >@@ -762,7 +762,7 @@ > * A mirror string has the form: > * <log_type> <num_log_params> [<log_params>]* <num_mirrors> [<major>:<minor> <start_lba>]{2,} > * >- * Currently, log_type will always be "core", num_log_params is 1, and >+ * Currently, log_type will always be "core", num_log_params is 1 or 2, and > * log_params is chunk-size (in sectors). > **/ > static int mirror_build_params(dm_target_t *target) >@@ -807,21 +807,32 @@ > { > dm_target_mirror_t *mirror = target->data.mirror; > char *params = target->params; >- int i, rc; >+ int i, rc, num_opts; > > LOG_PROC_ENTRY(); > >- /* Skip "core 1" at the start of the string. */ >- params = next_token(params); >+ /* Skip "core" at the start of the string. */ > params = next_token(params); > >- rc = sscanf(params, "%u %u", &mirror->chunk_size, &mirror->num_mirrors); >+ /* get the number of options for core and the chunk size */ >+ rc = sscanf(params, "%u %u", &num_opts, &mirror->chunk_size); > if (rc != 2) { > rc = EINVAL; > goto out; > } >- > params = next_token(params); >+ >+ /* skip the options for core based on num_opts */ >+ for (i = 0; i < num_opts; i++) { >+ params = next_token(params); >+ } >+ >+ /* get the number of mirrors */ >+ rc = sscanf(params, "%u", &mirror->num_mirrors); >+ if (rc != 1) { >+ rc = EINVAL; >+ goto out; >+ } > params = next_token(params); > > for (i = 0; i < mirror->num_mirrors; i++) { >@@ -855,13 +866,33 @@ > static int mirror_pretranslate_params(char *params, u_int32_t *num_devs, > u_int32_t *num_groups) > { >- int rc; >+ int rc, i, num_opts = 0; >+ char *num_devs_point; > > LOG_PROC_ENTRY(); > >- rc = sscanf(params, "%*s %*d %*u %u", num_devs); >+ /* The mirror target can have more than 1 option >+ this affects the location of the number of member disks */ >+ >+ rc = sscanf(params, "%*s %u", &num_opts); >+ if (rc != 1) { >+ rc = EINVAL; >+ goto out; >+ } >+ >+ /* skip "core <num_opts>" */ >+ num_devs_point = next_token(params); >+ num_devs_point = next_token(params); >+ >+ /* skip the options for core based on num_opts */ >+ for (i = 0; i < num_opts; i++) { >+ num_devs_point = next_token(params); >+ } >+ >+ rc = sscanf(num_devs_point, "%u", num_devs); > rc = (rc != 1) ? EINVAL : 0; > >+out: > LOG_PROC_EXIT_INT(rc); > return rc; > } >diff -x'*~' -Nru /usr/src/evms/compare/evms-2.5.5/plugins/disk/localdskmgr.c evms-2.5.5/plugins/disk/localdskmgr.c >--- /usr/src/evms/compare/evms-2.5.5/plugins/disk/localdskmgr.c 2006-02-24 11:53:21.000000000 -0800 >+++ evms-2.5.5/plugins/disk/localdskmgr.c 2006-03-05 12:36:27.728621485 -0800 >@@ -1335,13 +1335,14 @@ > rc = EngFncs->dm_get_targets(disk, &targets); > if (rc) { > LOG_ERROR("Error getting DM mapping for disk %s.\n", disk->name); >+ rc=0; > goto out; > } > > /* Reject all non-multipath devices. */ > if (targets->type != DM_TARGET_MULTIPATH) { > LOG_DEBUG("Disk %s is not a multipath device.\n", disk->name); >- rc = EINVAL; >+ //rc = EINVAL; > goto out; > } > >@@ -1541,6 +1542,98 @@ > } > > /** >+ * check_user_devicemapper >+ * >+ * Check if this disk is a User created DM device. >+ **/ >+static int check_user_devicemapper(storage_object_t * disk) >+{ >+ dm_device_list_t * dm_list, * dm_entry; >+ dm_target_t * targets = NULL; >+ local_disk_t * ld = disk->private_data; >+ int rc = 0, dm_user_targets_count = 0, i, dmup_len; >+ boolean user_dm_enable; >+ const char * const * dm_user_targets; >+ char * dm_user_prefix = "dm/"; >+ >+ LOG_ENTRY(); >+ >+ /* Get the list of active DM devices. */ >+ dm_list = get_dm_device_list(); >+ if (!dm_list) { >+ LOG_WARNING("Cannot get list of DM devices.\n"); >+ goto out; >+ } >+ >+ /* Search the DM list for an entry that matches this disk. */ >+ dm_entry = find_disk_in_dm_devices(disk, dm_list); >+ if (!dm_entry) { >+ LOG_DEBUG("Disk %s is not a DM device.\n", disk->name); >+ goto out; >+ } >+ >+ user_dm_enable = FALSE; >+ EngFncs->get_config_bool("devmapper.dm_user", &user_dm_enable); >+ >+ EngFncs->get_config_string_array("devmapper.dm_user_targets", >+ &dm_user_targets_count, &dm_user_targets); >+ >+ if (user_dm_enable == FALSE) { >+ LOG_DEBUG("devmapper.dm_user not enabled.\n"); >+ rc = EINVAL; >+ goto out; >+ } >+ >+ /* search the named targets in the config for the DM name*/ >+ user_dm_enable = FALSE; >+ for (i = 0; i < dm_user_targets_count; i++) { >+ if (strncmp(dm_user_targets[i], dm_entry->name, EVMS_NAME_SIZE) == 0) { >+ user_dm_enable = TRUE; >+ } >+ } >+ >+ if (user_dm_enable == FALSE) { >+ LOG_DEBUG("%s not found in devmapper.dm_user_targets.\n", dm_entry->name); >+ rc = EINVAL; >+ goto out; >+ } >+ >+ /* Get the DM mapping for this disk. */ >+ /* we can use this in the future if we need to, and it's good to check */ >+ strncpy(disk->name, dm_entry->name, EVMS_NAME_SIZE); >+ rc = EngFncs->dm_get_targets(disk, &targets); >+ if (rc) { >+ LOG_ERROR("Error getting DM mapping for disk %s.\n", disk->name); >+ goto out; >+ } >+ >+ /* Copy the DM name to this disk. */ >+ dmup_len = strlen(dm_user_prefix); >+ LOG_DEBUG("Changing disk name from %s to %s%s.\n", >+ disk->name, dm_user_prefix ,dm_entry->name); >+ >+ strncpy(disk->name, dm_user_prefix, dmup_len); >+ strncpy((disk->name)+dmup_len, dm_entry->name, EVMS_NAME_SIZE-dmup_len); >+ >+ /* Reject all multipath devices that >+ * were created by other EVMS plugins. >+ */ >+ rc = check_multipath_name(disk); >+ if (rc) { >+ LOG_DEBUG("Multipath disk %s belongs to another EVMS plugin.\n", >+ disk->name); >+ goto out; >+ } >+ >+ ld->flags |= LD_FLAG_USERDM; >+ >+out: >+ /*EngFncs->dm_deallocate_targets(targets); */ >+ LOG_EXIT_INT(rc); >+ return rc; >+} >+ >+/** > * get_geometry > * > * First try to get the geometry from the partition table (if it exists). >@@ -1834,6 +1927,13 @@ > /* Get the disk's hard-sector-size. */ > get_hardsector_size(&working_disk); > >+ /* Check for User created DM devices. */ >+ rc = check_user_devicemapper(&working_disk); >+ if (rc) { >+ close_dev(&working_disk); >+ continue; >+ } >+ > /* Get the disk's geometry. */ > get_geometry(&working_disk); > >diff -x'*~' -Nru /usr/src/evms/compare/evms-2.5.5/plugins/disk/localdskmgr.h evms-2.5.5/plugins/disk/localdskmgr.h >--- /usr/src/evms/compare/evms-2.5.5/plugins/disk/localdskmgr.h 2006-02-24 09:00:44.000000000 -0800 >+++ evms-2.5.5/plugins/disk/localdskmgr.h 2006-03-05 12:36:46.917967652 -0800 >@@ -93,6 +93,7 @@ > #define LD_FLAG_MULTIPATH (1 << 0) > #define LD_FLAG_IDE (1 << 1) > #define LD_FLAG_SCSI (1 << 2) >+#define LD_FLAG_USERDM (1 << 3) > > extern engine_functions_t *EngFncs; > extern plugin_record_t *my_plugin_record;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 115875
:
74958
|
74963
|
74965
|
74966
|
74968
|
74969
|
74970
|
74971
|
74973
| 81447