]> git.proxmox.com Git - qemu-server.git/commitdiff
vm_copy : add optional format parameter
authorAlexandre Derumier <aderumier@odiso.com>
Tue, 30 Apr 2013 08:34:08 +0000 (10:34 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Tue, 30 Apr 2013 08:46:44 +0000 (10:46 +0200)
can be qcow2,raw,vmdk

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
PVE/API2/Qemu.pm

index fde6eb9c03195c23ff6405e97017881b52cafdef..713ee549a59f806eaea6c0f7fc8b6f2f566ee7cb 100644 (file)
@@ -1823,6 +1823,13 @@ __PACKAGE__->register_method({
                requires => 'full',
                optional => 1,
            }),
+           format => {
+               description => "Target format for file storage.",
+               requires => 'full',
+               type => 'string',
+               optional => 1,
+               enum => [ 'raw', 'qcow2', 'vmdk'],
+           },
            full => {
                optional => 1,
                type => 'boolean',
@@ -1859,6 +1866,8 @@ __PACKAGE__->register_method({
 
        my $storage = extract_param($param, 'storage');
 
+       my $format = extract_param($param, 'format');
+
        my $storecfg = PVE::Storage::config();
 
        PVE::Cluster::check_cfs_quorum();
@@ -1962,8 +1971,14 @@ __PACKAGE__->register_method({
                            } else {
                                my ($storeid, $volname) = PVE::Storage::parse_volume_id($drive->{file});
                                $storeid = $storage if $storage;
-                               my $defformat = PVE::Storage::storage_default_format($storecfg, $storeid);
-                               my $fmt = $drive->{format} || $defformat;
+
+                               my $fmt = undef;
+                               if($format){
+                                   $fmt = $format;
+                               }else{
+                                   my $defformat = PVE::Storage::storage_default_format($storecfg, $storeid);
+                                   $fmt = $drive->{format} || $defformat;
+                               }
 
                                my ($size) = PVE::Storage::volume_size_info($storecfg, $drive->{file}, 3);