[pve-devel] [PATCH 1/3] move qmp migrate_set_down && migrate_set_speed to qemumigrate
Stefan Priebe
s.priebe at profihost.ag
Thu Dec 27 09:25:11 CET 2012
Hi Alexandre,
qemu docs say that a value of 0 is unlimited to maybe we should change
this to:
+ # always set migrate speed (overwrite kvm default of 32m)
+ # we set a very hight default of 8192m which is basically unlimited
+ my $migrate_speed = $defaults->{migrate_speed} || 8192;
+ # always set migrate speed (overwrite kvm default of 32m)
+ # we set a very hight default of 0 which is unlimited
+ my $migrate_speed = $defaults->{migrate_speed} || 0;
Stefan
Am 27.12.2012 09:18, schrieb Alexandre Derumier:
> so we can set the values when the vm is running
> also use int() to get json working
>
> Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
> ---
> PVE/QemuMigrate.pm | 24 ++++++++++++++++++++++++
> PVE/QemuServer.pm | 15 ---------------
> 2 files changed, 24 insertions(+), 15 deletions(-)
>
> diff --git a/PVE/QemuMigrate.pm b/PVE/QemuMigrate.pm
> index 0711681..9ca8f87 100644
> --- a/PVE/QemuMigrate.pm
> +++ b/PVE/QemuMigrate.pm
> @@ -327,6 +327,30 @@ sub phase2 {
>
> my $start = time();
>
> + # load_defaults
> + my $defaults = PVE::QemuServer::load_defaults();
> +
> + # always set migrate speed (overwrite kvm default of 32m)
> + # we set a very hight default of 8192m which is basically unlimited
> + my $migrate_speed = $defaults->{migrate_speed} || 8192;
> + $migrate_speed = $conf->{migrate_speed} || $migrate_speed;
> + $migrate_speed = $migrate_speed * 1048576;
> + $self->log('info', "migrate_set_speed: $migrate_speed");
> + eval {
> + PVE::QemuServer::vm_mon_cmd_nocheck($vmid, "migrate_set_speed", value => int($migrate_speed));
> + };
> + $self->log('info', "migrate_set_speed error: $@") if $@;
> +
> + my $migrate_downtime = $defaults->{migrate_downtime};
> + $migrate_downtime = $conf->{migrate_downtime} if defined($conf->{migrate_downtime});
> + if (defined($migrate_downtime)) {
> + $self->log('info', "migrate_set_downtime: $migrate_downtime");
> + eval {
> + PVE::QemuServer::vm_mon_cmd_nocheck($vmid, "migrate_set_downtime", value => int($migrate_downtime));
> + };
> + $self->log('info', "migrate_set_downtime error: $@") if $@;
> + }
> +
> my $capabilities = {};
> $capabilities->{capability} = "xbzrle";
> $capabilities->{state} = JSON::false;
> diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
> index 165eaf6..92c7db7 100644
> --- a/PVE/QemuServer.pm
> +++ b/PVE/QemuServer.pm
> @@ -2976,21 +2976,6 @@ sub vm_start {
> warn $@ if $@;
> }
>
> - # always set migrate speed (overwrite kvm default of 32m)
> - # we set a very hight default of 8192m which is basically unlimited
> - my $migrate_speed = $defaults->{migrate_speed} || 8192;
> - $migrate_speed = $conf->{migrate_speed} || $migrate_speed;
> - $migrate_speed = $migrate_speed * 1048576;
> - eval {
> - vm_mon_cmd_nocheck($vmid, "migrate_set_speed", value => $migrate_speed);
> - };
> -
> - my $migrate_downtime = $defaults->{migrate_downtime};
> - $migrate_downtime = $conf->{migrate_downtime} if defined($conf->{migrate_downtime});
> - if (defined($migrate_downtime)) {
> - eval { vm_mon_cmd_nocheck($vmid, "migrate_set_downtime", value => $migrate_downtime); };
> - }
> -
> if($migratedfrom) {
> my $capabilities = {};
> $capabilities->{capability} = "xbzrle";
>
More information about the pve-devel
mailing list