]> git.proxmox.com Git - ceph.git/blob - ceph/src/messages/MOSDForceRecovery.h
update sources to v12.1.2
[ceph.git] / ceph / src / messages / MOSDForceRecovery.h
1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
3 /*
4 * Ceph - scalable distributed file system
5 *
6 * Copyright (C) 2017 OVH
7 *
8 * This is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License version 2.1, as published by the Free Software
11 * Foundation. See file COPYING.
12 *
13 */
14
15
16 #ifndef CEPH_MOSDFORCERECOVERY_H
17 #define CEPH_MOSDFORCERECOVERY_H
18
19 #include "msg/Message.h"
20
21 /*
22 * instruct an OSD to boost/unboost recovery/backfill priority of some or all pg(s)
23 */
24
25 // boost priority of recovery
26 static const int OFR_RECOVERY = 1;
27
28 // boost priority of backfill
29 static const int OFR_BACKFILL = 2;
30
31 // cancel priority boost, requeue if necessary
32 static const int OFR_CANCEL = 4;
33
34 struct MOSDForceRecovery : public Message {
35
36 static const int HEAD_VERSION = 1;
37 static const int COMPAT_VERSION = 1;
38
39 uuid_d fsid;
40 vector<pg_t> forced_pgs;
41 uint8_t options;
42
43 MOSDForceRecovery() : Message(MSG_OSD_FORCE_RECOVERY, HEAD_VERSION, COMPAT_VERSION) {}
44 MOSDForceRecovery(const uuid_d& f, char opts) :
45 Message(MSG_OSD_FORCE_RECOVERY, HEAD_VERSION, COMPAT_VERSION),
46 fsid(f), options(opts) {}
47 MOSDForceRecovery(const uuid_d& f, vector<pg_t>& pgs, char opts) :
48 Message(MSG_OSD_FORCE_RECOVERY, HEAD_VERSION, COMPAT_VERSION),
49 fsid(f), forced_pgs(pgs), options(opts) {}
50 private:
51 ~MOSDForceRecovery() {}
52
53 public:
54 const char *get_type_name() const { return "force_recovery"; }
55 void print(ostream& out) const {
56 out << "force_recovery(";
57 if (forced_pgs.empty())
58 out << "osd";
59 else
60 out << forced_pgs;
61 if (options & OFR_RECOVERY)
62 out << " recovery";
63 if (options & OFR_BACKFILL)
64 out << " backfill";
65 if (options & OFR_CANCEL)
66 out << " cancel";
67 out << ")";
68 }
69
70 void encode_payload(uint64_t features) {
71 ::encode(fsid, payload);
72 ::encode(forced_pgs, payload);
73 ::encode(options, payload);
74 }
75 void decode_payload() {
76 bufferlist::iterator p = payload.begin();
77 ::decode(fsid, p);
78 ::decode(forced_pgs, p);
79 ::decode(options, p);
80 }
81 };
82
83 #endif /* CEPH_MOSDFORCERECOVERY_H_ */