[pve-devel] [PATCH v2 container 12/28] Implement volume-related helpers

Fabian Ebner f.ebner at proxmox.com
Mon Feb 24 13:44:02 CET 2020


Signed-off-by: Fabian Ebner <f.ebner at proxmox.com>
---
 src/PVE/LXC/Config.pm | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/src/PVE/LXC/Config.pm b/src/PVE/LXC/Config.pm
index e88ba0b..abaae54 100644
--- a/src/PVE/LXC/Config.pm
+++ b/src/PVE/LXC/Config.pm
@@ -1076,6 +1076,30 @@ sub print_ct_mountpoint {
     return PVE::JSONSchema::print_property_string($info, $mp_desc, $skip);
 }
 
+sub parse_volume {
+    my ($class, $key, $volume_string, $noerr) = @_;
+
+    if ($key eq 'rootfs') {
+	return $class->parse_ct_rootfs($volume_string, $noerr);
+    } elsif ($key =~ m/^mp\d+$/ || $key =~ m/^unused\d+$/) {
+	return $class->parse_ct_mountpoint($volume_string, $noerr);
+    }
+
+    die "parse_volume - unknown type: $key\n";
+}
+
+sub print_volume {
+    my ($class, $key, $volume) = @_;
+
+    return $class->print_ct_mountpoint($volume, $key eq 'rootfs');
+}
+
+sub volid_key {
+    my ($class) = @_;
+
+    return 'volume';
+}
+
 sub print_lxc_network {
     my ($class, $net) = @_;
     return PVE::JSONSchema::print_property_string($net, $netconf_desc);
-- 
2.20.1





More information about the pve-devel mailing list