Commit Graph

141 Commits

Author SHA1 Message Date
Mira Limbeck
9860fe4ef9 close #2263: die on live migration with local cloudinit disk
Live migration with a local cloudinit disk was never intended to work. It did
however work to an extent that the migration completed but the disk on the
source node could not be deleted. Now die if a live migration is started with
a local cloudinit disk.

With the GUI changes live migration is already disabled as it recognizes the
cloudinit disk as a local resource.

Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
2019-08-26 12:13:07 +02:00
Dominik Csapak
ccab68c22c fix remote viewer live migration
for some reason not setting port results in a port of '65535' which
triggers an execption in http-server anyevent, so we set the port to 0

also, we have to read the ticket from stdin even for 'unix' type secure
migration

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-08-20 11:49:24 +02:00
Tim Marx
ca6abacf6b migrate: log which local resource causes error
Signed-off-by: Tim Marx <t.marx@proxmox.com>
2019-05-07 10:22:12 +00:00
Tim Marx
370b05e719 whitespace cleanup
Signed-off-by: Tim Marx <t.marx@proxmox.com>
2019-05-07 10:22:12 +00:00
Stoiko Ivanov
d189e5901b bwlimit: add parameter for QemuMigrate::phase2
used for online local disks via qemu_drive_mirror

Add TODO comment for offline disks, as clone_disk calls `qemu-img
convert`, which does not have a bandwidth limit parameter.

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
2019-04-02 11:00:28 +02:00
Stoiko Ivanov
15a37695b6 bwlimit: add parameter to QemuMigrate::sync_disks
used for offline migration of local volumes

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
2019-04-02 10:58:35 +02:00
Stoiko Ivanov
ddd664d739 bwlimit: honor bwlimit for migrate qmp call
The 'migrate_speed' can be set in the VM config. Additionally the 'migrate'
bwlimit from datacenter.cfg (storage-specific limits play no role for
memory+state migration) or the parameter provided to the API call can restrict
the speed. Take the lower of the two.

This patch also refactors the setting of migrate_speed and comments for clarity.

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
2019-04-02 10:34:40 +02:00
Mira Limbeck
9e93a63fe4 fix #2100: ignore cloudinit drive on offline migration
disk is not copied to the target node but still deleted on cleanup
(phase3_cleanup).

Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
Tested-by: Dominik Csapak <d.csapak@proxmox.com>
2019-03-29 18:11:33 +01:00
Thomas Lamprecht
769f187df5 followup whitespace fixes
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-02-20 07:34:10 +01:00
Alexandre Derumier
f3a483b682 QemuMigrate : cleanup identation 2019-02-20 07:32:23 +01:00
Thomas Lamprecht
c7789f54ad migrate: fix local disk migration with online VMs
commit 4530494bf9 introduced an
regression with local disk migrations if the VM is online and thus
needs to live migrated and no target storage was passed as parameter.

We made the hack to write "1" to the targetstorage option in this
case obsolete, but it was still used on deciding if there are any
drives to mirror at all. Here it is enough to check if there are any
'online_local_volumes' because that hash gets only filled if we can
and are told to live mirror local disk on migrations anyway. Also,
we abort early if local disks are found and the 'with-local-disks'
option is not set.

