~ubuntu-branches/ubuntu/vivid/lvm2/vivid

« back to all changes in this revision

Viewing changes to debian/patches/missing-dmeventd.patch

  • Committer: Package Import Robot
  • Author(s): Dmitrijs Ledkovs
  • Date: 2012-11-26 10:35:00 UTC
  • mfrom: (3.1.26 sid)
  • Revision ID: package-import@ubuntu.com-20121126103500-a1zw30282cu9kdev
Tags: 2.02.95-5ubuntu1
* Merge from Debian unstable, remaining changes (LP: #1082325):
  - debian/patches/avoid-dev-block.patch: Prefer any other device name over
    names in /dev/block/ since lvm.conf won't handle this.
  - debian/rules:
    - copy .po file to .pot file for Rosetta (Ubuntu specific).
  - debian/{dmsetup,lvm2}-udeb.install:
    - install initramfs and udev hooks in udebs (Debian bug 504341).
  - auto-start VGs as their PVs are discovered (Ubuntu specific):
    - add debian/tree/lvm2/lib/udev/rules.d/85-lvm2.rules: use watershed plus
      the sledgehammer of vgscan/vgchange to turn on VGs as they come online.
    - debian/tree/lvm2/usr/share/initramfs-tools/scripts/hooks/lvm2:
      - add 85-lvm2.rules to the list of udev rules to copy.
      - depend on udev.
    - debian/control:
      - add versioned Depend on watershed in lvm2 for udev rules.
      - add Depends on watershed-udeb in lvm2-udeb for udev rules.
      - add versioned Depend/Breaks on udev in dmsetup for udev rules.
      - add Depend on initramfs-tools in dmsetup so system is not potentially
        rendered unbootable by out-of-order dpkg configuration.
      - In libdevmapper-event1.02.1 add Breaks: dmeventd
        (<< 2.02.95-4ubuntu1) due to debian symbol rename
    - debian/rules:
      - do not install local-top scripts since Ubuntu mounts root using udev.
      - do not install init scripts for lvm2, since udev starts LVM.
    - debian/lvm2.postinst: handle missing lvm2 init script.
    - debian/tree/dmsetup/lib/udev/rules.d/60-persistent-storage-dm.rules:
      watch dm devices for changes with inotify
  - add mountroot failure hooks to help fix bad boots (Debian bug 468115):
    - debian/tree/lvm2/usr/share/initramfs-tools/scripts/init-premount/lvm2
  - remaining changes to upstream event manager packages (Debian bug 514706):
    - debian/rules:
      - enable dmeventd during configure.
    - debian/dmeventd.{8,manpages}: install dmeventd files.
  - rename debian/clvm.defaults to debian/clvm.default so it is installed
    correctly.
  - debian/control: add dmsetup-udeb to libdevmapper1.02.1-udeb recommends.
  - debian/rules: make sure dmsetup and lvm2 initramfs-tools scripts are
    executable.  When the Ubuntu-specific ones are added with a patch,
    they may lose their executable bit.
  - Add and install clvmd resource agent
  - Add dependency on libudev-dev to libdevmapper-dev so that the .pc file
    works.
  - debian/{clvmd.ra,clvm.init}:
    - create /run/lvm if it doesn't exist.
  - debian/clvm.init:
    - exit 3 if not running on status action.
  - Call dh_installman so that our dmeventd manpage actually gets installed
  - Install the missing fsadm manpage.
  - Complete libdevmapper-dev multiarch:
    - move .so symlinks and pkgconfig files to multiarched locations.
    - mark libdevmapper-dev M-A: same

* Dropped changes debian/lvm2.{preinst,postinst,postrm}, not needed in Raring:
  - Implement removal of obsolete /etc/init.d/lvm2 conffile, which
    should not have been re-introduced in Quantal.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
Description: Ignore missing dmeventd
 
2
Author: Bastian Blank <waldi@debian.org>
 
3
 
 
4
--- a/daemons/dmeventd/libdevmapper-event.c
 
5
+++ b/daemons/dmeventd/libdevmapper-event.c
 
6
@@ -441,7 +441,10 @@
 
7
        /* server is not running */
 
8
 
 
9
        if (!strncmp(DMEVENTD_PATH, "/", 1) && stat(DMEVENTD_PATH, &statbuf)) {
 
10
-               log_sys_error("stat", DMEVENTD_PATH);
 
11
+               if (errno != ENOENT)
 
12
+                       log_error("Unable to find " DMEVENTD_PATH ": %s", strerror(errno));
 
13
+               else
 
14
+                       log_sys_debug("stat", DMEVENTD_PATH);
 
15
                return 0;
 
16
        }
 
17
 
 
18
@@ -627,10 +630,19 @@
 
19
 
 
20
        if ((err = _do_event(DM_EVENT_CMD_REGISTER_FOR_EVENT, dmevh->dmeventd_path, &msg,
 
21
                             dmevh->dso, uuid, dmevh->mask, dmevh->timeout)) < 0) {
 
22
-               log_error("%s: event registration failed: %s",
 
23
-                         dm_task_get_name(dmt),
 
24
-                         msg.data ? msg.data : strerror(-err));
 
25
-               ret = 0;
 
26
+               if (err != -ESRCH) {
 
27
+                       log_error("%s: event registration failed: %s",
 
28
+                                 dm_task_get_name(dmt),
 
29
+                                 msg.data ? msg.data : strerror(-err));
 
30
+                       ret = 0;
 
31
+               }
 
32
+               else {
 
33
+                       /* XXX: Ignore missing daemon */
 
34
+                       log_debug("%s: event registration failed, ignored: %s",
 
35
+                                 dm_task_get_name(dmt),
 
36
+                                 msg.data ? msg.data : strerror(-err));
 
37
+                       ret = 2;
 
38
+               }
 
39
        }
 
40
 
 
41
        dm_free(msg.data);
 
42
--- a/lib/activate/activate.c
 
43
+++ b/lib/activate/activate.c
 
44
@@ -1197,10 +1197,12 @@
 
45
 
 
46
        if (!r)
 
47
                return_0;
 
48
+       else if (r == 2)
 
49
+               log_info("No monitoring daemon available for %s", uuid);
 
50
+       else if (r == 1)
 
51
+               log_info("%s %s for events", set ? "Monitored" : "Unmonitored", uuid);
 
52
 
 
53
-       log_info("%s %s for events", set ? "Monitored" : "Unmonitored", uuid);
 
54
-
 
55
-       return 1;
 
56
+       return r;
 
57
 }
 
