libstorage-ng
Multipath.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_MULTIPATH_H
24 #define STORAGE_MULTIPATH_H
25 
26 
27 #include "storage/Devices/Partitionable.h"
28 
29 
30 namespace storage
31 {
32 
33 
35  class Multipath : public Partitionable
36  {
37  public:
38 
39  static Multipath* create(Devicegraph* devicegraph, const std::string& name);
40  static Multipath* create(Devicegraph* devicegraph, const std::string& name,
41  const Region& region);
42  static Multipath* create(Devicegraph* devicegraph, const std::string& name,
43  unsigned long long size);
44 
45  static Multipath* load(Devicegraph* devicegraph, const xmlNode* node);
46 
50  static std::vector<Multipath*> get_all(Devicegraph* devicegraph);
51 
55  static std::vector<const Multipath*> get_all(const Devicegraph* devicegraph);
56 
57  const std::string& get_vendor() const;
58 
59  const std::string& get_model() const;
60 
61  bool is_rotational() const;
62 
69  static Multipath* find_by_name(Devicegraph* devicegraph, const std::string& name);
70 
74  static const Multipath* find_by_name(const Devicegraph* devicegraph, const std::string& name);
75 
76  public:
77 
78  class Impl;
79 
80  Impl& get_impl();
81  const Impl& get_impl() const;
82 
83  virtual Multipath* clone() const override;
84 
85  protected:
86 
87  Multipath(Impl* impl);
88 
89  };
90 
91 
92  bool is_multipath(const Device* device);
93 
100  Multipath* to_multipath(Device* device);
101 
105  const Multipath* to_multipath(const Device* device);
106 
107 }
108 
109 #endif
Multipath * to_multipath(Device *device)
Converts pointer to Device to pointer to Multipath.
A start/length pair with a block size.
Definition: Region.h:73
static Multipath * find_by_name(Devicegraph *devicegraph, const std::string &name)
Find a Multipath by its name.
The master container of the libstorage.
Definition: Devicegraph.h:153
A multipath device.
Definition: Multipath.h:35
An abstract base class of storage devices, and a vertex in the Devicegraph.
Definition: Device.h:75
Definition: Partitionable.h:40
static std::vector< Multipath * > get_all(Devicegraph *devicegraph)
Get all Multipaths.
The storage namespace.
Definition: Actiongraph.h:37