24 #ifndef STORAGE_DEVICE_H 25 #define STORAGE_DEVICE_H 28 #include <libxml/tree.h> 33 #include <boost/noncopyable.hpp> 35 #include "storage/Utils/Exception.h" 75 class Device :
private boost::noncopyable
82 sid_t get_sid()
const;
84 bool operator==(
const Device& rhs)
const;
85 bool operator!=(
const Device& rhs)
const;
121 std::string get_displayname()
const;
132 bool has_children()
const;
133 size_t num_children()
const;
135 bool has_parents()
const;
136 size_t num_parents()
const;
138 static std::vector<Device*> get_all(
Devicegraph* devicegraph);
139 static std::vector<const Device*> get_all(
const Devicegraph* devicegraph);
145 std::vector<Device*> get_children();
146 std::vector<const Device*> get_children()
const;
148 std::vector<Device*> get_parents();
149 std::vector<const Device*> get_parents()
const;
151 std::vector<Device*> get_siblings(
bool itself);
152 std::vector<const Device*> get_siblings(
bool itself)
const;
154 std::vector<Device*> get_descendants(
bool itself);
155 std::vector<const Device*> get_descendants(
bool itself)
const;
157 std::vector<Device*> get_ancestors(
bool itself);
158 std::vector<const Device*> get_ancestors(
bool itself)
const;
160 std::vector<Device*> get_leaves(
bool itself);
161 std::vector<const Device*> get_leaves(
bool itself)
const;
163 std::vector<Device*> get_roots(
bool itself);
164 std::vector<const Device*> get_roots(
bool itself)
const;
166 std::vector<Holder*> get_in_holders();
167 std::vector<const Holder*> get_in_holders()
const;
169 std::vector<Holder*> get_out_holders();
170 std::vector<const Holder*> get_out_holders()
const;
172 void remove_descendants();
174 const std::map<std::string, std::string>& get_userdata()
const;
175 void set_userdata(
const std::map<std::string, std::string>& userdata);
177 friend std::ostream& operator<<(std::ostream& out,
const Device& device);
206 Impl& get_impl() {
return *impl; }
207 const Impl& get_impl()
const {
return *impl; }
209 virtual Device* clone()
const = 0;
211 void save(xmlNode* node)
const;
224 const std::unique_ptr<Impl> impl;
ResizeInfo detect_resize_info() const
Detect the resize info of the device.
bool exists_in_probed() const
Checks if the device exists in the probed devicegraph.
The master container of the libstorage.
Definition: Devicegraph.h:153
static bool compare_by_sid(const Device *lhs, const Device *rhs)
Compare (less than) two Devices by sid.
bool exists_in_staging() const
Checks if the device exists in the staging devicegraph.
Device * copy_to_devicegraph(Devicegraph *devicegraph) const
Copies the device to the devicegraph.
An abstract base class of storage devices, and a vertex in the Devicegraph.
Definition: Device.h:75
bool exists_in_system() const
Checks if the device exists in the system devicegraph.
Definition: FreeInfo.h:178
static bool compare_by_name(const Device *lhs, const Device *rhs)
Compare (less than) two Devices by name.
Base class for storage exceptions.
Definition: Exception.h:113
The storage namespace.
Definition: Actiongraph.h:37
unsigned int sid_t
An integer storage ID.
Definition: Device.h:66
bool exists_in_devicegraph(const Devicegraph *devicegraph) const
Checks if the device exists in the devicegraph.