Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
info: Keep request within 4G bound
Otherwise, we get a failure due to Numerical result out of range. And for safety's sake, we are best capping our request to an aligned value, if the server insists on minimum alignment. Maybe nbdinfo should consolidate adjacent lines with identical status, but that's a different patch. Fixes: f3fd935
- Loading branch information
Showing
3 changed files
with
57 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| #!/usr/bin/env bash | ||
| # nbd client library in userspace | ||
| # Copyright (C) 2020 Red Hat Inc. | ||
| # | ||
| # This library is free software; you can redistribute it and/or | ||
| # modify it under the terms of the GNU Lesser General Public | ||
| # License as published by the Free Software Foundation; either | ||
| # version 2 of the License, or (at your option) any later version. | ||
| # | ||
| # This library is distributed in the hope that it will be useful, | ||
| # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| # Lesser General Public License for more details. | ||
| # | ||
| # You should have received a copy of the GNU Lesser General Public | ||
| # License along with this library; if not, write to the Free Software | ||
| # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
|
|
||
| . ../tests/functions.sh | ||
|
|
||
| set -e | ||
| set -x | ||
|
|
||
| requires nbdkit --version | ||
| requires nbdsh --version | ||
| requires tr --version | ||
|
|
||
| out=info-base-allocation.out | ||
| cleanup_fn rm -f $out | ||
| rm -f $out | ||
|
|
||
| # Note the memory plugin uses a 32K page size, and extents | ||
| # are always aligned with this. | ||
| nbdkit -U - memory 6G --run ' | ||
| nbdsh -u "$uri" \ | ||
| -c "h.pwrite(b\"\\x01\"*131072, 0)" \ | ||
| -c "h.pwrite(b\"\\x02\"*131072, 320*1024)" && | ||
| $VG nbdinfo --map "$uri" | ||
| ' > $out | ||
|
|
||
| cat $out | ||
|
|
||
| if [ "$(tr -s ' ' < $out)" != " 0 131072 0 allocated | ||
| 131072 196608 3 hole,zero | ||
| 327680 131072 0 allocated | ||
| 458752 4294508544 3 hole,zero | ||
| 4294967296 2147483648 3 hole,zero" ]; then | ||
| echo "$0: unexpected output from nbdinfo --map" | ||
| exit 1 | ||
| fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters