-
Notifications
You must be signed in to change notification settings - Fork 6
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
Preparing for adding block status interface #39
Conversation
Signed-off-by: Nir Soffer <[email protected]>
When validating table index, if the index was too long, we formatted the table using %d instead of the length. Testing show that this format the entire table which is way too big to include in an error message. Signed-off-by: Nir Soffer <[email protected]>
test/qemuio/qemuio.go
Outdated
// Return stderr instead of the unhelpful default error (exited with status | ||
// 1). | ||
if _, ok := err.(*exec.ExitError); ok { | ||
return out, errors.New(stderr.String()) |
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.
fmt.Errorf("%w: stderr=%q", err, stderr)
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.
Keeping the .String() - otherwise we get confusing output.
Without .String():
qcow2reader_test.go:25: exit status 1: stderr={"qemu-img: unrecognized option '--no-such-arg'\nTry 'qemu-img --help' for more information\n" '\x00' '\x00'}
With .String()
qcow2reader_test.go:25: exit status 1: stderr="qemu-img: unrecognized option '--no-such-arg'\nTry 'qemu-img --help' for more information\n"
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.
Changed in qemuimg and qemuio.
Extract qemuimg() helper for running qemu-img command and add a wrapper for the qemu-img crate sub command. Signed-off-by: Nir Soffer <[email protected]>
To qcow2 test images, we used raw image and converted to qcow2 format. This does not work for creating qcow2 chain with some data in the backing file and some data in the top image. qemu-io allows writing data, zeros or discarding a byte range in an image of any format supported by qemu. This change add a tiny test package for running qemu-io. We provide 2 functions, wrapping usage of the write command with different flags: - Write() - write a pattern to specified range - Zero() - write zeros to specified range - Discard() - discard specified range With these functions we can test all kind of extents in both top layer or the backing file: - Allocated: false, Zero: true - Allocated: true, Zero: false - Allocated: true, Zero: true Signed-off-by: Nir Soffer <[email protected]>
We want to use qemu-img and qemu-io to create and manipulate test images. Signed-off-by: Nir Soffer <[email protected]>
Extract a helper for getting cluster metadata from readAtAligned. The helper will be reused for getting cluster status. Signed-off-by: Nir Soffer <[email protected]>
Computing number of L2 entires for every cluster does not feel right since this is a constant value per image. Computing it once after reading the header. Computing L1 index and L2 index use the cluster number. Make the computation more clear by introducing a variable. This change also speed up empty image processing by 10%, since we actually have a tight loop over all image clusters. Signed-off-by: Nir Soffer <[email protected]>
f602ebd
to
f991b63
Compare
CI is failing Probably golangci-lint has to be updated for Go 1.22 |
On it |
This allows using useful new packages such as slices package and other fixes. This also matches lima requirement. Updating also golanci-lint based on lima test workflow. Signed-off-by: Nir Soffer <[email protected]>
f991b63
to
11847eb
Compare
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.
Thanks
These are various fixes, refactoring and test enhancements extracted from the block status work.
Part-of #32