[pve-devel] [PATCH v2 guest-common 05/28] Add interface for volume-related helpers

Fabian Ebner f.ebner at proxmox.com
Mon Feb 24 13:43:55 CET 2020


Signed-off-by: Fabian Ebner <f.ebner at proxmox.com>
---

Not related to this series, but: this should also make
it easier to preserve meta-information (e.g. size, discard)
to unused disks without re-implementing add_unused_volume
in the modules.

 PVE/AbstractConfig.pm | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/PVE/AbstractConfig.pm b/PVE/AbstractConfig.pm
index 782714f..bd43cbe 100644
--- a/PVE/AbstractConfig.pm
+++ b/PVE/AbstractConfig.pm
@@ -322,6 +322,29 @@ sub check_protection {
     }
 }
 
+# Returns a hash with the information from $volume_string
+# $key is used to determine the format of the string
+sub parse_volume {
+    my ($class, $key, $volume_string, $noerr) = @_;
+
+    die "implement me - abstract method\n";
+}
+
+# Returns a string with the information from $volume
+# $key is used to determine the format of the string
+sub print_volume {
+    my ($class, $key, $volume) = @_;
+
+    die "implement me - abstract method\n";
+}
+
+# The key under which the volume ID is located in volume hashes
+sub volid_key {
+    my ($class) = @_;
+
+    die "implement me - abstract method\n";
+}
+
 # Adds an unused volume to $config, if possible.
 sub add_unused_volume {
     my ($class, $config, $volid) = @_;
-- 
2.20.1




More information about the pve-devel mailing list