[pve-devel] [PATCH 4/4] add qemu_img_format
Alexandre Derumier
aderumier at odiso.com
Fri Oct 26 14:32:04 CEST 2012
return format for qemu-img from proxmox volume
Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
---
PVE/QemuServer.pm | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 5c2b26b..b211307 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -4060,4 +4060,22 @@ sub qemu_img_convert {
}
+sub qemu_img_format {
+ my ($scfg, $volname) = @_;
+
+ if ($scfg->{path} && $volname =~ m/\.(raw|qcow2|qed|vmdk)$/){
+ return $1;
+ }
+ elsif ($scfg->{type} eq 'nexenta' || $scfg->{type} eq 'iscsidirect'){
+ return "iscsi";
+ }
+ elsif ($scfg->{type} eq 'lvm' || $scfg->{type} eq 'iscsi'){
+ return "host_device";
+ }
+ #sheepdog,rbd,or other qemu block driver
+ else{
+ return $scfg->{type};
+ }
+}
+
1;
--
1.7.10.4
More information about the pve-devel
mailing list