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 
46  static LvmPv* create(Devicegraph* devicegraph);
47 
48  static LvmPv* load(Devicegraph* devicegraph, const xmlNode* node);
49 
53  static std::vector<LvmPv*> get_all(Devicegraph* devicegraph);
54 
58  static std::vector<const LvmPv*> get_all(const Devicegraph* devicegraph);
59 
65  bool has_blk_device() const;
66 
73 
77  const BlkDevice* get_blk_device() const;
78 
85  unsigned long long get_usable_size() const;
86 
90  bool has_lvm_vg() const;
91 
97  LvmVg* get_lvm_vg();
98 
102  const LvmVg* get_lvm_vg() const;
103 
104  public:
105 
106  class Impl;
107 
108  Impl& get_impl();
109  const Impl& get_impl() const;
110 
111  virtual LvmPv* clone() const override;
112 
113  protected:
114 
115  LvmPv(Impl* impl);
116 
117  };
118 
119 
125  bool is_lvm_pv(const Device* device);
126 
133  LvmPv* to_lvm_pv(Device* device);
134 
138  const LvmPv* to_lvm_pv(const Device* device);
139 
140 }
141 
142 #endif
LvmVg * get_lvm_vg()
Return the volume group the physical volume is used in.
static std::vector< LvmPv * > get_all(Devicegraph *devicegraph)
Get all LvmPvs.
A Volume Group of the Logical Volume Manager (LVM).
Definition: LvmVg.h:59
bool has_blk_device() const
Check whether the physical volume has a block device.
Definition: LvmPv.h:36
static LvmPv * create(Devicegraph *devicegraph)
Create a device of type LvmPv.
The main container of the libstorage-ng.
Definition: Devicegraph.h:169
An abstract Block Device.
Definition: BlkDevice.h:46
An abstract base class for storage devices.
Definition: Device.h:81
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:38
bool has_lvm_vg() const
Check whether the physical volume is part of a volume group.
unsigned long long get_usable_size() const
Get the size of the PV usable for extents in bytes.
BlkDevice * get_blk_device()
Return the block device this physical volume is using.