2
* Copyright (C) 2012 Red Hat, Inc.
4
* This file is part of LVM2.
6
* This copyrighted material is made available to anyone wishing to use,
7
* modify, copy, or redistribute it subject to the terms and conditions
8
* of the GNU Lesser General Public License v.2.1.
10
* You should have received a copy of the GNU Lesser General Public License
11
* along with this program; if not, write to the Free Software Foundation,
12
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20
struct dm_config_tree;
22
#ifdef LVMETAD_SUPPORT
24
* Initialise the communication with lvmetad. Normally called by
25
* lvmcache_init. Sets up a global handle for our process.
27
void lvmetad_init(void);
30
* Override the use of lvmetad for retrieving scan results and metadata.
32
void lvmetad_set_active(int);
35
* Check whether lvmetad is active (where active means both that it is running
36
* and that we have a working connection with it).
38
int lvmetad_active(void);
41
* Send a new version of VG metadata to lvmetad. This is normally called after
42
* vg_write but before vg_commit. After vg_commit, lvmetad_vg_commit is called
43
* to seal the transaction. The result of lvmetad_vg_update is that the new
44
* metadata is stored tentatively in lvmetad, but it is not used until
45
* lvmetad_vg_commit. The request is validated immediately and lvmetad_vg_commit
46
* only constitutes a pointer update.
48
int lvmetad_vg_update(struct volume_group *vg);
51
* Inform lvmetad that a VG has been removed. This is not entirely safe, but is
52
* only needed during vgremove, which does not wipe PV labels and therefore
53
* cannot mark the PVs as gone.
55
int lvmetad_vg_remove(struct volume_group *vg);
58
* Notify lvmetad that a PV has been found. It is not an error if the PV is
59
* already marked as present in lvmetad. If a non-NULL vg pointer is supplied,
60
* it is taken to represent the metadata read from the MDA(s) present on that
61
* PV. It *is* an error if: the VG is already known to lvmetad, the sequence
62
* number on the cached and on the discovered PV match but the metadata content
65
int lvmetad_pv_found(struct id pvid, struct device *device,
66
const struct format_type *fmt, uint64_t label_sector,
67
struct volume_group *vg);
70
* Inform the daemon that the device no longer exists.
72
int lvmetad_pv_gone(dev_t devno, const char *pv_name);
73
int lvmetad_pv_gone_by_dev(struct device *dev);
76
* Request a list of all PVs available to lvmetad. If requested, this will also
77
* read labels off all the PVs to populate lvmcache.
79
int lvmetad_pv_list_to_lvmcache(struct cmd_context *cmd);
82
* Lookup an individual PV.
83
* If found is not NULL, it is set according to whether or not the PV is found,
84
* otherwise if the PV is not found an error is returned.
86
int lvmetad_pv_lookup(struct cmd_context *cmd, struct id pvid, int *found);
87
int lvmetad_pv_lookup_by_dev(struct cmd_context *cmd, struct device *dev, int *found);
90
* Request a list of all VGs available to lvmetad and use it to fill in
93
int lvmetad_vg_list_to_lvmcache(struct cmd_context *cmd);
96
* Find a VG by its ID or its name in the lvmetad cache. Gives NULL if the VG is
99
struct volume_group *lvmetad_vg_lookup(struct cmd_context *cmd,
100
const char *vgname, const char *vgid);
103
* Scan a single device and update lvmetad with the result(s).
105
int pvscan_lvmetad_single(struct cmd_context *cmd, struct device *dev);
107
# else /* LVMETAD_SUPPORT */
109
# define lvmetad_init() do { } while (0)
110
# define lvmetad_set_active(a) do { } while (0)
111
# define lvmetad_active() (0)
112
# define lvmetad_vg_update(vg) (1)
113
# define lvmetad_vg_remove(vg) (1)
114
# define lvmetad_pv_found(pvid, device, fmt, label_sector, vg) (1)
115
# define lvmetad_pv_gone(devno, pv_name) (1)
116
# define lvmetad_pv_gone_by_dev(dev) (1)
117
# define lvmetad_pv_list_to_lvmcache(cmd) (1)
118
# define lvmetad_pv_lookup(cmd, pvid, found) (0)
119
# define lvmetad_pv_lookup_by_dev(cmd, dev, found) (0)
120
# define lvmetad_vg_list_to_lvmcache(cmd) (1)
121
# define lvmetad_vg_lookup(cmd, vgname, vgid) (NULL)
122
# define pvscan_lvmetad_single(cmd, dev) (0)
124
# endif /* LVMETAD_SUPPORT */