[pve-devel] [PATCH_V2 pve-storage] Add LVM-thin storage migration
Alexandre DERUMIER
aderumier at odiso.com
Tue Jun 7 17:39:02 CEST 2016
Hi,
I think it could be great in the future to add support for online migration (live migration + storage migration).
I have send the workflow last year, but never have time to implement it.
----- Mail original -----
De: "Wolfgang Link" <w.link at proxmox.com>
À: "pve-devel" <pve-devel at pve.proxmox.com>
Envoyé: Mardi 7 Juin 2016 15:33:10
Objet: [pve-devel] [PATCH_V2 pve-storage] Add LVM-thin storage migration
It is now possibel to migrate LVM-thin volumes offline from one node to an other.
Also LVM what is used by Qemu.
---
PVE/Storage.pm | 33 +++++++++++++++++++++++++++++++++
1 file changed, 33 insertions(+)
diff --git a/PVE/Storage.pm b/PVE/Storage.pm
index 1192ce3..907e3b3 100755
--- a/PVE/Storage.pm
+++ b/PVE/Storage.pm
@@ -542,6 +542,39 @@ sub storage_migrate {
} else {
die "$errstr - target type $tcfg->{type} is not valid\n";
}
+
+ } elsif ($scfg->{type} eq 'lvmthin' || $scfg->{type} eq 'lvm') {
+
+ if ($tcfg->{type} eq 'lvmthin' || $tcfg->{type} eq 'lvm') {
+
+ die "$errstr - pool on target has not same name as source!"
+ if $tcfg->{type} ne $scfg->{type};
+
+ my (undef, $volname) = parse_volname($cfg, $volid);
+ my $size = volume_size_info($cfg, $volid, 5);
+ my $path = path($cfg, $volid);
+
+ $volname =~ m/^vm-(\d+)-/;
+ my $vmid = $1;
+
+ run_command(['/usr/bin/ssh', "root\@${target_host}",
+ 'pvesm', 'alloc', $target_storeid, $vmid,
+ $volname, $size/1024]);
+
+ eval {
+ run_command([["dd", "if=$path"],
+ ["/usr/bin/ssh", "root\@${target_host}", "-C",
+ "dd", 'conv=sparse', "of=$path"]]);
+ };
+ if (my $err = $@) {
+ run_command(['/usr/bin/ssh', "root\@${target_host}",
+ 'pvesm', 'free', $volid]);
+ } else {
+ vdisk_free($cfg, $volid);
+ }
+ } else {
+ die "$errstr - target type $tcfg->{type} is not valid\n";
+ }
} else {
die "$errstr - source type '$scfg->{type}' not implemented\n";
}
--
2.1.4
_______________________________________________
pve-devel mailing list
pve-devel at pve.proxmox.com
http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
More information about the pve-devel
mailing list