This was reported at:
https://forum.proxmox.com/threads/livemigration-with-localdisk-doesnt-coppy-and-data-from-the-hdds-anymore.50744/

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-01-17 10:58:50 +01:00
Wolfgang Bumiller
8c58b12d0d cleanup: use a local $override_targetsid variable
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2018-12-20 10:11:32 +01:00
Thomas Lamprecht
4530494bf9 fix local disk migration when no target storage is set
the check for targetstorage in:
if ($self->{running} && $self->{opts}->{targetstorage} && $local_volumes->{$volid}->{ref} eq 'config') {

was obsolete, as we always set the tragetstorage opts variable to '1'
in a broader "use same sid for remote local" check above.
So removing it leads to the same if truthtable but fixes the
check if we should fallback to the volume's SID if targetstorage is
not set, as else it seemed to be always set, and '1' is naturally not
a correct stroage ID.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2018-12-20 10:11:32 +01:00
Alexandre Derumier
d0c671823d fix #1013 : migrate : sync_disk : --targetstorage with offline disk
targetsid was not used, for disk unused (offline copy)

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Acked-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2018-12-20 10:11:32 +01:00
Stoiko Ivanov
ca6621315e Fix #1242 : clone_disk : call qga fstrim after clone
Some storage like rbd or lvm can't keep thin-provising after a qemu-mirror.

Call qga guest-fstrim if qga is available and fstrim_cloned_disks is enabled
after move_disk and migrate.

Co-Authored-By: Alexandre Derumier <aderumier@odiso.com>
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
2018-08-02 11:35:50 +02:00
Alexandre Derumier
50d8dd5dc7 migrate cache-size : power of 2
qemu 2.11 need a power of 2 cache size.

"
Parameter 'xbzrle_cache_size' expects is invalid,
it should be bigger than target page size and a power of two
"

roundup to near power of 2 value
2018-02-22 16:27:48 +01:00
Herman van Rink
d108cb1eb2 migrate: task log: fix typo
Signed-off-by: Herman van Rink <rink@initfour.nl>
2018-02-22 14:50:00 +01:00
Chris Hofstaedtler
ec82e3eee4 fix #1569: add shared flag to disks
With shared=1, (live) migration ignores the disk and assumes it is
present on all target nodes. This works similar to shared=1 on LXC
mountpoints.

Signed-off-by: Chris Hofstaedtler <chris.hofstaedtler@deduktiva.com>
Reviewed-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Tested-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2018-02-15 15:19:29 +01:00
Alexandre Derumier
d296ed08d3 migration : enable mtunnel for insecure migration V2
We only use it to send commands faster like resume

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
2017-09-12 14:15:33 +02:00
Emmanuel Kasper
c2327320a8 Remove unused variable declaration 2017-09-07 11:22:32 +02:00
Emmanuel Kasper
46dd42f70c Fix #1441: Do not unplug controllers when the mirroring is finished
This should not be needed since we call 'block-job-complete' before
in qemu_drive_mirror_monitor(), and after benchmarking it does not
appear to be needed nor provide a measurable improvement when shutting
down the source.
2017-09-07 11:22:32 +02:00
Fabian Grünbichler
4305207d61 migrate: reduce polling intervals
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2017-08-07 09:23:56 +02:00
Fabian Grünbichler
4bdd20ab14 migrate: keep track of replication
and only transfer state and switch direction if there
actually are any replicated volumes.

once we add support for live-migration with replicated
volumes, adding a set-replication-state command to the
tunnel and using that probably makes sense.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2017-08-07 09:23:56 +02:00
Fabian Grünbichler
2e7fee87df migrate: finish tunnel in phase 3
after resuming the VM over the tunnel.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2017-08-07 09:23:56 +02:00
Fabian Grünbichler
1d5aaa1db5 qm mtunnel/migrate: add resume VMID command
and reformat the legacy SSH variant for readability.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2017-08-07 09:23:56 +02:00
Fabian Grünbichler
bcb51ae8f9 mtunnel: add and handle OK/ERR replies
because we want commands to return meaningful errors, and
print them on the client/source side.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2017-08-07 09:23:56 +02:00
Fabian Grünbichler
58cbe63901 migrate: read mtunnel version
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2017-08-07 09:23:56 +02:00
Fabian Grünbichler
e0eb1f7677 migrate: refactor mtunnel read/write
to make adding new commands and reading replies easier

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2017-08-07 09:23:56 +02:00
Fabian Grünbichler
d7b1b24b6f migrate: switch back to qm mtunnel
to allow adding guest specific commands to the tunnel

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2017-08-07 09:23:56 +02:00
Emmanuel Kasper
171ed95c76 Use default values when memory is not set in vm.conf when migrating
This fixes a "Use of uninitialized value in multiplication (*) "
warning when doing a migration
2017-07-03 14:37:00 +02:00
Thomas Lamprecht
da18cc9300 migrate: use 'mtunnel' from pvecm
qm mtunnel was deemed as deprecated but still in use here.
Switch over to pvecm's mtunnel to allow removing the qm variant in
PVE 5.1

Also use an absolute path so we do not depended on the targets
environment variables

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2017-06-23 11:00:52 +02:00
Wolfgang Bumiller
6f58fce9ee migrate: pass the with_snapshots parameter 2017-06-22 12:58:14 +02:00
Dietmar Maurer
54d10ab121 PVE::QemuMigrate. do not use JSON - not required here 2017-06-22 08:51:38 +02:00
Dietmar Maurer
d652f7b1ab PVE/QemuMigrate.pm: use new replication job helpers from AbstractMigrate 2017-06-21 12:27:45 +02:00
Dietmar Maurer
f6a17ff5e3 Change target in replication-state when replication direction is switched 2017-06-21 10:59:45 +02:00
Dietmar Maurer
dbc9420b0b PVE/QemuMigrate.pm: use replication job, transfer replication state 2017-06-20 12:42:51 +02:00
Dietmar Maurer
5009a8c755 PVE/QemuMigrate.pm: fix syntax errors 2017-06-13 11:56:26 +02:00
Dietmar Maurer
aee6abe5ba PVE/QemuMigrate.pm - use PVE::QemuServer::foreach_volid 2017-06-13 11:26:47 +02:00
Wolfgang Bumiller
ba5acf88a1 migrate: migration_type setting moved to pve-guest-common 2017-06-09 12:28:28 +02:00
Wolfgang Bumiller
f1c2a53aee migration: implement insecure offline migration 2017-06-01 10:50:28 +02:00
Wolfgang Bumiller
7126e1c9bb migrate: pass ssh_info to storage_migrate 2017-05-23 09:57:17 +02:00
Dietmar Maurer
46883f80f6 Revert "Integrate replica in the qemu migration."
This reverts commit 63d02c7074.

The commit changes the configuration before the VM is actually
migrated, so it is possible to have a wrong configuration when
migration fails for some reason. Also, I am quite unsure if
this automatic target change is really wanted. The patch also
contains wrong refereces to $self->{opts}->{node}.
2017-05-06 10:39:43 +02:00
Dietmar Maurer
b1c12185fb Revert "migrate: cleanup replica volume skip condition"
This reverts commit 6e8044dcea.
2017-05-06 10:38:06 +02:00
Wolfgang Bumiller
6e8044dcea migrate: cleanup replica volume skip condition 2017-04-28 10:34:46 +02:00
Wolfgang Link
63d02c7074 Integrate replica in the qemu migration.
Now it is possible to migrate a VM offline when replica is enabled.
It will reduce replication to an minimal amount.
2017-04-28 10:11:33 +02:00
Alexandre Derumier
d80ad67f9d live storage migration : fix check of target storage availability
if we define a different target storeid for remote node,
and that storage is not available on source node

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
2017-04-21 12:05:36 +02:00
Fabian Grünbichler
877e2ea746 migrate: clarify comment
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2017-04-21 11:43:29 +02:00
Fabian Grünbichler
28412ae488 migrate: cleanup nbd source disks earlier
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2017-04-21 11:43:29 +02:00
Fabian Grünbichler
504105c638 fix #1338: migrate: stop nbd before resuming
since Qemu 2.9, block device write access is limited to one
writer unless shared_rw is set to true. there is an
exception for live-migrating local disks via NBD as long as
the VM is suspended.

stop the NBD server before resuming the VM accordingly to
unbreak local disk live-migration.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2017-04-21 11:43:29 +02:00
Fabian Grünbichler
8b54f4b8db defined() style cleanup 2017-02-28 12:46:47 +01:00