~ubuntu-branches/ubuntu/saucy/lvm2/saucy

« back to all changes in this revision

Viewing changes to tools/vgscan.c

  • Committer: Package Import Robot
  • Author(s): Dmitrijs Ledkovs
  • Date: 2013-05-30 11:02:10 UTC
  • mfrom: (3.1.28 sid)
  • Revision ID: package-import@ubuntu.com-20130530110210-q8bou4f333ruwhn0
Tags: 2.02.98-1ubuntu1
* Merge from Debian unstable, remaining changes:
  - 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.
      - continue to build clvm support.
    - 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, applied upstream:
  - Update Micron PCIe SSD and other device-types to latest available.
  - Cherry pick from upstream, remove unsupported udev_get_dev_path() call.
  - Move thin check to global section.

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
                         struct volume_group *vg,
20
20
                         void *handle __attribute__((unused)))
21
21
{
22
 
        log_print("Found %svolume group \"%s\" using metadata type %s",
23
 
                  vg_is_exported(vg) ? "exported " : "", vg_name,
24
 
                  vg->fid->fmt->name);
 
22
        log_print_unless_silent("Found %svolume group \"%s\" using metadata type %s",
 
23
                                vg_is_exported(vg) ? "exported " : "", vg_name,
 
24
                                vg->fid->fmt->name);
25
25
 
26
26
        check_current_backup(vg);
27
27
 
28
 
        /* keep lvmetad up to date */
29
 
        if (!lvmetad_vg_update(vg))
30
 
                stack;
31
 
 
32
28
        return ECMD_PROCESSED;
33
29
}
34
30
 
35
31
int vgscan(struct cmd_context *cmd, int argc, char **argv)
36
32
{
37
 
        int maxret, ret, lvmetad;
 
33
        int maxret, ret;
38
34
 
39
35
        if (argc) {
40
36
                log_error("Too many parameters on command line");
46
42
                return ECMD_FAILED;
47
43
        }
48
44
 
49
 
        persistent_filter_wipe(cmd->filter);
 
45
        if (cmd->filter->wipe)
 
46
                cmd->filter->wipe(cmd->filter);
50
47
        lvmcache_destroy(cmd, 1);
51
 
        lvmetad = lvmetad_active();
52
 
        lvmetad_set_active(0); /* do not rely on lvmetad info */
53
 
 
54
 
        log_print("Reading all physical volumes.  This may take a while...");
 
48
 
 
49
        if (arg_count(cmd, cache_ARG)) {
 
50
                if (lvmetad_active()) {
 
51
                        if (!lvmetad_pvscan_all_devs(cmd, NULL))
 
52
                                return ECMD_FAILED;
 
53
                }
 
54
                else {
 
55
                        log_error("Cannot proceed since lvmetad is not active.");
 
56
                        unlock_vg(cmd, VG_GLOBAL);
 
57
                        return ECMD_FAILED;
 
58
                }
 
59
        }
 
60
 
 
61
        log_print_unless_silent("Reading all physical volumes.  This may take a while...");
55
62
 
56
63
        maxret = process_each_vg(cmd, argc, argv, 0, NULL,
57
64
                                 &vgscan_single);
62
69
                        maxret = ret;
63
70
        }
64
71
 
65
 
        lvmetad_set_active(lvmetad); /* restore */
66
72
        unlock_vg(cmd, VG_GLOBAL);
67
73
        return maxret;
68
74
}