Merge remote-tracking branch 'origin/pr/145'
* origin/pr/145: Added info to Restore Backup widget about dom0 restore More consistent 'include_in_backups' behavior Fixed Backup tool's QT bug
This commit is contained in:
commit
2745266bf2
@ -130,7 +130,10 @@ class BackupVMsWindow(ui_backupdlg.Ui_Backup, multiselectwidget.QtGui.QWizard):
|
|||||||
allow_none=False
|
allow_none=False
|
||||||
)
|
)
|
||||||
|
|
||||||
selected = self.load_settings()
|
self.unrecognized_config_label.setVisible(False)
|
||||||
|
self.load_settings()
|
||||||
|
|
||||||
|
selected = self.vms_to_include()
|
||||||
self.__fill_vms_list__(selected)
|
self.__fill_vms_list__(selected)
|
||||||
|
|
||||||
# Connect backup events for progress_bar
|
# Connect backup events for progress_bar
|
||||||
@ -142,14 +145,28 @@ class BackupVMsWindow(ui_backupdlg.Ui_Backup, multiselectwidget.QtGui.QWizard):
|
|||||||
def on_backup_progress(self, __submitter, _event, **kwargs):
|
def on_backup_progress(self, __submitter, _event, **kwargs):
|
||||||
self.progress_bar.setValue(int(float(kwargs['progress'])))
|
self.progress_bar.setValue(int(float(kwargs['progress'])))
|
||||||
|
|
||||||
|
def vms_to_include(self):
|
||||||
|
"""
|
||||||
|
Helper function that returns list of VMs with 'include_in_backups'
|
||||||
|
attribute set to True.
|
||||||
|
:return: list of VM names
|
||||||
|
"""
|
||||||
|
|
||||||
|
result = []
|
||||||
|
|
||||||
|
for domain in self.qubes_app.domains:
|
||||||
|
if getattr(domain, 'include_in_backups', None):
|
||||||
|
result.append(domain.name)
|
||||||
|
|
||||||
|
return result
|
||||||
|
|
||||||
def load_settings(self):
|
def load_settings(self):
|
||||||
"""
|
"""
|
||||||
Helper function that tries to load existing backup profile
|
Helper function that tries to load existing backup profile
|
||||||
(default path: /etc/qubes/backup/qubes-manager-backup.conf )
|
(default path: /etc/qubes/backup/qubes-manager-backup.conf )
|
||||||
and then apply its contents to the Backup window.
|
and then apply its contents to the Backup window.
|
||||||
:return: list of vms to include in backup, if it exists in the profile,
|
Ignores listed VMs, to prioritize include_in_backups feature.
|
||||||
or None if it does not
|
:return: None
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
profile_data = backup_utils.load_backup_profile()
|
profile_data = backup_utils.load_backup_profile()
|
||||||
@ -168,6 +185,8 @@ class BackupVMsWindow(ui_backupdlg.Ui_Backup, multiselectwidget.QtGui.QWizard):
|
|||||||
dest_vm_idx = self.appvm_combobox.findText(dest_vm_name)
|
dest_vm_idx = self.appvm_combobox.findText(dest_vm_name)
|
||||||
if dest_vm_idx > -1:
|
if dest_vm_idx > -1:
|
||||||
self.appvm_combobox.setCurrentIndex(dest_vm_idx)
|
self.appvm_combobox.setCurrentIndex(dest_vm_idx)
|
||||||
|
else:
|
||||||
|
self.unrecognized_config_label.setVisible(True)
|
||||||
|
|
||||||
if 'destination_path' in profile_data:
|
if 'destination_path' in profile_data:
|
||||||
dest_path = profile_data['destination_path']
|
dest_path = profile_data['destination_path']
|
||||||
@ -181,11 +200,6 @@ class BackupVMsWindow(ui_backupdlg.Ui_Backup, multiselectwidget.QtGui.QWizard):
|
|||||||
if 'compression' in profile_data:
|
if 'compression' in profile_data:
|
||||||
self.compress_checkbox.setChecked(profile_data['compression'])
|
self.compress_checkbox.setChecked(profile_data['compression'])
|
||||||
|
|
||||||
if 'include' in profile_data:
|
|
||||||
return profile_data['include']
|
|
||||||
|
|
||||||
return None
|
|
||||||
|
|
||||||
def save_settings(self, use_temp):
|
def save_settings(self, use_temp):
|
||||||
"""
|
"""
|
||||||
Helper function that saves backup profile to either
|
Helper function that saves backup profile to either
|
||||||
@ -231,9 +245,6 @@ class BackupVMsWindow(ui_backupdlg.Ui_Backup, multiselectwidget.QtGui.QWizard):
|
|||||||
self.select_vms_widget.available_list.sortItems()
|
self.select_vms_widget.available_list.sortItems()
|
||||||
self.select_vms_widget.selected_list.sortItems()
|
self.select_vms_widget.selected_list.sortItems()
|
||||||
|
|
||||||
self.unrecognized_config_label.setVisible(
|
|
||||||
selected is not None and
|
|
||||||
len(selected) != len(self.select_vms_widget.selected_list))
|
|
||||||
self.total_size_label.setText(
|
self.total_size_label.setText(
|
||||||
admin_utils.size_to_human(self.total_size))
|
admin_utils.size_to_human(self.total_size))
|
||||||
|
|
||||||
@ -418,6 +429,7 @@ def main():
|
|||||||
qt_app.setOrganizationName("The Qubes Project")
|
qt_app.setOrganizationName("The Qubes Project")
|
||||||
qt_app.setOrganizationDomain("http://qubes-os.org")
|
qt_app.setOrganizationDomain("http://qubes-os.org")
|
||||||
qt_app.setApplicationName("Qubes Backup VMs")
|
qt_app.setApplicationName("Qubes Backup VMs")
|
||||||
|
qt_app.lastWindowClosed.connect(loop_shutdown)
|
||||||
|
|
||||||
sys.excepthook = handle_exception
|
sys.excepthook = handle_exception
|
||||||
|
|
||||||
|
@ -96,6 +96,8 @@ class RestoreVMsWindow(ui_restoredlg.Ui_Restore, QtGui.QWizard):
|
|||||||
|
|
||||||
self.setupUi(self)
|
self.setupUi(self)
|
||||||
|
|
||||||
|
self.dom0_restored_label.setVisible(False)
|
||||||
|
|
||||||
self.select_vms_widget = multiselectwidget.MultiSelectWidget(self)
|
self.select_vms_widget = multiselectwidget.MultiSelectWidget(self)
|
||||||
self.select_vms_layout.insertWidget(1, self.select_vms_widget)
|
self.select_vms_layout.insertWidget(1, self.select_vms_widget)
|
||||||
|
|
||||||
@ -185,6 +187,9 @@ class RestoreVMsWindow(ui_restoredlg.Ui_Restore, QtGui.QWizard):
|
|||||||
vmname = self.select_vms_widget.available_list.item(i).text()
|
vmname = self.select_vms_widget.available_list.item(i).text()
|
||||||
del self.vms_to_restore[str(vmname)]
|
del self.vms_to_restore[str(vmname)]
|
||||||
|
|
||||||
|
if 'dom0' in self.vms_to_restore.keys():
|
||||||
|
self.dom0_restored_label.setVisible(True)
|
||||||
|
|
||||||
self.vms_to_restore = self.backup_restore.restore_info_verify(
|
self.vms_to_restore = self.backup_restore.restore_info_verify(
|
||||||
self.vms_to_restore)
|
self.vms_to_restore)
|
||||||
|
|
||||||
|
@ -265,6 +265,13 @@ p, li { white-space: pre-wrap; }
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="dom0_restored_label">
|
||||||
|
<property name="text">
|
||||||
|
<string><html><head/><body><p><span style=" font-weight:600;">WARNING: restored dom0 files are located in ~/backup-restore-&lt;timestamp&gt; directory</span></p></body></html></string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
|
Loading…
Reference in New Issue
Block a user