]> git.proxmox.com Git - pve-storage.git/commit
storage_migrate: add volname_for_storage helper
authorFabian Ebner <f.ebner@proxmox.com>
Wed, 8 Apr 2020 09:25:14 +0000 (11:25 +0200)
committerFabian Grünbichler <f.gruenbichler@proxmox.com>
Thu, 9 Apr 2020 07:41:01 +0000 (09:41 +0200)
commit683a3f463fdf190fc3700b233ce1284b3c02fcf5
tree1d409514c5fc2d53b6853a6732807d2d08355145
parenta97d3ee49f21a61d3df10d196140c95dde45ec27
storage_migrate: add volname_for_storage helper

to guess a valid volname for a targetstorage of a different type.
This makes it possible to migrate raw volumes between 'dir' and 'lvm'
storages.

It is only used when the storage type for the source storage X
and target storage Y differ and should work as long as Y uses
the standard naming scheme (VMID/vm-VMID-name.fmt respectively vm-VMID-name).
If it doesn't, we get an invalid name and fail, which is the old
behavior (except if X and Y have different types but the same
non-standard naming-scheme, where the old behavior did work).

The original name is preserved, except for a possible extension
and it's also checked if the format is valid for the target storage.
Example: mylvm:vm-123-disk-4 <-> mydir:123/vm-123-disk-4.raw

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
PVE/Storage.pm