Fix some bugs when testing opensds ansible
[stor4nfv.git] / src / ceph / src / messages / MCommand.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) 2004-2006 Sage Weil <sage@newdream.net>
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_MCOMMAND_H
16 #define CEPH_MCOMMAND_H
17
18 #include <vector>
19
20 #include "msg/Message.h"
21
22 class MCommand : public Message {
23  public:
24   uuid_d fsid;
25   std::vector<string> cmd;
26
27   MCommand()
28     : Message(MSG_COMMAND) {}
29   MCommand(const uuid_d &f)
30     : Message(MSG_COMMAND),
31       fsid(f) { }
32
33 private:
34   ~MCommand() override {}
35
36 public:  
37   const char *get_type_name() const override { return "command"; }
38   void print(ostream& o) const override {
39     o << "command(tid " << get_tid() << ": ";
40     for (unsigned i=0; i<cmd.size(); i++) {
41       if (i) o << ' ';
42       o << cmd[i];
43     }
44     o << ")";
45   }
46   
47   void encode_payload(uint64_t features) override {
48     ::encode(fsid, payload);
49     ::encode(cmd, payload);
50   }
51   void decode_payload() override {
52     bufferlist::iterator p = payload.begin();
53     ::decode(fsid, p);
54     ::decode(cmd, p);
55   }
56 };
57
58 #endif