Adding a button to list PCI devices and enable no-strict-reset
This commit is contained in:
parent
60143e6a91
commit
f4fae54057
61
qubesmanager/device_list.py
Normal file
61
qubesmanager/device_list.py
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
#!/usr/bin/python3
|
||||||
|
#
|
||||||
|
# The Qubes OS Project, http://www.qubes-os.org
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or
|
||||||
|
# modify it under the terms of the GNU General Public License
|
||||||
|
# as published by the Free Software Foundation; either version 2
|
||||||
|
# of the License, or (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Lesser General Public License along
|
||||||
|
# with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||||
|
#
|
||||||
|
#
|
||||||
|
|
||||||
|
from . import ui_devicelist # pylint: disable=no-name-in-module
|
||||||
|
from PyQt4 import QtGui, QtCore # pylint: disable=import-error
|
||||||
|
|
||||||
|
|
||||||
|
class PCIDeviceListWindow(ui_devicelist.Ui_Dialog, QtGui.QDialog):
|
||||||
|
def __init__(self, vm, qapp, dev_list, parent=None):
|
||||||
|
super(PCIDeviceListWindow, self).__init__(parent)
|
||||||
|
|
||||||
|
self.vm = vm
|
||||||
|
self.qapp = qapp
|
||||||
|
self.dev_list = dev_list
|
||||||
|
|
||||||
|
self.setupUi(self)
|
||||||
|
|
||||||
|
self.connect(
|
||||||
|
self.buttonBox, QtCore.SIGNAL("accepted()"), self.save_and_apply)
|
||||||
|
self.connect(
|
||||||
|
self.buttonBox, QtCore.SIGNAL("rejected()"), self.reject)
|
||||||
|
|
||||||
|
self.fill_device_list()
|
||||||
|
|
||||||
|
def fill_device_list(self):
|
||||||
|
self.device_list.clear()
|
||||||
|
|
||||||
|
pci_devices = [ass.ident.replace('_', ':')
|
||||||
|
for ass in self.vm.devices['pci'].assignments()]
|
||||||
|
|
||||||
|
for i in range(self.dev_list.selected_list.count()):
|
||||||
|
text = self.dev_list.selected_list.item(i).text()
|
||||||
|
ident = self.dev_list.selected_list.item(i).ident
|
||||||
|
if ident in pci_devices:
|
||||||
|
self.device_list.addItem(text)
|
||||||
|
|
||||||
|
def reject(self):
|
||||||
|
self.done(0)
|
||||||
|
|
||||||
|
def save_and_apply(self):
|
||||||
|
self.done(0)
|
||||||
|
|
||||||
|
def show(self):
|
||||||
|
super(PCIDeviceListWindow, self).show()
|
||||||
|
self.fill_device_list()
|
@ -37,6 +37,7 @@ import qubesadmin.exc
|
|||||||
from . import utils
|
from . import utils
|
||||||
from . import multiselectwidget
|
from . import multiselectwidget
|
||||||
from . import thread_monitor
|
from . import thread_monitor
|
||||||
|
from . import device_list
|
||||||
|
|
||||||
from .appmenu_select import AppmenuSelectManager
|
from .appmenu_select import AppmenuSelectManager
|
||||||
from . import firewall
|
from . import firewall
|
||||||
@ -123,6 +124,8 @@ class VMSettingsWindow(ui_settingsdlg.Ui_SettingsDialog, QtGui.QDialog):
|
|||||||
self.connect(self.dev_list,
|
self.connect(self.dev_list,
|
||||||
QtCore.SIGNAL("selected_changed()"),
|
QtCore.SIGNAL("selected_changed()"),
|
||||||
self.devices_selection_changed)
|
self.devices_selection_changed)
|
||||||
|
self.no_strict_reset_button.clicked.connect(
|
||||||
|
self.strict_reset_button_pressed)
|
||||||
|
|
||||||
####### services tab
|
####### services tab
|
||||||
self.__init_services_tab__()
|
self.__init_services_tab__()
|
||||||
@ -668,6 +671,8 @@ class VMSettingsWindow(ui_settingsdlg.Ui_SettingsDialog, QtGui.QDialog):
|
|||||||
def __apply_devices_tab__(self):
|
def __apply_devices_tab__(self):
|
||||||
msg = []
|
msg = []
|
||||||
|
|
||||||
|
no_strict_reset = self.no_pci_strict_reset.isChecked()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
old = [ass.ident.replace('_', ':')
|
old = [ass.ident.replace('_', ':')
|
||||||
for ass in self.vm.devices['pci'].persistent()]
|
for ass in self.vm.devices['pci'].persistent()]
|
||||||
@ -676,10 +681,13 @@ class VMSettingsWindow(ui_settingsdlg.Ui_SettingsDialog, QtGui.QDialog):
|
|||||||
for i in range(self.dev_list.selected_list.count())]
|
for i in range(self.dev_list.selected_list.count())]
|
||||||
for ident in new:
|
for ident in new:
|
||||||
if ident not in old:
|
if ident not in old:
|
||||||
|
options = {}
|
||||||
|
if no_strict_reset:
|
||||||
|
options['no-strict-reset'] = True
|
||||||
ass = devices.DeviceAssignment(
|
ass = devices.DeviceAssignment(
|
||||||
self.vm.app.domains['dom0'],
|
self.vm.app.domains['dom0'],
|
||||||
ident.replace(':', '_'),
|
ident.replace(':', '_'),
|
||||||
persistent=True)
|
persistent=True, options=options)
|
||||||
self.vm.devices['pci'].attach(ass)
|
self.vm.devices['pci'].attach(ass)
|
||||||
for ass in self.vm.devices['pci'].assignments(persistent=True):
|
for ass in self.vm.devices['pci'].assignments(persistent=True):
|
||||||
if ass.ident.replace('_', ':') not in new:
|
if ass.ident.replace('_', ':') not in new:
|
||||||
@ -717,6 +725,13 @@ class VMSettingsWindow(ui_settingsdlg.Ui_SettingsDialog, QtGui.QDialog):
|
|||||||
self.dmm_warning_adv.hide()
|
self.dmm_warning_adv.hide()
|
||||||
self.dmm_warning_dev.hide()
|
self.dmm_warning_dev.hide()
|
||||||
|
|
||||||
|
def strict_reset_button_pressed(self):
|
||||||
|
device_list_window = device_list.PCIDeviceListWindow(
|
||||||
|
self.vm, self.qapp, self.dev_list, self)
|
||||||
|
device_list_window.show()
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
######## applications tab
|
######## applications tab
|
||||||
|
|
||||||
def refresh_apps_in_vm(self, t_monitor):
|
def refresh_apps_in_vm(self, t_monitor):
|
||||||
|
@ -91,6 +91,7 @@ rm -rf $RPM_BUILD_ROOT
|
|||||||
%{python3_sitelib}/qubesmanager/qube_manager.py
|
%{python3_sitelib}/qubesmanager/qube_manager.py
|
||||||
%{python3_sitelib}/qubesmanager/utils.py
|
%{python3_sitelib}/qubesmanager/utils.py
|
||||||
%{python3_sitelib}/qubesmanager/bootfromdevice.py
|
%{python3_sitelib}/qubesmanager/bootfromdevice.py
|
||||||
|
%{python3_sitelib}/qubesmanager/device_list.py
|
||||||
|
|
||||||
%{python3_sitelib}/qubesmanager/resources_rc.py
|
%{python3_sitelib}/qubesmanager/resources_rc.py
|
||||||
|
|
||||||
@ -107,6 +108,7 @@ rm -rf $RPM_BUILD_ROOT
|
|||||||
%{python3_sitelib}/qubesmanager/ui_releasenotes.py
|
%{python3_sitelib}/qubesmanager/ui_releasenotes.py
|
||||||
%{python3_sitelib}/qubesmanager/ui_informationnotes.py
|
%{python3_sitelib}/qubesmanager/ui_informationnotes.py
|
||||||
%{python3_sitelib}/qubesmanager/ui_qubemanager.py
|
%{python3_sitelib}/qubesmanager/ui_qubemanager.py
|
||||||
|
%{python3_sitelib}/qubesmanager/ui_devicelist.py
|
||||||
%{python3_sitelib}/qubesmanager/i18n/qubesmanager_*.qm
|
%{python3_sitelib}/qubesmanager/i18n/qubesmanager_*.qm
|
||||||
%{python3_sitelib}/qubesmanager/i18n/qubesmanager_*.ts
|
%{python3_sitelib}/qubesmanager/i18n/qubesmanager_*.ts
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
<locale language="English" country="UnitedStates"/>
|
<locale language="English" country="UnitedStates"/>
|
||||||
</property>
|
</property>
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>2</number>
|
<number>3</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="basic_tab">
|
<widget class="QWidget" name="basic_tab">
|
||||||
<property name="locale">
|
<property name="locale">
|
||||||
@ -1089,6 +1089,13 @@ border-width: 1px;</string>
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="no_strict_reset_button">
|
||||||
|
<property name="text">
|
||||||
|
<string>Configure strict reset for PCI devices</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QWidget" name="apps_tab">
|
<widget class="QWidget" name="apps_tab">
|
||||||
|
Loading…
Reference in New Issue
Block a user