Skip to content

Bring back vm.suspend during deleting VM snapshot#4029

Merged
DaanHoogland merged 4 commits intomasterfrom
kvm-vm-suspend-before-delete-vm-snapshot
Apr 16, 2020
Merged

Bring back vm.suspend during deleting VM snapshot#4029
DaanHoogland merged 4 commits intomasterfrom
kvm-vm-suspend-before-delete-vm-snapshot

Conversation

@andrijapanicsb
Copy link
Copy Markdown
Contributor

@andrijapanicsb andrijapanicsb commented Apr 14, 2020

Original commit, merged to 4.11.3, got mysteriously missing when merging branch 4.11 to 4.12 on the very same day that original PR was merged - so bringing back the same code to 4.13.1 and 4.14(master atm)

I'm talking about the PR #3194 (the commit itself is there, but NOT the content/code - possibly a wrongly resolved merge conflicts etc)

/cc @weizhouapache (you approved the original PR) and @rhtyd (you also approved the original PR)

UPDATE: the VM snapshots deletion is NOT handled via this code (this code is used in some other scenario - was missing so there it is now again)

Pausing a VM BEFORE the VM snap is deleted is handled now by #4033. Possible improvements (for 4.15) can be taken from #4032 (additional checks and such)

@andrijapanicsb
Copy link
Copy Markdown
Contributor Author

@blueorangutan package

@blueorangutan
Copy link
Copy Markdown

@andrijapanicsb a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress.

@andrijapanicsb andrijapanicsb mentioned this pull request Apr 14, 2020
5 tasks
@andrijapanicsb
Copy link
Copy Markdown
Contributor Author

@blueorangutan package

@blueorangutan
Copy link
Copy Markdown

@andrijapanicsb a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress.

@Slair1
Copy link
Copy Markdown
Contributor

Slair1 commented Apr 14, 2020

@andrijapanicsb thanks for opening this PR up. From your testing were you able to reproduce the corruption using a "VM Snapshot" also (create followed by a delete)? Or just a volume-based snapshot?

I ask because the delete of a VM snapshot still does not have the pause/resume.

@andrijapanicsb
Copy link
Copy Markdown
Contributor Author

I'm testing with the latest master first, trying to corrupt the VM (delete VM snap during high IO load inside a VM) - but can't manage to do that (hm, my cent7 template is EXT4, not the gentle XFS - perhaps that's the case) - tired of testing...

Anyway, it's safe to suspend the VM before the snap restore, so we shall proceed with it - so I will verify the VM is suspended (this PR) and move from there.

@blueorangutan
Copy link
Copy Markdown

Packaging result: ✖centos7 ✖debian. JID-1164

@blueorangutan
Copy link
Copy Markdown

Packaging result: ✔centos7 ✔debian. JID-1165

@andrijapanicsb
Copy link
Copy Markdown
Contributor Author

andrijapanicsb commented Apr 15, 2020

@Slair1 I don't see VM being paused when snapshots (VM snapshot) is being deleted...

Sorry to ask, did you ever observe/confirm code works on 4.11.3?
i.e. "virsh list" should show VM as "paused" for a few moments, right? (like it is while the snap is created in the first place) ?

@Slair1 If I don't see this solved in next 2-3h, I'm afraid I will have to move it to 4.15, as we aim to cut 4.14 RC1 on Friday and this issue you've raised way too late (in the #3969).

@andrijapanicsb
Copy link
Copy Markdown
Contributor Author

@blueorangutan package

@blueorangutan
Copy link
Copy Markdown

@andrijapanicsb a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress.

@blueorangutan
Copy link
Copy Markdown

Packaging result: ✔centos7 ✔debian. JID-1170

@andrijapanicsb
Copy link
Copy Markdown
Contributor Author

@weizhouapache this PR is no good.
The snap delete seems to NOT happen here, as I don't see the log line "Suspending..." while the VM is being suspended at all (added to help debug why the vm.suspend is not run/doesn't get suspended)

I'm moving this PR to 4.15, unless you miraculously come (wouldn't be the first time :) with proper code and add that vm.suspend whereever the snap IS actually deleted...)
thx

@Slair1
Copy link
Copy Markdown
Contributor

Slair1 commented Apr 15, 2020

@andrijapanicsb you're correct, we also need the suspend and resume when a VM Snapshot is deleted also - that is not currently done. This PR is partially correct though as is. Snapshots are also deleted after a Backup to Secondary Storage operation is finished. @ggoodrich-ipp perhaps you can push your PR and reference the new PR here?

@ggoodrich-ipp has a more complete PR with the pause/resume in both applicable locations.

@andrijapanicsb
Copy link
Copy Markdown
Contributor Author

andrijapanicsb commented Apr 15, 2020 via email

Comment on lines +1008 to +1013
try {
s_logger.info(String.format("Suspending VM '%s' to delete snapshot,", vm.getName()));
vm.suspend();
} catch (final LibvirtException e) {
s_logger.error("Failed to suspend the VM", e);
throw e;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same comment as in #4033: first we suspend unconditionaly, and than, we just assume it need resuming without checking if it was running in the first place. Are there situations we should guard against more diligently? (cc @weizhouapache @rhtyd )

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DaanHoogland I see on line 1007, we are checking that domain is running? Did I miss anything?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, we are, i am confusing PRs. this one actually doesn't do anything in the delete vmshapshot scenario.

Copy link
Copy Markdown
Member

@yadvr yadvr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, see Daan's comment though.

Copy link
Copy Markdown
Contributor

@DaanHoogland DaanHoogland left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

code (and state check) is actually good on this one. Merge!

@DaanHoogland DaanHoogland merged commit b406e1d into master Apr 16, 2020
@DaanHoogland DaanHoogland deleted the kvm-vm-suspend-before-delete-vm-snapshot branch April 16, 2020 13:15
yadvr pushed a commit that referenced this pull request Feb 25, 2021
…n, th… (#4032)

These changes are related to PR #3194, but include suspending/resuming the VM when doing a VM snapshot as well, when deleting a VM snapshot, as it is performing the same operations via Libvirt. Also, there was an issue with the UI/localization changes in the prior PR, as that PR was altering the Volume snapshot behavior, but was altering the VM snapshot wording. Both have been altered in this PR.

Issuing this in response to the work happening in PR #4029.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants