};
my $check_storage_access_copy = sub {
- my ($rpcenv, $authuser, $storecfg, $conf) = @_;
+ my ($rpcenv, $authuser, $storecfg, $conf, $storage) = @_;
PVE::QemuServer::foreach_drive($conf, sub {
my ($ds, $drive) = @_;
} else {
my ($sid, $volname) = PVE::Storage::parse_volume_id($volid, 1);
die "unable to copy arbitrary files\n" if !$sid;
+ $sid = $storage if $storage;
$rpcenv->check($authuser, "/storage/$sid", ['Datastore.AllocateSpace']);
}
});
type => 'string', format => 'pve-poolid',
description => "Add the new VM to the specified pool.",
},
+ storage => get_standard_option('pve-storage-id', {
+ description => "Target storage for full copy.",
+ optional => 1,
+ }),
full => {
optional => 1,
type => 'boolean',
$rpcenv->check_pool_exist($pool);
}
+ my $storage = extract_param($param, 'storage');
+
my $storecfg = PVE::Storage::config();
PVE::Cluster::check_cfs_quorum();
die "Copy running VM $vmid not implemented\n" if $running;
- &$check_storage_access_copy($rpcenv, $authuser, $storecfg, $conf);
+ &$check_storage_access_copy($rpcenv, $authuser, $storecfg, $conf, $storage);
# fixme: snapshots??
$newvolid = PVE::Storage::vdisk_clone($storecfg, $drive->{file}, $newid);
} 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;