libstorage-ng
LvmPv.h
1 /*
2  * Copyright (c) [2016-2019] 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_LVM_PV_H
24 #define STORAGE_LVM_PV_H
25 
26 
27 #include "storage/Devices/Device.h"
28 
29 
30 namespace storage
31 {
32  class BlkDevice;
33  class LvmVg;
34 
35 
36  class LvmPv : public Device
37  {
38  public:
39 
40  static LvmPv* create(Devicegraph* devicegraph);
41  static LvmPv* load(Devicegraph* devicegraph, const xmlNode* node);
42 
43  static std::vector<LvmPv*> get_all(Devicegraph* devicegraph);
44  static std::vector<const LvmPv*> get_all(const Devicegraph* devicegraph);
45 
46  bool has_blk_device() const;
47 
48  BlkDevice* get_blk_device();
49  const BlkDevice* get_blk_device() const;
50 
57  unsigned long long get_usable_size() const;
58 
59  bool has_lvm_vg() const;
60  LvmVg* get_lvm_vg();
61  const LvmVg* get_lvm_vg() const;
62 
63  public:
64 
65  class Impl;
66 
67  Impl& get_impl();
68  const Impl& get_impl() const;
69 
70  virtual LvmPv* clone() const override;
71 
72  protected:
73 
74  LvmPv(Impl* impl);
75 
76  };
77 
78 
84  bool is_lvm_pv(const Device* device);
85 
92  LvmPv* to_lvm_pv(Device* device);
93 
97  const LvmPv* to_lvm_pv(const Device* device);
98 
99 }
100 
101 #endif
A Volume Group of the Logical Volume Manager (LVM).
Definition: LvmVg.h:59
Definition: LvmPv.h:36
The master container of the libstorage.
Definition: Devicegraph.h:153
An abstract Block Device.
Definition: BlkDevice.h:46
An abstract base class of storage devices, and a vertex in the Devicegraph.
Definition: Device.h:75
LvmPv * to_lvm_pv(Device *device)
Converts pointer to Device to pointer to LvmPv.
bool is_lvm_pv(const Device *device)
Checks whether device points to a LvmPv.
The storage namespace.
Definition: Actiongraph.h:37
unsigned long long get_usable_size() const
Get the size of the PV usable for extents in bytes.