Fix some bugs when testing opensds ansible
[stor4nfv.git] / src / ceph / src / messages / MOSDMarkMeDown.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) 2013 Inktank Storage, Inc.
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 #ifndef CEPH_MOSDMARKMEDOWN_H
16 #define CEPH_MOSDMARKMEDOWN_H
17
18 #include "messages/PaxosServiceMessage.h"
19
20 class MOSDMarkMeDown : public PaxosServiceMessage {
21
22   static const int HEAD_VERSION = 2;
23   static const int COMPAT_VERSION = 2;
24
25  public:
26   uuid_d fsid;
27   entity_inst_t target_osd;
28   epoch_t epoch = 0;
29   bool request_ack = false;          // ack requested
30
31   MOSDMarkMeDown()
32     : PaxosServiceMessage(MSG_OSD_MARK_ME_DOWN, 0,
33                           HEAD_VERSION, COMPAT_VERSION) { }
34   MOSDMarkMeDown(const uuid_d &fs, const entity_inst_t& f,
35                  epoch_t e, bool request_ack)
36     : PaxosServiceMessage(MSG_OSD_MARK_ME_DOWN, e,
37                           HEAD_VERSION, COMPAT_VERSION),
38       fsid(fs), target_osd(f), epoch(e), request_ack(request_ack) {}
39  private:
40   ~MOSDMarkMeDown() override {}
41
42 public: 
43   entity_inst_t get_target() const { return target_osd; }
44   epoch_t get_epoch() const { return epoch; }
45
46   void decode_payload() override {
47     bufferlist::iterator p = payload.begin();
48     paxos_decode(p);
49     ::decode(fsid, p);
50     ::decode(target_osd, p);
51     ::decode(epoch, p);
52     ::decode(request_ack, p);
53   }
54
55   void encode_payload(uint64_t features) override {
56     paxos_encode();
57     ::encode(fsid, payload);
58     ::encode(target_osd, payload, features);
59     ::encode(epoch, payload);
60     ::encode(request_ack, payload);
61   }
62
63   const char *get_type_name() const override { return "MOSDMarkMeDown"; }
64   void print(ostream& out) const override {
65     out << "MOSDMarkMeDown("
66         << "request_ack=" << request_ack
67         << ", target_osd=" << target_osd
68         << ", fsid=" << fsid
69         << ")";
70   }
71 };
72
73 #endif