Skip to content

Commit

Permalink
Use raw image format by default for block devices
Browse files Browse the repository at this point in the history
Not providing a default behavior leads to use of variable without
a value and thus cryptic errors regarding the simple fact that we
have to provide an image format. It is also not recommended in any
conditionals as it leads to undefined behaviors. Finally, in the
case of multiple images we may have "image_format=" to use empty
string which should be handled similarly to None (lack of any
image_format parameter) or generally as the comment suggests to
a meaningful default behavior.

Signed-off-by: Plamen Dimitrov <[email protected]>
  • Loading branch information
pevogam committed Dec 28, 2024
1 parent 80ca89f commit d4f00fb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions virttest/qemu_devices/qcontainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -2563,8 +2563,8 @@ def define_hbas(
format_cls = qdevices.QBlockdevFormatLuks
elif imgfmt == "nvme":
format_cls = qdevices.QBlockdevFormatRaw
elif imgfmt is None:
# use RAW type as the default
else:
# use RAW type as the default (None, empty string, or else)
format_cls = qdevices.QBlockdevFormatRaw

protocol_node = protocol_cls(name)
Expand Down

0 comments on commit d4f00fb

Please sign in to comment.