58
 
 
59
 #endif
 
60
@@ -1214,7 +1216,7 @@
 
61
 {
 
62
 #ifdef DMEVENTD
 
63
        int i, pending = 0, monitored;
 
64
-       int r = 1;
 
65
+       int r = 1, err;
 
66
        struct dm_list *tmp, *snh, *snht;
 
67
        struct lv_segment *seg;
 
68
        struct lv_segment *log_seg;
 
69
@@ -1319,25 +1321,30 @@
 
70
                        continue;
 
71
 
 
72
                /* FIXME specify events */
 
73
-               if (!monitor_fn(seg, 0)) {
 
74
+               err = monitor_fn(seg, 0);
 
75
+               if (!err) {
 
76
                        log_error("%s/%s: %s segment monitoring function failed.",
 
77
                                  lv->vg->name, lv->name, seg->segtype->name);
 
78
                        return 0;
 
79
                }
 
80
-
 
81
-               /* Check [un]monitor results */
 
82
-               /* Try a couple times if pending, but not forever... */
 
83
-               for (i = 0; i < 10; i++) {
 
84
-                       pending = 0;
 
85
-                       monitored = seg->segtype->ops->target_monitored(seg, &pending);
 
86
-                       if (pending ||
 
87
-                           (!monitored && monitor) ||
 
88
-                           (monitored && !monitor))
 
89
-                               log_very_verbose("%s/%s %smonitoring still pending: waiting...",
 
90
-                                                lv->vg->name, lv->name, monitor ? "" : "un");
 
91
-                       else
 
92
-                               break;
 
93
-                       sleep(1);
 
94
+               /* XXX: Ignore monitoring events if no daemon is available. */
 
95
+               else if (err == 2)
 
96
+                       monitored = monitor = 0;
 
97
+               else {
 
98
+                       /* Check [un]monitor results */
 
99
+                       /* Try a couple times if pending, but not forever... */
 
100
+                       for (i = 0; i < 10; i++) {
 
101
+                               pending = 0;
 
102
+                               monitored = seg->segtype->ops->target_monitored(seg, &pending);
 
103
+                               if (pending ||
 
104
+                                   (!monitored && monitor) ||
 
105
+                                   (monitored && !monitor))
 
106
+                                       log_very_verbose("%s/%s %smonitoring still pending: waiting...",
 
107
+                                                        lv->vg->name, lv->name, monitor ? "" : "un");
 
108
+                               else
 
109
+                                       break;
 
110
+                               sleep(1);
 
111
+                       }
 
112
                }
 
113
 
 
114
                if (r)