Skip to content
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

Run disk format detection also for CD/DVD discs #1124

Merged
merged 1 commit into from
Jul 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/components/vm/disks/diskAdd.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@ export class AddDiskModalBody extends React.Component {
this.onValueChanged("device", "cdrom");
}

if (value && this.state.device === "disk") {
if (value) {
this.setState({ verificationInProgress: true, validate: false });
cockpit.spawn(["head", "--bytes=16", value], { binary: true, err: "message", superuser: "try" })
.then(file_header => {
Expand Down
41 changes: 39 additions & 2 deletions test/check-machines-disks
Original file line number Diff line number Diff line change
Expand Up @@ -1186,7 +1186,7 @@ class TestMachinesDisks(VirtualMachinesCase):
# https://bugzilla.redhat.com/show_bug.cgi?id=1977810
self.VMAddDiskDialog(
self,
expected_target='sda',
expected_target='sdb',
file_path='/var/lib/libvirt/novell.iso',
mode='custom-path'
).execute()
Expand Down Expand Up @@ -1221,7 +1221,7 @@ class TestMachinesDisks(VirtualMachinesCase):
b.click(f"{prefix}-dialog-cancel")
self.VMAddDiskDialog(
self,
expected_target='sda',
expected_target='sdc',
file_path='/var/lib/libvirt/novell.iso',
mode='custom-path'
).execute()
Expand All @@ -1235,6 +1235,43 @@ class TestMachinesDisks(VirtualMachinesCase):
b.select_from_dropdown(f"{prefix}-select-device", "disk")
b.click("div.pf-v5-c-modal-box button:contains(Show additional options)")
b.wait_visible(f"{prefix}-bus-type[data-value=ide]")
b.click(".pf-v5-c-modal-box__footer button:contains(Cancel)")

# check CD/DVD discs correctly assumes raw format for raw file
m.execute("qemu-img create -f raw /var/lib/libvirt/images/foobar.raw 1M")
self.VMAddDiskDialog(
self,
device='cdrom',
bus_type='scsi',
expected_target='sdd',
expected_format='raw',
file_path='/var/lib/libvirt/images/foobar.raw',
mode='custom-path',
).execute()

# check CD/DVD discs correctly assumes raw format for ISO file
m.upload([os.path.join(BOTS_DIR, "machine/cloud-init.iso")], "/var/lib/libvirt/images/isofile")
self.VMAddDiskDialog(
self,
device='disk',
bus_type='scsi',
expected_target='sde',
expected_format='raw',
file_path='/var/lib/libvirt/images/isofile',
mode='custom-path',
).execute()

# check CD/DVD discs correctly assumes qcow2 format for qcow2 file
m.execute("qemu-img create -f qcow2 /var/lib/libvirt/images/foobar.qcow2 1M")
self.VMAddDiskDialog(
self,
device='disk',
bus_type='scsi',
expected_target='sdf',
expected_format='qcow2',
file_path='/var/lib/libvirt/images/foobar.qcow2',
mode='custom-path',
).execute()

def testAddDiskAdditionalOptions(self):
m = self.machine
Expand Down