libstorage-ng
Loading...
Searching...
No Matches
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
30namespace 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 protected:
113
114 DmRaid(Impl* impl);
115
116 };
117
118
124 bool is_dm_raid(const Device* device);
125
133
137 const DmRaid* to_dm_raid(const Device* device);
138
139}
140
141#endif
An abstract base class for storage devices.
Definition: Device.h:82
The main container of the libstorage-ng.
Definition: Devicegraph.h:170
A DM RAID device.
Definition: DmRaid.h:38
static DmRaid * find_by_name(Devicegraph *devicegraph, const std::string &name)
Find a DmRaid by its name.
std::vector< BlkDevice * > get_blk_devices()
Return blk devices used for the DmRaid.
static std::vector< DmRaid * > get_all(Devicegraph *devicegraph)
Get all DmRaids.
static const DmRaid * find_by_name(const Devicegraph *devicegraph, const std::string &name)
Find a DmRaid by its name.
static std::vector< const DmRaid * > get_all(const Devicegraph *devicegraph)
Get all DmRaids.
static DmRaid * create(Devicegraph *devicegraph, const std::string &name)
Create a device of type DmRaid.
static DmRaid * create(Devicegraph *devicegraph, const std::string &name, const Region &region)
Create a device of type DmRaid.
static DmRaid * create(Devicegraph *devicegraph, const std::string &name, unsigned long long size)
Create a device of type DmRaid.
std::vector< const BlkDevice * > get_blk_devices() const
Return blk devices used for the DmRaid.
bool is_rotational() const
Return whether the DM RAID is of rotational or non-rotational type.
Definition: Partitionable.h:40
A start/length pair with a block size.
Definition: Region.h:85
The storage namespace.
Definition: Actiongraph.h:40
bool is_dm_raid(const Device *device)
Checks whether device points to a DmRaid.
DmRaid * to_dm_raid(Device *device)
Converts pointer to Device to pointer to DmRaid.