add disk rename feature
Functionality has been added for the following storage types:
* directory ones, based on the default implementation:
* directory
* NFS
* CIFS
* gluster
* ZFS
* (thin) LVM
* Ceph
A new feature `rename` has been introduced to mark which storage
plugin supports the feature.
Version API and AGE have been bumped.
Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
the intention of this feature is to support the following use-cases:
- reassign a volume from one owning guest to another (which usually
entails a rename, since the owning vmid is encoded in the volume name)
- rename a volume (e.g., to use a more meaningful name instead of the
auto-assigned ...-disk-123)
only the former is implemented at the caller side in
qemu-server/pve-container for now, but since the lower-level feature is
basically the same for both, we can take advantage of the storage plugin
API bump now to get the building block for this future feature in place
already.
adapt ApiChangelog change to fix conflicts and added more detail above
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
This commit is contained in:
committed by
Fabian Grünbichler
parent
93fbc01963
commit
95dfa44ca1
@ -349,6 +349,7 @@ sub volume_snapshot_needs_fsfreeze {
|
||||
# snapshot - taking a snapshot is possible
|
||||
# sparseinit - volume is sparsely initialized
|
||||
# template - conversion to base image is possible
|
||||
# rename - renaming volumes is possible
|
||||
# $snap - check if the feature is supported for a given snapshot
|
||||
# $running - if the guest owning the volume is running
|
||||
# $opts - hash with further options:
|
||||
@ -1860,6 +1861,26 @@ sub complete_volume {
|
||||
return $res;
|
||||
}
|
||||
|
||||
sub rename_volume {
|
||||
my ($cfg, $source_volid, $target_vmid, $target_volname) = @_;
|
||||
|
||||
die "no source volid provided\n" if !$source_volid;
|
||||
die "no target VMID or target volname provided\n" if !$target_vmid && !$target_volname;
|
||||
|
||||
my ($storeid, $source_volname) = parse_volume_id($source_volid);
|
||||
|
||||
activate_storage($cfg, $storeid);
|
||||
|
||||
my $scfg = storage_config($cfg, $storeid);
|
||||
my $plugin = PVE::Storage::Plugin->lookup($scfg->{type});
|
||||
|
||||
$target_vmid = ($plugin->parse_volname($source_volname))[3] if !$target_vmid;
|
||||
|
||||
return $plugin->cluster_lock_storage($storeid, $scfg->{shared}, undef, sub {
|
||||
return $plugin->rename_volume($scfg, $storeid, $source_volname, $target_vmid, $target_volname);
|
||||
});
|
||||
}
|
||||
|
||||
# Various io-heavy operations require io/bandwidth limits which can be
|
||||
# configured on multiple levels: The global defaults in datacenter.cfg, and
|
||||
# per-storage overrides. When we want to do a restore from storage A to storage
|
||||
|
||||
Reference in New Issue
Block a user