libstorage-ng
LvmPv.h
1 /*
2  * Copyright (c) 2016 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  BlkDevice* get_blk_device();
48  const BlkDevice* get_blk_device() const;
49 
50  bool has_lvm_vg() const;
51  LvmVg* get_lvm_vg();
52  const LvmVg* get_lvm_vg() const;
53 
54  public:
55 
56  class Impl;
57 
58  Impl& get_impl();
59  const Impl& get_impl() const;
60 
61  virtual LvmPv* clone() const override;
62 
63  protected:
64 
65  LvmPv(Impl* impl);
66 
67  };
68 
69 
70  bool is_lvm_pv(const Device* device);
71 
78  LvmPv* to_lvm_pv(Device* device);
79 
83  const LvmPv* to_lvm_pv(const Device* device);
84 
85 }
86 
87 #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:41
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.
The storage namespace.
Definition: Actiongraph.h:37