mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
lvmetad: use defines for disabled reason strings
This commit is contained in:
parent
fa904a844f
commit
593900b795
@ -98,7 +98,7 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
reply = daemon_send_simple(h, "set_global_info",
|
reply = daemon_send_simple(h, "set_global_info",
|
||||||
"global_disable = " FMTd64, (int64_t) val,
|
"global_disable = " FMTd64, (int64_t) val,
|
||||||
"disable_reason = %s", "DIRECT",
|
"disable_reason = %s", LVMETAD_DISABLE_REASON_DIRECT,
|
||||||
"token = %s", "skip",
|
"token = %s", "skip",
|
||||||
NULL);
|
NULL);
|
||||||
print_reply(reply);
|
print_reply(reply);
|
||||||
|
@ -19,6 +19,10 @@
|
|||||||
|
|
||||||
#define LVMETAD_SOCKET DEFAULT_RUN_DIR "/lvmetad.socket"
|
#define LVMETAD_SOCKET DEFAULT_RUN_DIR "/lvmetad.socket"
|
||||||
|
|
||||||
|
#define LVMETAD_DISABLE_REASON_DIRECT "DIRECT"
|
||||||
|
#define LVMETAD_DISABLE_REASON_LVM1 "LVM1"
|
||||||
|
#define LVMETAD_DISABLE_REASON_DUPLICATES "DUPLICATES"
|
||||||
|
|
||||||
struct volume_group;
|
struct volume_group;
|
||||||
|
|
||||||
/* Different types of replies we may get from lvmetad. */
|
/* Different types of replies we may get from lvmetad. */
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
#include "daemon-server.h"
|
#include "daemon-server.h"
|
||||||
#include "daemon-log.h"
|
#include "daemon-log.h"
|
||||||
#include "lvm-version.h"
|
#include "lvm-version.h"
|
||||||
|
#include "lvmetad-client.h"
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
@ -2626,11 +2627,11 @@ static response set_global_info(lvmetad_state *s, request r)
|
|||||||
uint32_t reason_flags = 0;
|
uint32_t reason_flags = 0;
|
||||||
|
|
||||||
if ((reason = daemon_request_str(r, "disable_reason", NULL))) {
|
if ((reason = daemon_request_str(r, "disable_reason", NULL))) {
|
||||||
if (strstr(reason, "DIRECT"))
|
if (strstr(reason, LVMETAD_DISABLE_REASON_DIRECT))
|
||||||
reason_flags |= GLFL_DISABLE_REASON_DIRECT;
|
reason_flags |= GLFL_DISABLE_REASON_DIRECT;
|
||||||
if (strstr(reason, "LVM1"))
|
if (strstr(reason, LVMETAD_DISABLE_REASON_LVM1))
|
||||||
reason_flags |= GLFL_DISABLE_REASON_LVM1;
|
reason_flags |= GLFL_DISABLE_REASON_LVM1;
|
||||||
if (strstr(reason, "DUPLICATES"))
|
if (strstr(reason, LVMETAD_DISABLE_REASON_DUPLICATES))
|
||||||
reason_flags |= GLFL_DISABLE_REASON_DUPLICATES;
|
reason_flags |= GLFL_DISABLE_REASON_DUPLICATES;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2686,9 +2687,9 @@ static response get_global_info(lvmetad_state *s, request r)
|
|||||||
|
|
||||||
if (s->flags & GLFL_DISABLE) {
|
if (s->flags & GLFL_DISABLE) {
|
||||||
snprintf(reason, REASON_BUF_SIZE - 1, "%s%s%s",
|
snprintf(reason, REASON_BUF_SIZE - 1, "%s%s%s",
|
||||||
(s->flags & GLFL_DISABLE_REASON_DIRECT) ? "DIRECT," : "",
|
(s->flags & GLFL_DISABLE_REASON_DIRECT) ? LVMETAD_DISABLE_REASON_DIRECT "," : "",
|
||||||
(s->flags & GLFL_DISABLE_REASON_LVM1) ? "LVM1," : "",
|
(s->flags & GLFL_DISABLE_REASON_LVM1) ? LVMETAD_DISABLE_REASON_LVM1 "," : "",
|
||||||
(s->flags & GLFL_DISABLE_REASON_DUPLICATES) ? "DUPLICATES," : "");
|
(s->flags & GLFL_DISABLE_REASON_DUPLICATES) ? LVMETAD_DISABLE_REASON_DUPLICATES "," : "");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!reason[0])
|
if (!reason[0])
|
||||||
|
10
lib/cache/lvmetad.c
vendored
10
lib/cache/lvmetad.c
vendored
@ -1598,7 +1598,7 @@ static struct volume_group *lvmetad_pvscan_vg(struct cmd_context *cmd, struct vo
|
|||||||
baton.fid->fmt->name, dev_name(pvl->pv->dev));
|
baton.fid->fmt->name, dev_name(pvl->pv->dev));
|
||||||
lvmcache_fmt(info)->ops->destroy_instance(baton.fid);
|
lvmcache_fmt(info)->ops->destroy_instance(baton.fid);
|
||||||
log_warn("WARNING: Disabling lvmetad cache which does not support obsolete metadata.");
|
log_warn("WARNING: Disabling lvmetad cache which does not support obsolete metadata.");
|
||||||
lvmetad_set_disabled(cmd, "LVM1");
|
lvmetad_set_disabled(cmd, LVMETAD_DISABLE_REASON_LVM1);
|
||||||
_found_lvm1_metadata = 1;
|
_found_lvm1_metadata = 1;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -1722,7 +1722,7 @@ int lvmetad_pvscan_single(struct cmd_context *cmd, struct device *dev,
|
|||||||
lvmcache_fmt(info)->ops->destroy_instance(baton.fid);
|
lvmcache_fmt(info)->ops->destroy_instance(baton.fid);
|
||||||
|
|
||||||
log_warn("WARNING: Disabling lvmetad cache which does not support obsolete metadata.");
|
log_warn("WARNING: Disabling lvmetad cache which does not support obsolete metadata.");
|
||||||
lvmetad_set_disabled(cmd, "LVM1");
|
lvmetad_set_disabled(cmd, LVMETAD_DISABLE_REASON_LVM1);
|
||||||
_found_lvm1_metadata = 1;
|
_found_lvm1_metadata = 1;
|
||||||
|
|
||||||
if (ignore_obsolete)
|
if (ignore_obsolete)
|
||||||
@ -2352,13 +2352,13 @@ int lvmetad_is_disabled(struct cmd_context *cmd, const char **reason)
|
|||||||
if (!reply_reason) {
|
if (!reply_reason) {
|
||||||
*reason = "<not set>";
|
*reason = "<not set>";
|
||||||
|
|
||||||
} else if (strstr(reply_reason, "DIRECT")) {
|
} else if (strstr(reply_reason, LVMETAD_DISABLE_REASON_DIRECT)) {
|
||||||
*reason = "the disable flag was set directly";
|
*reason = "the disable flag was set directly";
|
||||||
|
|
||||||
} else if (strstr(reply_reason, "LVM1")) {
|
} else if (strstr(reply_reason, LVMETAD_DISABLE_REASON_LVM1)) {
|
||||||
*reason = "LVM1 metadata was found";
|
*reason = "LVM1 metadata was found";
|
||||||
|
|
||||||
} else if (strstr(reply_reason, "DUPLICATES")) {
|
} else if (strstr(reply_reason, LVMETAD_DISABLE_REASON_DUPLICATES)) {
|
||||||
*reason = "duplicate PVs were found";
|
*reason = "duplicate PVs were found";
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user