Skip to content

Commit

Permalink
CA-404517: use wipefs to prepare the volume for storage-init
Browse files Browse the repository at this point in the history
And have lvcreate wipe signatures as well.

Signed-off-by: Mark Syms <[email protected]>
  • Loading branch information
MarkSymsCtx committed Jan 21, 2025
1 parent 0203073 commit f1ee1e3
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions drivers/EXTSR.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ def create(self, sr_uuid, size):
size_mb = stats['freespace'] // (1024 * 1024)
assert(size_mb > 0)
cmd += ["-L", str(size_mb), self.vgname]
cmd += ["-W", "y", "--yes"]
text = util.pread(cmd)

cmd = ["lvchange", "-ay", self.remotepath]
Expand Down
2 changes: 1 addition & 1 deletion drivers/lvutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,7 @@ def create(name, size, vgname, tag=None, size_in_percentage=None):
if tag:
cmd.extend(["--addtag", tag])

cmd.extend(['-W', 'n'])
cmd.extend(['-W', 'y', '--yes'])
cmd_lvm(cmd)


Expand Down
4 changes: 2 additions & 2 deletions scripts/storage-init
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ diskprep() {
done

# erase the start of the volume to get rid of other metadata:
echo "* Erasing start of volume"
dd if=/dev/zero of=${disk} count=10 bs=1024k &>/dev/null
echo "* Erasing any filesystems on volume"
wipefs -a ${disk}

echo "Complete."
}
Expand Down
1 change: 1 addition & 0 deletions tests/lvmlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ def fake_lvcreate(self, args, stdin):
parser.add_argument("--inactive", dest='inactive', action='store_true')
parser.add_argument("--zero", dest='zero', default='y')
parser.add_argument("-W", dest='wipe_sig')
parser.add_argument("--yes", dest='all_yes', action="store_true")
parser.add_argument('vgname')
try:
args = parser.parse_args(args[1:])
Expand Down
1 change: 1 addition & 0 deletions tests/test_storage_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ def setUp(self):
self.create_mock_command("xe")

self.create_dummy_command("dd")
self.create_dummy_command("wipefs")
self.create_dummy_command("logger")
self.create_dummy_command("pvremove")
self.create_dummy_command("pvs")
Expand Down

0 comments on commit f1ee1e3

Please sign in to comment.