libstorage-ng
DmRaid.h
1 /*
2  * Copyright (c) [2017-2021] 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 
47  static DmRaid* create(Devicegraph* devicegraph, const std::string& name);
48 
52  static DmRaid* create(Devicegraph* devicegraph, const std::string& name,
53  const Region& region);
54 
58  static DmRaid* create(Devicegraph* devicegraph, const std::string& name,
59  unsigned long long size);
60 
61  static DmRaid* load(Devicegraph* devicegraph, const xmlNode* node);
62 
66  static std::vector<DmRaid*> get_all(Devicegraph* devicegraph);
67 
71  static std::vector<const DmRaid*> get_all(const Devicegraph* devicegraph);
72 
76  std::vector<BlkDevice*> get_blk_devices();
77 
81  std::vector<const BlkDevice*> get_blk_devices() const;
82 
88  bool is_rotational() const;
89 
96  static DmRaid* find_by_name(Devicegraph* devicegraph, const std::string& name);
97 
101  static const DmRaid* find_by_name(const Devicegraph* devicegraph, const std::string& name);
102 
103  public:
104 
105  class Impl;
106 
107  Impl& get_impl();
108  const Impl& get_impl() const;
109 
110  virtual DmRaid* clone() const override;
111 
112  DmRaid(Impl* impl);
113 
114  };
115 
116 
122  bool is_dm_raid(const Device* device);
123 
130  DmRaid* to_dm_raid(Device* device);
131 
135  const DmRaid* to_dm_raid(const Device* device);
136 
137 }
138 
139 #endif
static std::vector< DmRaid * > get_all(Devicegraph *devicegraph)
Get all DmRaids.
bool is_dm_raid(const Device *device)
Checks whether device points to a DmRaid.
A start/length pair with a block size.
Definition: Region.h:84
The main container of the libstorage-ng.
Definition: Devicegraph.h:169
bool is_rotational() const
Return whether the DM RAID is of rotational or non-rotational type.
An abstract base class for storage devices.
Definition: Device.h:81
Definition: Partitionable.h:39
static DmRaid * find_by_name(Devicegraph *devicegraph, const std::string &name)
Find a DmRaid by its name.
The storage namespace.
Definition: Actiongraph.h:39
std::vector< BlkDevice * > get_blk_devices()
Return blk devices used for the DmRaid.
static DmRaid * create(Devicegraph *devicegraph, const std::string &name)
Create a device of type DmRaid.
A DM RAID device.
Definition: DmRaid.h:37
DmRaid * to_dm_raid(Device *device)
Converts pointer to Device to pointer to DmRaid.