libstorage-ng
DmRaid.h
1 /*
2  * Copyright (c) 2017 SUSE LLC
3  *
4  * All Rights Reserved.
5  *
6  * This program is free software; you can redistribute it and/or modify it
7  * under the terms of version 2 of the GNU General Public License as published
8  * by the Free Software Foundation.
9  *
10  * This program is distributed in the hope that it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13  * more details.
14  *
15  * You should have received a copy of the GNU General Public License along
16  * with this program; if not, contact Novell, Inc.
17  *
18  * To contact Novell about this file by physical or electronic mail, you may
19  * find current contact information at www.novell.com.
20  */
21 
22 
23 #ifndef STORAGE_DM_RAID_H
24 #define STORAGE_DM_RAID_H
25 
26 
27 #include "storage/Devices/Partitionable.h"
28 
29 
30 namespace storage
31 {
32 
33 
37  class DmRaid : public Partitionable
38  {
39  public:
40 
41  static DmRaid* create(Devicegraph* devicegraph, const std::string& name);
42  static DmRaid* create(Devicegraph* devicegraph, const std::string& name,
43  const Region& region);
44  static DmRaid* create(Devicegraph* devicegraph, const std::string& name,
45  unsigned long long size);
46 
47  static DmRaid* load(Devicegraph* devicegraph, const xmlNode* node);
48 
52  static std::vector<DmRaid*> get_all(Devicegraph* devicegraph);
53 
57  static std::vector<const DmRaid*> get_all(const Devicegraph* devicegraph);
58 
59  bool is_rotational() const;
60 
67  static DmRaid* find_by_name(Devicegraph* devicegraph, const std::string& name);
68 
72  static const DmRaid* find_by_name(const Devicegraph* devicegraph, const std::string& name);
73 
74  public:
75 
76  class Impl;
77 
78  Impl& get_impl();
79  const Impl& get_impl() const;
80 
81  virtual DmRaid* clone() const override;
82 
83  protected:
84 
85  DmRaid(Impl* impl);
86 
87  };
88 
89 
90  bool is_dm_raid(const Device* device);
91 
98  DmRaid* to_dm_raid(Device* device);
99 
103  const DmRaid* to_dm_raid(const Device* device);
104 
105 }
106 
107 #endif
static std::vector< DmRaid * > get_all(Devicegraph *devicegraph)
Get all DmRaids.
A start/length pair with a block size.
Definition: Region.h:73
The master container of the libstorage.
Definition: Devicegraph.h:153
An abstract base class of storage devices, and a vertex in the Devicegraph.
Definition: Device.h:75
Definition: Partitionable.h:40
static DmRaid * find_by_name(Devicegraph *devicegraph, const std::string &name)
Find a DmRaid by its name.
The storage namespace.
Definition: Actiongraph.h:37
A DM RAID device.
Definition: DmRaid.h:37
DmRaid * to_dm_raid(Device *device)
Converts pointer to Device to pointer to DmRaid.