[pve-devel] [PATCH 4/4] add qemu_img_format
Alexandre Derumier
aderumier at odiso.com
Mon Oct 29 17:23:48 CET 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 21cbee0..1c8d0e0 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -4066,4 +4066,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