2014-09-25 10:31:10 +02:00
|
|
|
---
|
|
|
|
tools/lvcreate.c | 28 ++++++++++++++++++++++++++--
|
|
|
|
1 file changed, 26 insertions(+), 2 deletions(-)
|
|
|
|
|
2016-05-11 05:42:15 +02:00
|
|
|
Index: LVM2.2.02.152/tools/lvcreate.c
|
2016-01-28 05:41:36 +01:00
|
|
|
===================================================================
|
2016-05-11 05:42:15 +02:00
|
|
|
--- LVM2.2.02.152.orig/tools/lvcreate.c
|
|
|
|
+++ LVM2.2.02.152/tools/lvcreate.c
|
2016-01-28 05:41:36 +01:00
|
|
|
@@ -639,6 +639,28 @@ static int _read_activation_params(struc
|
2014-06-12 10:09:50 +02:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2014-09-25 10:31:10 +02:00
|
|
|
+static int clvmd_daemon_is_running(void)
|
2014-06-12 10:09:50 +02:00
|
|
|
+{
|
|
|
|
+ int fd;
|
|
|
|
+ struct flock lock;
|
|
|
|
+
|
2016-05-11 05:42:15 +02:00
|
|
|
+ if((fd = open("/var/run/cmirrord.pid", O_RDONLY)) < 0)
|
2014-06-12 10:09:50 +02:00
|
|
|
+ return 0;
|
|
|
|
+
|
|
|
|
+ lock.l_type = F_WRLCK;
|
|
|
|
+ lock.l_start = 0;
|
|
|
|
+ lock.l_whence = SEEK_SET;
|
|
|
|
+ lock.l_len = 0;
|
|
|
|
+ if (fcntl(fd, F_GETLK, &lock) < 0) {
|
|
|
|
+ /* errors with fcntl */
|
|
|
|
+ close(fd);
|
|
|
|
+ return 0;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ close(fd);
|
|
|
|
+ return (lock.l_type == F_UNLCK) ? 0 : 1;
|
|
|
|
+}
|
|
|
|
+
|
2014-12-04 07:08:29 +01:00
|
|
|
static int _lvcreate_params(struct cmd_context *cmd,
|
|
|
|
int argc, char **argv,
|
|
|
|
struct lvcreate_params *lp,
|
2016-01-28 05:41:36 +01:00
|
|
|
@@ -689,6 +711,8 @@ static int _lvcreate_params(struct cmd_c
|
2014-12-04 07:08:29 +01:00
|
|
|
mirror_default_cfg = (arg_uint_value(cmd, stripes_ARG, 1) > 1)
|
|
|
|
? global_raid10_segtype_default_CFG : global_mirror_segtype_default_CFG;
|
|
|
|
segtype_str = find_config_tree_str(cmd, mirror_default_cfg, NULL);
|
2014-06-12 10:09:50 +02:00
|
|
|
+ if(clvmd_daemon_is_running())
|
|
|
|
+ segtype_str = "mirror";
|
2014-12-04 07:08:29 +01:00
|
|
|
} else
|
2016-01-28 05:41:36 +01:00
|
|
|
segtype_str = SEG_TYPE_NAME_STRIPED;
|
2014-12-04 07:08:29 +01:00
|
|
|
|