]>
git.proxmox.com Git - ceph.git/blob - ceph/src/mon/FSCommands.h
1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
4 * Ceph - scalable distributed file system
6 * Copyright (C) 2017 Red Hat Ltd
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.
16 #ifndef FS_COMMANDS_H_
17 #define FS_COMMANDS_H_
20 #include "CommandHandler.h"
22 #include "osd/OSDMap.h"
23 #include "mds/FSMap.h"
28 class FileSystemCommandHandler
: protected CommandHandler
39 * Return 0 if the pool is suitable for use with CephFS, or
40 * in case of errors return a negative error code, and populate
41 * the passed ostream with an explanation.
43 * @param metadata whether the pool will be for metadata (stricter checks)
47 const int64_t pool_id
,
51 bool allow_overlay
= false) const;
53 virtual std::string
const &get_prefix() const {return prefix
;}
56 FileSystemCommandHandler(const std::string
&prefix_
)
60 virtual ~FileSystemCommandHandler()
63 int is_op_allowed(const MonOpRequestRef
& op
, const FSMap
& fsmap
,
64 const cmdmap_t
& cmdmap
, std::ostream
&ss
) const;
66 int can_handle(std::string
const &prefix_
, MonOpRequestRef
& op
, FSMap
& fsmap
,
67 const cmdmap_t
& cmdmap
, std::ostream
&ss
) const
69 if (get_prefix() != prefix_
) {
73 if (get_prefix() == "fs new" || get_prefix() == "fs flag set") {
77 return is_op_allowed(op
, fsmap
, cmdmap
, ss
);
80 static std::list
<std::shared_ptr
<FileSystemCommandHandler
> > load(Paxos
*paxos
);
82 virtual bool batched_propose() {
90 const cmdmap_t
& cmdmap
,
91 std::ostream
&ss
) = 0;