Skip to content

Commit ca38f6d

Browse files
committed
Use start utility instead of main from tool
1 parent 66c0e46 commit ca38f6d

4 files changed

Lines changed: 10 additions & 9 deletions

File tree

qubesmanager/bootfromdevice.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
from PyQt6 import QtWidgets, QtGui, QtCore # pylint: disable=import-error
2525
from qubesadmin import tools
2626
from qubesadmin import exc
27-
from qubesadmin.tools import qvm_start
27+
from qubesadmin import utils as admin_utils
2828

2929
# this is needed for icons to actually work
3030
# pylint: disable=unused-import, no-name-in-module
@@ -178,7 +178,7 @@ def main(args=None):
178178
window = utils.run_synchronous(
179179
functools.partial(VMBootFromDeviceWindow, vm))
180180
if window.result() == 1 and window.cdrom_location is not None:
181-
qvm_start.main(['--cdrom', window.cdrom_location, vm.name])
181+
admin_utils.start_expert(domain=vm, drive="cdrom:" + window.cdrom_location)
182182

183183
if __name__ == "__main__":
184184
main()

qubesmanager/qube_manager.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131

3232
from qubesadmin import exc
3333
from qubesadmin import utils
34-
from qubesadmin.tools import qvm_start
3534

3635
# pylint: disable=import-error
3736
from PyQt6 import QtWidgets
@@ -1613,8 +1612,9 @@ def action_startvm_tools_install_triggered(self):
16131612
self.tr("'qubes-windows-tools' is not installed in dom0."))
16141613
for vm_info in self.get_selected_vms():
16151614
vm = vm_info.vm
1616-
qvm_start.main(['--cdrom',
1617-
'dom0:/usr/lib/qubes/qubes-windows-tools.iso', vm.name])
1615+
utils.start_expert(
1616+
domain=vm, drive="cdrom:dom0:/usr/lib/qubes/qubes-windows-tools.iso"
1617+
)
16181618

16191619
@pyqtSlot(name='on_action_pausevm_triggered')
16201620
def action_pausevm_triggered(self):

qubesmanager/settings.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
from qubesadmin import device_protocol
3535
from qubesadmin.device_protocol import DeviceCategory
3636
from qubesadmin import utils as admin_utils
37-
from qubesadmin.tools import qvm_start
3837
import qubesadmin.exc
3938

4039
from . import bootfromdevice
@@ -1393,7 +1392,9 @@ def boot_from_cdrom_button_pressed(self):
13931392
)
13941393
if boot_dialog.exec():
13951394
self.save_and_apply()
1396-
qvm_start.main(["--cdrom", boot_dialog.cdrom_location, self.vm.name])
1395+
admin_utils.start_expert(
1396+
domain=self.vm, drive="cdrom:" + boot_dialog.cdrom_location
1397+
)
13971398

13981399
def virt_mode_changed(self, new_idx): # pylint: disable=unused-argument
13991400
self.update_pv_warning()

qubesmanager/tests/test_vm_settings.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1101,7 +1101,7 @@ def test_211_virtmode(settings_fixture):
11011101
assert expected_call in settings_window.qubesapp.actual_calls
11021102

11031103

1104-
@mock.patch("qubesadmin.tools.qvm_start.main")
1104+
@mock.patch("qubesadmin.utils.start_expert")
11051105
@mock.patch("qubesmanager.bootfromdevice.VMBootFromDeviceWindow")
11061106
@check_errors
11071107
@pytest.mark.parametrize("settings_fixture", TEST_VMS, indirect=True)
@@ -1120,7 +1120,7 @@ def test_212_boot_from_device(mock_boot, mock_start, settings_fixture):
11201120
parent=settings_window,
11211121
)
11221122

1123-
mock_start.assert_called_with(["--cdrom", mock.ANY, vm.name])
1123+
mock_start.assert_called_with(domain=vm, drive=mock.ANY)
11241124

11251125

11261126
@check_errors

0 commit comments

Comments
 (0)