[pve-devel] [PATCH 3/7] clone live vm : add support for multiple jobs
Alexandre DERUMIER
aderumier at odiso.com
Fri Dec 30 10:58:10 CET 2016
>>I wonder if we can make clone_vm more consistent when the VM
>>is running? A correct workflow would be
>>- suspend VM
>>- start all mirror jobs
>>- resume VM
>>
>>Is it worth to implement that?
Maybe it could work with simply pause before block-job-complete, then resume after block-job-complete ?
Maybe without pause, calling qga freezefs, before doing the block-job-complete could help too ?
----- Mail original -----
De: "dietmar" <dietmar at proxmox.com>
À: "Alexandre Derumier" <aderumier at odiso.com>, "pve-devel" <pve-devel at pve.proxmox.com>
Envoyé: Vendredi 30 Décembre 2016 10:28:42
Objet: Re: [pve-devel] [PATCH 3/7] clone live vm : add support for multiple jobs
I wonder if we can make clone_vm more consistent when the VM
is running? A correct workflow would be
- suspend VM
- start all mirror jobs
- resume VM
Is it worth to implement that?
> On December 28, 2016 at 9:24 AM Alexandre Derumier <aderumier at odiso.com>
> wrote:
>
>
> Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
> ---
> PVE/API2/Qemu.pm | 12 +++++++++++-
> 1 file changed, 11 insertions(+), 1 deletion(-)
>
> diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm
> index d0070a6..d21f3df 100644
> --- a/PVE/API2/Qemu.pm
> +++ b/PVE/API2/Qemu.pm
> @@ -2443,21 +2443,29 @@ __PACKAGE__->register_method({
> my $upid = shift;
>
> my $newvollist = [];
> + my $jobs = {};
>
> eval {
> local $SIG{INT} = $SIG{TERM} = $SIG{QUIT} = $SIG{HUP} = sub { die
> "interrupted by signal\n"; };
>
> PVE::Storage::activate_volumes($storecfg, $vollist, $snapname);
>
> + my $total_jobs = scalar(keys %{$drives});
> + my $i = 1;
> + my $skipcomplete = 1;
> +
> foreach my $opt (keys %$drives) {
> +
> my $drive = $drives->{$opt};
> + $skipcomplete = undef if $total_jobs == $i; #finish after last drive
>
> my $newdrive = PVE::QemuServer::clone_disk($storecfg, $vmid, $running,
> $opt, $drive, $snapname,
> - $newid, $storage, $format, $fullclone->{$opt}, $newvollist);
> + $newid, $storage, $format, $fullclone->{$opt}, $newvollist, $jobs,
> $skipcomplete);
>
> $newconf->{$opt} = PVE::QemuServer::print_drive($vmid, $newdrive);
>
> PVE::QemuConfig->write_config($newid, $newconf);
> + $i++;
> }
>
> delete $newconf->{lock};
> @@ -2478,6 +2486,8 @@ __PACKAGE__->register_method({
> if (my $err = $@) {
> unlink $conffile;
>
> + eval { PVE::QemuServer::qemu_blockjobs_cancel($vmid, $jobs) };
> +
> sleep 1; # some storage like rbd need to wait before release volume -
> really?
>
> foreach my $volid (@$newvollist) {
> --
> 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