From 84252f67722e09ce7fa8d1bfd1792fde71fd2529 Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Wed, 8 Jun 2016 09:00:26 +0200 Subject: [PATCH] code cleanups --- PVE/Storage.pm | 16 +++++++--------- changelog.Debian | 2 ++ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/PVE/Storage.pm b/PVE/Storage.pm index 4313fae..2952b05 100755 --- a/PVE/Storage.pm +++ b/PVE/Storage.pm @@ -548,25 +548,23 @@ sub storage_migrate { if (($scfg->{type} eq $tcfg->{type}) && ($tcfg->{type} eq 'lvmthin' || $tcfg->{type} eq 'lvm')) { - my (undef, $volname) = parse_volname($cfg, $volid); + my (undef, $volname, $vmid) = parse_volname($cfg, $volid); my $size = volume_size_info($cfg, $volid, 5); - my $path = path($cfg, $volid); - - $volname =~ m/^vm-(\d+)-/; - my $vmid = $1; + my $src = path($cfg, $volid); + my $dst = path($cfg, $target_volid); run_command(['/usr/bin/ssh', "root\@${target_host}", 'pvesm', 'alloc', $target_storeid, $vmid, - $volname, $size/1024]); + $target_volname, int($size/1024)]); eval { - run_command([["dd", "if=$path"], + run_command([["dd", "if=$src"], ["/usr/bin/ssh", "root\@${target_host}", "-C", - "dd", 'conv=sparse', "of=$path"]]); + "dd", 'conv=sparse', "of=$dst"]]); }; if (my $err = $@) { run_command(['/usr/bin/ssh', "root\@${target_host}", - 'pvesm', 'free', $volid]); + 'pvesm', 'free', $target_volid]); } else { vdisk_free($cfg, $volid); } diff --git a/changelog.Debian b/changelog.Debian index ecbd11b..65dcc18 100644 --- a/changelog.Debian +++ b/changelog.Debian @@ -6,6 +6,8 @@ libpve-storage-perl (4.0-52) unstable; urgency=medium * fix 1012: dir: add mkdir option + * Add LVM/LVM-thin storage migration + -- Proxmox Support Team Tue, 07 Jun 2016 10:30:02 +0200 libpve-storage-perl (4.0-51) unstable; urgency=medium -- 2.39.5