VirtualBox

Opened 4 years ago

Last modified 4 years ago

#20196 new defect

Error while using VirtioSCSI through vboxwebsrv (Invalid controller type 11 (0x80070057))

Reported by: haster Owned by:
Component: webservices Version: VirtualBox 6.1.18
Keywords: vboxwebsrv virtio scsi Cc:
Guest type: Linux Host type: Linux

Description

Since the lsilogic SCSI controller intermittently crashes with kernel panic, we've tried switching to the new Virtio SCSI controller.

However, while attempting to use the Java SDK to select this controller through vboxwebsrv, we get an error. This seems to be related to using vboxwebsrv, as selecting the virtio-scsi controller in the UI of Virtualbox or vboxmanage works as expected.

Since the virtio scsi controller is new in 6.1, we suspect that vboxwebsrv has not been modified to accept/handle the new controller type, but we can't be sure.

The error we get back is

VirtualBox error: rc=0x80070057 Invalid controller type 11 (0x80070057)

The Java code is:

IAppliance ova = vbox.createAppliance();
waitFor(ova.read(ovaName));
ova.interpret();
waitFor(ova.importMachines(List.of(ImportOptions.ImportToVDI)));
machine = vbox.findMachine(ova.getMachines().get(0));
ISession session = manager.getSessionObject();
machine.lockMachine(session, LockType.Write);
IStorageController storage = session.getMachine().getStorageControllers().get(0);
storage.setControllerType(StorageControllerType.VirtioSCSI);
session.getMachine().saveSettings();

The error happens on the line

storage.setControllerType(StorageControllerType.VirtioSCSI);

The vboxwebsrv log says:

00:00:37.787184 SQW01    -- entering __vbox__IStorageController_USCOREsetControllerType
00:00:37.787195 SQW01       findRefFromId(): looking up objref 97ccd3f131838cc7-0000000000000009
00:00:37.787200 SQW01       findComPtrFromId(): returning original IStorageController*=0x7FE6E8004570 (IUnknown*=0x7FE6E80046C0)
00:00:37.787203 SQW01       calling COM method COMSETTER(ControllerType)
00:00:37.787418 main     Pumping COM event queue
00:00:37.787613 main     Pumping COM event queue
00:00:37.787965 main     Pumping COM event queue
00:00:37.788172 main     Pumping COM event queue
00:00:37.788311 main     Pumping COM event queue
00:00:37.788450 main     Pumping COM event queue
00:00:37.788535 main     Pumping COM event queue
00:00:37.788619 main     Pumping COM event queue
00:00:37.788701 main     Pumping COM event queue
00:00:37.788762 SQW01       error, raising SOAP exception
00:00:37.788766 SQW01    API method name:            IStorageController::COMSETTER(ControllerType)
00:00:37.788767 SQW01    API return code:            0x80070057 (NS_ERROR_INVALID_ARG)
00:00:37.788776 SQW01    COM error info result code: 0x80070057 (NS_ERROR_INVALID_ARG)
00:00:37.788777 SQW01    COM error info text:        Invalid controller type 11
00:00:37.788840 main     Pumping COM event queue
00:00:37.788896 main     Pumping COM event queue
00:00:37.788899 SQW01       * ManagedObjectRef: MOR created for IVirtualBoxErrorInfo*=0x007fe6e8005070 (IUnknown*=0x007fe6e8007560; COM refcount now 4/2), new ID is 0xa; now 10 objects total
00:00:37.788906 SQW01    -- leaving __vbox__IStorageController_USCOREsetControllerType, rc: 0x80070057 (-2147024809)

Installed vboxwebsrv:

VirtualBox web service 6.1.18 r142142 linux.amd64 (Jan  7 2021 17:47:09) release log

Change History (2)

comment:1 by haster, 4 years ago

Looking at https://github.com/mirror/vbox/blob/master/src/VBox/Main/src-server/StorageControllerImpl.cpp#L353 , it seems the controller type is checked against the bustype. We know VirtioSCSI is (internally) a different bustype, but there seems to be no way to set the bustype from the SDK/through vboxwebsrv.

Looking a bit further, it seems the UI is recreating the entire controller to switch to virtioSCSI, but that is not (yet, easily) possible through vboxwebsrv/the SDK.

https://github.com/mirror/vbox/blob/b9657cd5351cf17432b664009cc25bb480dc64c1/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsStorage.cpp#L3880 :

bool UIMachineSettingsStorage::isControllerCouldBeUpdated(const UICacheSettingsMachineStorageController &controllerCache) const
{
    /* IController interface doesn't allows to change 'name' and 'bus' attributes.
     * But those attributes could be changed in GUI directly or indirectly.
     * For such cases we have to recreate IController instance,
     * for other cases we will update controller attributes only. */
    const UIDataSettingsMachineStorageController &oldControllerData = controllerCache.base();
    const UIDataSettingsMachineStorageController &newControllerData = controllerCache.data();
    return newControllerData.m_controllerBus == oldControllerData.m_controllerBus &&
           newControllerData.m_strControllerName == oldControllerData.m_strControllerName;
}
Last edited 4 years ago by haster (previous) (diff)

comment:2 by haster, 4 years ago

After trying around a bit, we came up with the following Java code (using the SDK) which seems able to succesfully create a VirtioSCSI controller by creating it anew.

String name = session.getMachine().getStorageControllers().get(0).getName();
IMediumAttachment disk = session.getMachine().getMediumAttachmentsOfController(name).get(0);
session.getMachine().removeStorageController(name);
session.getMachine().addStorageController(name, StorageBus.VirtioSCSI);
session.getMachine().setStorageControllerBootable(name, true);
session.getMachine().attachDevice(name, 0, 0, DeviceType.HardDisk, disk.getMedium());

Still not the ideal way, but it seems to work (at least as far as switching to VirtioSCSI goes). Including it here for inspiration and for others running into the same problems.

Last edited 4 years ago by haster (previous) (diff)
Note: See TracTickets for help on using tickets.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette