hwtable.o blacklist.o util.o dmparser.o config.o \
structs.o cache.o discovery.o propsel.o dict.o \
pgpolicies.o debug.o regex.o defaults.o uevent.o \
- switchgroup.o uxsock.o print.o
+ switchgroup.o uxsock.o print.o alias.o
CFLAGS = -pipe -g -Wall -Wunused -Wstrict-prototypes
int remove;
int rr_weight;
int no_path_retry;
+ int user_friendly_names;
char * dev;
char * udev_dir;
int dm_get_minor (char *name);
char * dm_mapname(int major, int minor);
int dm_remove_partmaps (char * mapname);
+int dm_get_uuid(char *name, char *uuid);
#if 0
int dm_rename (char * old, char * new);
return 0;
}
+static int
+names_handler(vector strvec)
+{
+ char * buff;
+
+ buff = set_value(strvec);
+
+ if (!buff)
+ return 1;
+
+ if (!strncmp(buff, "no", 2) || !strncmp(buff, "0", 1))
+ conf->user_friendly_names = 0;
+ else if (!strncmp(buff, "yes", 2) || !strncmp(buff, "1", 1))
+ conf->user_friendly_names = 1;
+
+ FREE(buff);
+ return 0;
+}
+
/*
* blacklist block handlers
*/
install_keyword("rr_min_io", &def_minio_handler);
install_keyword("rr_weight", &def_weight_handler);
install_keyword("no_path_retry", &def_no_path_retry_handler);
+ install_keyword("user_friendly_names", &names_handler);
/*
* deprecated synonyms
#include "config.h"
#include "debug.h"
#include "pgpolicies.h"
+#include "alias.h"
#include "../libcheckers/checkers.h"
{
if (mp->mpe && mp->mpe->alias)
mp->alias = mp->mpe->alias;
- else
- mp->alias = mp->wwid;
+ else {
+ mp->alias = NULL;
+ if (conf->user_friendly_names)
+ mp->alias = get_user_friendly_alias(mp->wwid);
+ if (mp->alias == NULL)
+ mp->alias = mp->wwid;
+ }
return 0;
}
int ux_socket_listen(const char *name);
int send_packet(int fd, const char *buf, size_t len);
int recv_packet(int fd, char **buf, size_t *len);
-
+size_t write_all(int fd, const void *buf, size_t len);
+size_t read_all(int fd, void *buf, size_t len);
# # default : (null)
# #
# #no_path_retry queue
+#
+# #
+# # name : user_friendly_names
+# # scope : multipath
+# # desc : If set to "yes", using the bindings file
+# # /var/lib/multipath/bindings to assign a persistent and
+# # unique alias to the multipath, in the form of mpath<n>.
+# # If set to "no" use the WWID as the alias. In either case
+# # this be will be overriden by any specific aliases in this
+# # file.
+# # values : yes|no
+# # default : no
+# user_friendly_names no
+#
#}
#
##
# rr_weight priorities
# failback immediate
# no_path_retry fail
+# user_friendly_name no
#}
#devnode_blacklist {
# wwid 26353900f02796769
mpp->mpe = find_mpe(pp1->wwid);
mpp->hwe = pp1->hwe;
+ strcpy(mpp->wwid, pp1->wwid);
select_alias(mpp);
pp1->mpp = mpp;
- strcpy(mpp->wwid, pp1->wwid);
mpp->size = pp1->size;
mpp->paths = vector_alloc();
static void
set_multipath_wwid (struct multipath * mpp)
{
- char * wwid;
-
- wwid = get_mpe_wwid(mpp->alias);
+ if (mpp->wwid)
+ return;
- if (wwid) {
- strncpy(mpp->wwid, wwid, WWID_SIZE);
- wwid = NULL;
- } else
- strncpy(mpp->wwid, mpp->alias, WWID_SIZE);
+ dm_get_uuid(mpp->alias, mpp->wwid);
}
static int