libstorage-ng
LvmLv.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_LV_H
24 #define STORAGE_LVM_LV_H
25 
26 
27 #include "storage/Devices/BlkDevice.h"
28 
29 
30 namespace storage
31 {
32  class LvmVg;
33 
34 
38  class LvmLv : public BlkDevice
39  {
40  public:
41 
42  static LvmLv* create(Devicegraph* devicegraph, const std::string& vg_name, const std::string& lv_name);
43  static LvmLv* load(Devicegraph* devicegraph, const xmlNode* node);
44 
45  static std::vector<LvmLv*> get_all(Devicegraph* devicegraph);
46  static std::vector<const LvmLv*> get_all(const Devicegraph* devicegraph);
47 
51  const std::string& get_lv_name() const;
52  void set_lv_name(const std::string& lv_name);
53 
54  unsigned int get_stripes() const;
55  void set_stripes(unsigned int stripes);
56 
57  unsigned long get_stripe_size() const;
58  void set_stripe_size(unsigned long stripe_size);
59 
63  const LvmVg* get_lvm_vg() const;
64 
65  public:
66 
67  class Impl;
68 
69  Impl& get_impl();
70  const Impl& get_impl() const;
71 
72  virtual LvmLv* clone() const override;
73 
74  protected:
75 
76  LvmLv(Impl* impl);
77 
78  };
79 
80 
81  bool is_lvm_lv(const Device* device);
82 
83  LvmLv* to_lvm_lv(Device* device);
84  const LvmLv* to_lvm_lv(const Device* device);
85 
86 }
87 
88 #endif
A Logical Volume of the Logical Volume Manager (LVM).
Definition: LvmLv.h:38
const LvmVg * get_lvm_vg() const
Return volume group this logical volume belongs to.
const std::string & get_lv_name() const
Get logical volume name.
A Volume Group of the Logical Volume Manager (LVM).
Definition: LvmVg.h:53
The master container of the libstorage.
Definition: Devicegraph.h:133
An abstract Block Device.
Definition: BlkDevice.h:40
An abstract base class of storage devices, and a vertex in the Devicegraph.
Definition: Device.h:73
The storage namespace.
Definition: Actiongraph.h:36