[pve-devel] [PATCH v2 qemu-server 10/28] Implement volume-related helpers
Fabian Ebner
f.ebner at proxmox.com
Mon Feb 24 13:44:00 CET 2020
Signed-off-by: Fabian Ebner <f.ebner at proxmox.com>
---
PVE/QemuConfig.pm | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/PVE/QemuConfig.pm b/PVE/QemuConfig.pm
index 1ba728a..b0dc3b9 100644
--- a/PVE/QemuConfig.pm
+++ b/PVE/QemuConfig.pm
@@ -8,6 +8,7 @@ use PVE::INotify;
use PVE::QemuServer::Helpers;
use PVE::QemuServer::Monitor qw(mon_cmd);
use PVE::QemuServer;
+use PVE::QemuServer::Drive;
use PVE::QemuServer::Machine;
use PVE::Storage;
use PVE::Tools;
@@ -78,6 +79,29 @@ sub has_feature {
return $err ? 0 : 1;
}
+# FIXME: adapt parse_drive to use $noerr for better error messages
+sub parse_volume {
+ my ($class, $key, $volume_string, $noerr) = @_;
+
+ my $drive = PVE::QemuServer::Drive::parse_drive($key, $volume_string);
+
+ die "unable to parse drive\n" if !$noerr && !defined($drive);
+
+ return $drive;
+}
+
+sub print_volume {
+ my ($class, $key, $volume) = @_;
+
+ return PVE::QemuServer::Drive::print_drive($volume);
+}
+
+sub volid_key {
+ my ($class) = @_;
+
+ return 'file';
+}
+
sub get_replicatable_volumes {
my ($class, $storecfg, $vmid, $conf, $cleanup, $noerr) = @_;
--
2.20.1
More information about the pve-devel
mailing list