-
Notifications
You must be signed in to change notification settings - Fork 243
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Empty "image_size" in sn_params when "image_snapshot = yes" #3795
fix: Empty "image_size" in sn_params when "image_snapshot = yes" #3795
Conversation
A reproducer is:
With the fix:
|
Hello @YongxueHong @MiriamDeng, feel free to review, thanks. |
Will provide the test results today. Thank you ! |
LGTM, the original issue has gone. |
virttest/qemu_devices/qcontainer.py
Outdated
# Empty the image_size parameter so that the snapshot will align to | ||
# the size of base image | ||
sn_params['image_size'] = "" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From my understanding of the code changes, I think both solutions are the same, just the implementation is a bit different, one is explicit, another is implicit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, there is an issue with the attribute conflict of the image that the test case uses the existing image as the system image, but this image's attributes don't match the parameters in the test case like this PR's issue background is that we prepared an existing 50G system image for the next test case to run, but the next case still uses the 20G image size(actually the size is changed) as the system image which will result in the conflict with the existing 50G system image and then met the error about doing the external snapshot.
To sum up, I think the root cause is that we did not follow the normal logic workflow, and should keep the data consistent first
My suggestion: Better to update the attribute of the system image of the test case at the same time.
Hi @luckyh @PaulYuuu
Please let me know your opinions.
Thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO, the temporary snapshot should follow the image's real metadata to create the snapshot image, not from the parameter. Here I used the easier way to let it align with the base image, but the more reasonable solution is to get the base image's metadata, and then create the snapshot based on it.
In -drive
usage, only image_snapshot = yes
is needed to create an internal snapshot, but -blockdev
dropped this option, so if we also need image_size
to be provided, then this is a breaking change between -drive
and -blockdev
.
However, to keep the same usage as previous(-drive), leave image_size
empty is one way, another one is still create internal snapshot via qemu-img snapshot -c
, and we delete the snapshot at the end of the test.
qemu-img snapshot -l base.qcow2
qemu-img snapshot -c sn1 base.qcow2
qemu-img snapshot -l base.qcow2
Snapshot list:
ID TAG VM SIZE DATE VM CLOCK ICOUNT
1 sn1 0 B 2023-11-28 22:09:04 00:00:00.000 0
qemu-img snapshot -d sn1 base.qcow2
qemu-img snapshot -l base.qcow2
refs:
3085073
to
4bc1ee6
Compare
In qcontainer.py, when creating snapshot images, will get the image size from params. But if the image_size is defined in different variants, the sn image size may smaller than the base image, which is incorrect. The reasonable way is empty the image_size in sn_params, to make the size of snapshot image align to the base one, as this is just a temp snapshot. Signed-off-by: Yihuang Yu <[email protected]>
4bc1ee6
to
b31fc58
Compare
Add a |
In qcontainer.py, when creating snapshot images, will get the image size from params. But if the image_size is defined in different variants, the sn image size may smaller than the base image, which is incorrect. The easier way is empty the image_size in sn_params, to make the size of snapshot image align to the base one, as it's just a snapshot.
ID: 1529