lvm2/use-mirrortype-asdefault-whenclvmdrunning.patch
LiuhuaMelody Wang 8ac4ae703b Accepting request 393600 from home:scarabeus_iv:branches:Base:System
- Update patch use-mirrortype-asdefault-whenclvmdrunning.patch
  to match up the patches/pvmove_support_clustered_vg.diff and not
  use the define declared only when building clvm codebase;
  it is still broken if someone changes the PID location, but at least
  it now does not depend on clvm code
- Regenerate_initrd in post of the lvm2 main pkg
- Update baselibs to point to split-out devicemapper libraries

- Keep in sync the common configuration options that are shared among
  all the variants dm/lvm2/clvm

- Provide symlinks to 1.02 versions of dm and dm-event libs
  * this should sort out binary packages without the need of double
    rebuilding

- Update to 2.02.152 release, read WHATS_NEW for detailed log.
- Refresh patches:
  * 10-dm.rules-Reset-state-variable-for-spurious-events.patch
  * device-mapper-gcc-warnings.patch
  * device-mapper-link.patch
  * udev-Check-for-DM_NR_VALID_PATHS.patch
- Slightly tweak btrfs patch as the code changed for the detection:
  * fsadm-add-support-for-btrfs.patch

- Build and install properly cluster files
- Remove csm-converter.tar.gz as the evms was last present on sle10
  and thus migration is bit out of scope today

- Add pre_checkin.sh to allow syncing of patches between packages:
  workflow = add everything to lvm2.spec and run pre_checkin.sh

OBS-URL: https://build.opensuse.org/request/show/393600
OBS-URL: https://build.opensuse.org/package/show/Base:System/lvm2?expand=0&rev=150
2016-05-11 03:42:15 +00:00

47 lines
1.4 KiB
Diff

---
tools/lvcreate.c | 28 ++++++++++++++++++++++++++--
1 file changed, 26 insertions(+), 2 deletions(-)
Index: LVM2.2.02.152/tools/lvcreate.c
===================================================================
--- LVM2.2.02.152.orig/tools/lvcreate.c
+++ LVM2.2.02.152/tools/lvcreate.c
@@ -639,6 +639,28 @@ static int _read_activation_params(struc
return 1;
}
+static int clvmd_daemon_is_running(void)
+{
+ int fd;
+ struct flock lock;
+
+ if((fd = open("/var/run/cmirrord.pid", O_RDONLY)) < 0)
+ 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;
+}
+
static int _lvcreate_params(struct cmd_context *cmd,
int argc, char **argv,
struct lvcreate_params *lp,
@@ -689,6 +711,8 @@ static int _lvcreate_params(struct cmd_c
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);
+ if(clvmd_daemon_is_running())
+ segtype_str = "mirror";
} else
segtype_str = SEG_TYPE_NAME_STRIPED;