libstorage-ng
Loading...
Searching...
No Matches
Multipath.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_MULTIPATH_H
24#define STORAGE_MULTIPATH_H
25
26
27#include "storage/Devices/Partitionable.h"
28
29
30namespace storage
31{
32
33
37 class Multipath : public Partitionable
38 {
39 public:
40
47 static Multipath* create(Devicegraph* devicegraph, const std::string& name);
48
52 static Multipath* create(Devicegraph* devicegraph, const std::string& name,
53 const Region& region);
54
58 static Multipath* create(Devicegraph* devicegraph, const std::string& name,
59 unsigned long long size);
60
61 static Multipath* load(Devicegraph* devicegraph, const xmlNode* node);
62
66 static std::vector<Multipath*> get_all(Devicegraph* devicegraph);
67
71 static std::vector<const Multipath*> get_all(const Devicegraph* devicegraph);
72
78 const std::string& get_vendor() const;
79
85 const std::string& get_model() const;
86
90 std::vector<BlkDevice*> get_blk_devices();
91
95 std::vector<const BlkDevice*> get_blk_devices() const;
96
102 bool is_rotational() const;
103
110 static Multipath* find_by_name(Devicegraph* devicegraph, const std::string& name);
111
115 static const Multipath* find_by_name(const Devicegraph* devicegraph, const std::string& name);
116
117 public:
118
119 class Impl;
120
121 Impl& get_impl();
122 const Impl& get_impl() const;
123
124 virtual Multipath* clone() const override;
125
126 Multipath(Impl* impl);
127
128 };
129
130
136 bool is_multipath(const Device* device);
137
145
149 const Multipath* to_multipath(const Device* device);
150
151}
152
153#endif
An abstract base class for storage devices.
Definition: Device.h:82
The main container of the libstorage-ng.
Definition: Devicegraph.h:170
A multipath device.
Definition: Multipath.h:38
bool is_rotational() const
Return whether the multipath device is of rotational or non-rotational type.
static const Multipath * find_by_name(const Devicegraph *devicegraph, const std::string &name)
Find a Multipath by its name.
static std::vector< Multipath * > get_all(Devicegraph *devicegraph)
Get all Multipaths.
const std::string & get_model() const
The model as reported by multipath tools.
static Multipath * create(Devicegraph *devicegraph, const std::string &name, const Region &region)
Create a device of type Multipath.
static Multipath * create(Devicegraph *devicegraph, const std::string &name)
Create a device of type Multipath.
const std::string & get_vendor() const
The vendor as reported by multipath tools.
static Multipath * find_by_name(Devicegraph *devicegraph, const std::string &name)
Find a Multipath by its name.
std::vector< const BlkDevice * > get_blk_devices() const
Return blk devices used for the Multipath.
static std::vector< const Multipath * > get_all(const Devicegraph *devicegraph)
Get all Multipaths.
static Multipath * create(Devicegraph *devicegraph, const std::string &name, unsigned long long size)
Create a device of type Multipath.
std::vector< BlkDevice * > get_blk_devices()
Return blk devices used for the Multipath.
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_multipath(const Device *device)
Checks whether device points to a Multipath.
Multipath * to_multipath(Device *device)
Converts pointer to Device to pointer to Multipath.