qubesadmin package¶
Subpackages¶
- qubesadmin.backup package
- Submodules
- qubesadmin.backup.core2 module
- qubesadmin.backup.core3 module
- qubesadmin.backup.restore module
BackupCanceledErrorBackupHeaderBackupRestoreBackupRestore.Dom0ToRestoreBackupRestore.VMToRestoreBackupRestore.appBackupRestore.backup_appBackupRestore.backup_locationBackupRestore.backup_vmBackupRestore.canceledBackupRestore.check_disk_space()BackupRestore.force_compression_filterBackupRestore.get_restore_info()BackupRestore.get_restore_summary()BackupRestore.header_dataBackupRestore.location_is_serviceBackupRestore.new_name_for_conflicting_vm()BackupRestore.optionsBackupRestore.passphraseBackupRestore.processes_to_kill_on_cancelBackupRestore.progress_callbackBackupRestore.restore_do()BackupRestore.restore_info_verify()
BackupRestoreOptionsExtractWorker3ExtractWorker3.base_dirExtractWorker3.blocks_backedupExtractWorker3.check_processes()ExtractWorker3.cleanup_tar2()ExtractWorker3.collect_tar_output()ExtractWorker3.compressedExtractWorker3.crypto_algorithmExtractWorker3.decompressor_processExtractWorker3.decryptor_processExtractWorker3.encryptedExtractWorker3.feed_tar2()ExtractWorker3.handle_dir()ExtractWorker3.import_processExtractWorker3.passphraseExtractWorker3.progress_callbackExtractWorker3.queueExtractWorker3.run()ExtractWorker3.tar2_current_fileExtractWorker3.tar2_feederExtractWorker3.tar2_processExtractWorker3.verify_only
get_supported_crypto_algo()get_supported_hmac_algo()init_supported_hmac_and_crypto()launch_proc_with_pty()launch_scrypt()validate_compression_filter()
- Module contents
- qubesadmin.events package
- qubesadmin.tests package
- Subpackages
- qubesadmin.tests.backup package
- Submodules
- qubesadmin.tests.backup.backupcompatibility module
AppProxyMockFirewallMockVolumeTC_00_QubesXMLTC_10_BackupCompatibilityTC_10_BackupCompatibility.append_backup_stream()TC_10_BackupCompatibility.assertDirectoryExists()TC_10_BackupCompatibility.assertDom0Restored()TC_10_BackupCompatibility.assertFileExists()TC_10_BackupCompatibility.calculate_hmac()TC_10_BackupCompatibility.cleanup_tmpdir()TC_10_BackupCompatibility.create_appmenus()TC_10_BackupCompatibility.create_dom0_files()TC_10_BackupCompatibility.create_limited_tmpdir()TC_10_BackupCompatibility.create_private_img()TC_10_BackupCompatibility.create_v1_files()TC_10_BackupCompatibility.create_v3_backup()TC_10_BackupCompatibility.create_v4_backup()TC_10_BackupCompatibility.create_v4_files()TC_10_BackupCompatibility.create_volatile_img()TC_10_BackupCompatibility.create_whitelisted_appmenus()TC_10_BackupCompatibility.dom0_dirsTC_10_BackupCompatibility.dom0_filesTC_10_BackupCompatibility.fullpath()TC_10_BackupCompatibility.handle_v3_file()TC_10_BackupCompatibility.handle_v4_file()TC_10_BackupCompatibility.mock_appmenus()TC_10_BackupCompatibility.scrypt_encrypt()TC_10_BackupCompatibility.setup_expected_calls()TC_10_BackupCompatibility.storage_poolTC_10_BackupCompatibility.test_210_r2()TC_10_BackupCompatibility.test_220_r2_encrypted()TC_10_BackupCompatibility.test_230_r2_uncompressed()TC_10_BackupCompatibility.test_230_r4()TC_10_BackupCompatibility.test_230_r4_compressed()TC_10_BackupCompatibility.test_230_r4_custom_compression()TC_10_BackupCompatibility.test_230_r4_optional_compression()TC_10_BackupCompatibility.test_230_r4_uncommon_compression()TC_10_BackupCompatibility.test_230_r4_uncommon_compression_forced()TC_10_BackupCompatibility.test_300_r4_no_space()
TC_11_BackupCompatibilityIntoLVM
- Module contents
BackupTestCaseBackupTestCase.BackupErrorHandlerBackupTestCase.assertCorrectlyRestored()BackupTestCase.create_backup_vms()BackupTestCase.create_full_image()BackupTestCase.create_sparse()BackupTestCase.fill_image()BackupTestCase.make_vm_name()BackupTestCase.restore_backup()BackupTestCase.setUp()BackupTestCase.tearDown()BackupTestCase.vm_checksum()
- qubesadmin.tests.tools package
- Submodules
- qubesadmin.tests.tools.init module
TC_00_PropertyActionTC_01_SinglePropertyActionTC_01_SinglePropertyAction.test_000_help()TC_01_SinglePropertyAction.test_001_help_const()TC_01_SinglePropertyAction.test_100_default()TC_01_SinglePropertyAction.test_101_set_prop()TC_01_SinglePropertyAction.test_102_set_prop_dest()TC_01_SinglePropertyAction.test_103_set_prop_const()TC_01_SinglePropertyAction.test_104_set_prop_const_override()TC_01_SinglePropertyAction.test_105_set_prop_positional()
TC_02_QubesArgumentParser
- qubesadmin.tests.tools.qubes_prefs module
- qubesadmin.tests.tools.qvm_backup module
TC_00_qvm_backupTC_00_qvm_backup.test_000_write_backup_profile()TC_00_qvm_backup.test_001_write_backup_profile_include()TC_00_qvm_backup.test_002_write_backup_profile_exclude()TC_00_qvm_backup.test_003_write_backup_with_passphrase()TC_00_qvm_backup.test_004_write_backup_profile_no_compress()TC_00_qvm_backup.test_010_main_save_profile_cancel()TC_00_qvm_backup.test_011_main_save_profile_confirm()TC_00_qvm_backup.test_012_main_existing_profile()TC_00_qvm_backup.test_013_main_new_profile_vm()TC_00_qvm_backup.test_014_main_passphrase_file()TC_00_qvm_backup.test_015_conflicting_args()
- qubesadmin.tests.tools.qvm_backup_restore module
TC_00_qvm_backup_restoreTC_00_qvm_backup_restore.assertAppropriateLogging()TC_00_qvm_backup_restore.test_000_simple()TC_00_qvm_backup_restore.test_001_selected_vms()TC_00_qvm_backup_restore.test_010_handle_broken_no_problems()TC_00_qvm_backup_restore.test_011_handle_broken_missing_template()TC_00_qvm_backup_restore.test_012_handle_broken_missing_netvm()TC_00_qvm_backup_restore.test_100_restore_in_dispvm_parser()
- qubesadmin.tests.tools.qvm_check module
TC_00_qvm_checkTC_00_qvm_check.test_000_exists()TC_00_qvm_check.test_001_exists_multi()TC_00_qvm_check.test_002_exists_verbose()TC_00_qvm_check.test_003_exists_multi_verbose()TC_00_qvm_check.test_004_running_verbose()TC_00_qvm_check.test_005_running_multi_verbose()TC_00_qvm_check.test_006_running_multi_verbose2()TC_00_qvm_check.test_007_not_running_verbose()TC_00_qvm_check.test_008_paused()TC_00_qvm_check.test_009_paused_multi()TC_00_qvm_check.test_010_template()TC_00_qvm_check.test_011_template_multi()TC_00_qvm_check.test_012_networked()TC_00_qvm_check.test_013_networked_multi()TC_00_qvm_check.test_014_does_not_exist()TC_00_qvm_check.test_15_custom_argparse_error_handling()
- qubesadmin.tests.tools.qvm_clone module
- qubesadmin.tests.tools.qvm_create module
TC_00_qvm_createTC_00_qvm_create.test_000_just_appvm()TC_00_qvm_create.test_001_missing_vm()TC_00_qvm_create.test_002_custom_template()TC_00_qvm_create.test_003_properties()TC_00_qvm_create.test_004_pool()TC_00_qvm_create.test_005_pools()TC_00_qvm_create.test_005_root_copy_from()TC_00_qvm_create.test_006_root_move_from()TC_00_qvm_create.test_007_root_move_copy_both()TC_00_qvm_create.test_008_root_invalid_path()TC_00_qvm_create.test_009_help_classes()TC_00_qvm_create.test_011_standalonevm()TC_00_qvm_create.test_012_invalid_label()TC_00_qvm_create.test_013_root_copy_from_template_based()TC_00_qvm_create.test_014_standalone_shortcut()TC_00_qvm_create.test_015_disp_shortcut()
- qubesadmin.tests.tools.qvm_device module
TC_00_qvm_deviceTC_00_qvm_device.expected_device_call()TC_00_qvm_device.setUp()TC_00_qvm_device.test_000_list_all()TC_00_qvm_device.test_001_list_assigned_required()TC_00_qvm_device.test_002_list_attach()TC_00_qvm_device.test_003_list_device_classes()TC_00_qvm_device.test_004_list_pci_with_sbdf()TC_00_qvm_device.test_010_attach()TC_00_qvm_device.test_011_attach_options()TC_00_qvm_device.test_012_attach_invalid()TC_00_qvm_device.test_013_attach_invalid_device()TC_00_qvm_device.test_014_attach_invalid_backend()TC_00_qvm_device.test_020_detach()TC_00_qvm_device.test_021_detach_unknown()TC_00_qvm_device.test_022_detach_all()TC_00_qvm_device.test_030_assign()TC_00_qvm_device.test_031_assign_required()TC_00_qvm_device.test_032_assign_ask_and_options()TC_00_qvm_device.test_032b_assign_option_in_hint()TC_00_qvm_device.test_033_assign_invalid()TC_00_qvm_device.test_034_assign_invalid_device()TC_00_qvm_device.test_035_assign_invalid_backend()TC_00_qvm_device.test_036_assign_port()TC_00_qvm_device.test_037_assign_port_asterisk()TC_00_qvm_device.test_038_assign_device_from_port()TC_00_qvm_device.test_039_assign_explicit_device()TC_00_qvm_device.test_040_assign_explicit_device_device_id()TC_00_qvm_device.test_041_assign_denied_device()TC_00_qvm_device.test_050_unassign()TC_00_qvm_device.test_051_unassign_unknown()TC_00_qvm_device.test_052_unassign_port()TC_00_qvm_device.test_053_unassign_device_from_port()TC_00_qvm_device.test_054_unassign_explicit_device()TC_00_qvm_device.test_055_unassign_explicit_device_port()TC_00_qvm_device.test_056_unassign_explicit_device_id()TC_00_qvm_device.test_057_unassign_all()TC_00_qvm_device.test_060_device_info()
- qubesadmin.tests.tools.qvm_features module
- qubesadmin.tests.tools.qvm_firewall module
RuleNamespaceTC_00_RuleActionTC_00_RuleAction.setUp()TC_00_RuleAction.test_000_named_opts()TC_00_RuleAction.test_001_unnamed_opts()TC_00_RuleAction.test_002_unnamed_opts()TC_00_RuleAction.test_003_mixed_opts()TC_00_RuleAction.test_004_expire_absolute()TC_00_RuleAction.test_005_expire_relative()TC_00_RuleAction.test_006_dsthost_aliases()TC_00_RuleAction.test_007_none_errors()
TC_10_qvm_firewallTC_10_qvm_firewall.setUp()TC_10_qvm_firewall.test_000_list()TC_10_qvm_firewall.test_001_list_default()TC_10_qvm_firewall.test_002_list_expire()TC_10_qvm_firewall.test_002_list_raw()TC_10_qvm_firewall.test_003_list_raw_reload()TC_10_qvm_firewall.test_010_add_after()TC_10_qvm_firewall.test_011_add_before()TC_10_qvm_firewall.test_020_del_number()TC_10_qvm_firewall.test_021_del_rule()TC_10_qvm_firewall.test_030_reset()
- qubesadmin.tests.tools.qvm_kill module
- qubesadmin.tests.tools.qvm_ls module
TC_00_ColumnTC_100_SortTC_110_FilteringTC_110_Filtering.test_111_filter_class()TC_110_Filtering.test_112_filter_label()TC_110_Filtering.test_113_filter_template_source()TC_110_Filtering.test_114_filter_netvm_is()TC_110_Filtering.test_115_internal_servicevm_pending_updates()TC_110_Filtering.test_116_features()TC_110_Filtering.test_117_preferences()
TC_50_ListTC_50_List.test_100_list_with_status()TC_50_List.test_101_list_with_underscore()TC_50_List.test_102_list_selected()TC_50_List.test_102_raw_list()TC_50_List.test_103_list_all()TC_50_List.test_104_wildcards()TC_50_List.test_105_flags()TC_50_List.test_106_raw_data()TC_50_List.test_110_network_tree()
TC_70_TagsTC_80_Power_state_filtersTC_90_List_with_qubesd_callsTestApp
- qubesadmin.tests.tools.qvm_pause module
- qubesadmin.tests.tools.qvm_pool module
TC_00_qvm_poolTC_00_qvm_pool.test_000_list()TC_00_qvm_pool.test_010_drivers()TC_00_qvm_pool.test_020_add()TC_00_qvm_pool.test_021_add_multiple()TC_00_qvm_pool.test_030_remove()TC_00_qvm_pool.test_031_remove_multiple()TC_00_qvm_pool.test_040_info()TC_00_qvm_pool.test_050_set()TC_00_qvm_pool.test_051_set_invalid()
- qubesadmin.tests.tools.qvm_prefs module
TC_00_qvm_prefsTC_00_qvm_prefs.test_000_list()TC_00_qvm_prefs.test_001_no_vm()TC_00_qvm_prefs.test_002_set_property()TC_00_qvm_prefs.test_003_invalid_property()TC_00_qvm_prefs.test_004_set_invalid_property()TC_00_qvm_prefs.test_005_get_str()TC_00_qvm_prefs.test_006_get_vm()TC_00_qvm_prefs.test_007_get_vm_none()TC_00_qvm_prefs.test_008_set_vm_prop_none()TC_00_qvm_prefs.test_009_hide_default()
- qubesadmin.tests.tools.qvm_remove module
- qubesadmin.tests.tools.qvm_run module
TC_00_qvm_runTC_00_qvm_run.default_filter_esc()TC_00_qvm_run.setUp()TC_00_qvm_run.test_000_run_single()TC_00_qvm_run.test_000_run_single_auto_nogui_nodisplay()TC_00_qvm_run.test_000_run_single_auto_nogui_noguifeat()TC_00_qvm_run.test_000_run_single_auto_nogui_noguivm()TC_00_qvm_run.test_001_run_multiple()TC_00_qvm_run.test_002_color_output()TC_00_qvm_run.test_002_passio()TC_00_qvm_run.test_002_passio_service()TC_00_qvm_run.test_003_no_color_output()TC_00_qvm_run.test_004_no_filter_esc()TC_00_qvm_run.test_005_localcmd()TC_00_qvm_run.test_006_run_single_with_gui()TC_00_qvm_run.test_007_run_service_with_gui()TC_00_qvm_run.test_008_dispvm_remote()TC_00_qvm_run.test_009_dispvm_remote_specific()TC_00_qvm_run.test_010_dispvm_local()TC_00_qvm_run.test_011_dispvm_local_specific()TC_00_qvm_run.test_012_exclude()TC_00_qvm_run.test_013_no_autostart()TC_00_qvm_run.test_014_dispvm_local_gui()TC_00_qvm_run.test_015_dispvm_local_nogui()TC_00_qvm_run.test_015_dispvm_local_nogui_implicit()TC_00_qvm_run.test_016_run_single_windows()TC_00_qvm_run.test_020_run_exec_with_vmexec_not_supported()TC_00_qvm_run.test_020_run_exec_with_vmexec_supported()TC_00_qvm_run.test_021_paused_vm()TC_00_qvm_run.test_022_no_shell()TC_00_qvm_run.test_023_dispvm_no_shell()TC_00_qvm_run.test_024_no_shell_dashdash()TC_00_qvm_run.test_025_no_shell_double_dashdash()TC_00_qvm_run.test_026_no_shell_double_dashdash()TC_00_qvm_run.test_027_no_shell_dispvm()TC_00_qvm_run.test_028_argparse_bug_workaround()TC_00_qvm_run.test_029_command_is_dashdash()TC_00_qvm_run.test_030_no_shell_dispvm()TC_00_qvm_run.test_031_argparse_bug_workaround()TC_00_qvm_run.test_032_argparse_bug_workaround_unnamed_dispvm()TC_00_qvm_run.test_040_run_root_shell()TC_00_qvm_run.test_040_run_root_shell_too_old()TC_00_qvm_run.test_041_run_root_exec()TC_00_qvm_run.test_041_run_root_exec_not_supported()
- qubesadmin.tests.tools.qvm_service module
TC_00_qvm_serviceTC_00_qvm_service.test_000_list()TC_00_qvm_service.test_001_list_l()TC_00_qvm_service.test_002_enable()TC_00_qvm_service.test_003_enable_opt()TC_00_qvm_service.test_004_enable_opt_mixed()TC_00_qvm_service.test_004_enable_opt_mixed_broken()TC_00_qvm_service.test_005_disable()TC_00_qvm_service.test_006_disable_opt()TC_00_qvm_service.test_007_get()TC_00_qvm_service.test_008_del()TC_00_qvm_service.test_009_del_legacy()TC_00_qvm_service.test_010_set_invalid()
- qubesadmin.tests.tools.qvm_shutdown module
TC_00_qvm_shutdownTC_00_qvm_shutdown.test_000_with_vm()TC_00_qvm_shutdown.test_001_missing_vm()TC_00_qvm_shutdown.test_002_invalid_vm()TC_00_qvm_shutdown.test_003_not_running()TC_00_qvm_shutdown.test_004_multiple_vms()TC_00_qvm_shutdown.test_005_force()TC_00_qvm_shutdown.test_006_dry_run()TC_00_qvm_shutdown.test_010_wait()TC_00_qvm_shutdown.test_011_wait_retry_as_many_as_in_use()TC_00_qvm_shutdown.test_011_wait_retry_once_fail()TC_00_qvm_shutdown.test_011_wait_retry_once_succeed()TC_00_qvm_shutdown.test_011_wait_retry_simple()TC_00_qvm_shutdown.test_012_wait_all()TC_00_qvm_shutdown.test_013_wait_all_shutdown_fail()TC_00_qvm_shutdown.test_014_timeout_deprecated_means_wait()TC_00_qvm_shutdown.test_015_wait_all_kill_timeout()TC_00_qvm_shutdown.test_016_all_exclude_noforce()TC_00_qvm_shutdown.test_016_wait_kill_exception()TC_00_qvm_shutdown.test_017_all_exclude_force_explicit()
- qubesadmin.tests.tools.qvm_start module
TC_00_qvm_startTC_00_qvm_start.test_000_with_vm()TC_00_qvm_start.test_001_missing_vm()TC_00_qvm_start.test_002_invalid_vm()TC_00_qvm_start.test_003_already_running()TC_00_qvm_start.test_010_drive_cdrom()TC_00_qvm_start.test_011_drive_disk()TC_00_qvm_start.test_012_drive_disk()TC_00_qvm_start.test_013_drive_loop_local()TC_00_qvm_start.test_014_drive_loop_remote()TC_00_qvm_start.test_015_drive_failed_start()TC_00_qvm_start.test_016_drive_failed_attach()
- qubesadmin.tests.tools.qvm_start_daemon module
TC_00_qvm_start_guiTC_00_qvm_start_gui.mock_coroutine()TC_00_qvm_start_gui.run_common_args()TC_00_qvm_start_gui.setUp()TC_00_qvm_start_gui.setup_common_args()TC_00_qvm_start_gui.test_000_kde_args()TC_00_qvm_start_gui.test_010_common_args()TC_00_qvm_start_gui.test_011_common_args_debug()TC_00_qvm_start_gui.test_012_common_args_rpc_clipboard()TC_00_qvm_start_gui.test_013_common_args_guid_config()TC_00_qvm_start_gui.test_020_start_gui_for_vm()TC_00_qvm_start_gui.test_021_start_gui_for_vm_hvm()TC_00_qvm_start_gui.test_022_start_gui_for_vm_hvm_stubdom()TC_00_qvm_start_gui.test_030_start_gui_for_stubdomain()TC_00_qvm_start_gui.test_031_start_gui_for_stubdomain_forced()TC_00_qvm_start_gui.test_038_start_gui_skip_preload()TC_00_qvm_start_gui.test_039_start_gui_for_preload()TC_00_qvm_start_gui.test_040_start_gui()TC_00_qvm_start_gui.test_041_start_gui_running()TC_00_qvm_start_gui.test_042_start_gui_pvh()TC_00_qvm_start_gui.test_050_get_monitor_layout1()TC_00_qvm_start_gui.test_051_get_monitor_layout_multiple()TC_00_qvm_start_gui.test_052_get_monitor_layout_hidpi1()TC_00_qvm_start_gui.test_052_get_monitor_layout_hidpi2()TC_00_qvm_start_gui.test_052_get_monitor_layout_hidpi3()TC_00_qvm_start_gui.test_060_send_monitor_layout()TC_00_qvm_start_gui.test_061_send_monitor_layout_exclude()TC_00_qvm_start_gui.test_062_send_monitor_layout_not_running()TC_00_qvm_start_gui.test_063_send_monitor_layout_signal_existing()TC_00_qvm_start_gui.test_070_send_monitor_layout_all()TC_00_qvm_start_gui.test_071_validators()TC_00_qvm_start_gui.test_072_feature_validation()
- qubesadmin.tests.tools.qvm_tags module
- qubesadmin.tests.tools.qvm_template_postprocess module
QubesLocalMockTC_00_qvm_template_postprocessTC_00_qvm_template_postprocess.add_new_vm_side_effect()TC_00_qvm_template_postprocess.setUp()TC_00_qvm_template_postprocess.tearDown()TC_00_qvm_template_postprocess.test_000_import_root_img_raw()TC_00_qvm_template_postprocess.test_001_import_root_img_tar()TC_00_qvm_template_postprocess.test_001_import_root_img_tar_pre_mar_2024()TC_00_qvm_template_postprocess.test_002_import_root_img_no_overwrite()TC_00_qvm_template_postprocess.test_005_reset_private_img()TC_00_qvm_template_postprocess.test_010_import_appmenus()TC_00_qvm_template_postprocess.test_011_import_appmenus_as_root()TC_00_qvm_template_postprocess.test_012_import_appmenus_missing_user()TC_00_qvm_template_postprocess.test_020_post_install()TC_00_qvm_template_postprocess.test_021_post_install_reinstall()TC_00_qvm_template_postprocess.test_022_post_install_skip_start()TC_00_qvm_template_postprocess.test_030_pre_remove()TC_00_qvm_template_postprocess.test_031_pre_remove_existing_appvm()TC_00_qvm_template_postprocess.test_040_missing_really()TC_00_qvm_template_postprocess.test_050_template_config()TC_00_qvm_template_postprocess.test_051_template_config_invalid()TC_00_qvm_template_postprocess.test_052_template_config_virt_mode_pv()TC_00_qvm_template_postprocess.wait_for_shutdown()
- qubesadmin.tests.tools.qvm_unpause module
- qubesadmin.tests.tools.qvm_volume module
TC_00_qvm_volumeTC_00_qvm_volume.setup_expected_calls_for_list()TC_00_qvm_volume.test_000_list()TC_00_qvm_volume.test_001_list_domain()TC_00_qvm_volume.test_002_list_domain_pool()TC_00_qvm_volume.test_003_list_pool()TC_00_qvm_volume.test_004_list_multiple_domains()TC_00_qvm_volume.test_005_list_default_action()TC_00_qvm_volume.test_010_extend()TC_00_qvm_volume.test_011_extend_error()TC_00_qvm_volume.test_012_extend_deny_shrink()TC_00_qvm_volume.test_013_resize_force_shrink()TC_00_qvm_volume.test_020_revert()TC_00_qvm_volume.test_021_revert_error()TC_00_qvm_volume.test_022_revert_no_snapshots()TC_00_qvm_volume.test_023_revert_specific()TC_00_qvm_volume.test_030_set_revisions_to_keep()TC_00_qvm_volume.test_031_set_rw()TC_00_qvm_volume.test_032_set_invalid()TC_00_qvm_volume.test_033_set_ephemeral()TC_00_qvm_volume.test_040_info()TC_00_qvm_volume.test_041_info_no_revisions()TC_00_qvm_volume.test_042_info_single_prop()TC_00_qvm_volume.test_043_info_revisions_only()TC_00_qvm_volume.test_044_info_no_ephemeral()TC_00_qvm_volume.test_050_import_file()TC_00_qvm_volume.test_051_import_stdin()TC_00_qvm_volume.test_052_import_file_size()TC_00_qvm_volume.test_053_import_file_matching_size()TC_00_qvm_volume.test_053_import_file_noresize()
- Module contents
- qubesadmin.tests.vm package
- Submodules
- qubesadmin.tests.vm.actions module
TC_00_ActionsTC_00_Actions.test_000_start()TC_00_Actions.test_001_shutdown()TC_00_Actions.test_001_shutdown_force()TC_00_Actions.test_001_shutdown_force_wait()TC_00_Actions.test_001_shutdown_wait()TC_00_Actions.test_002_kill()TC_00_Actions.test_003_pause()TC_00_Actions.test_004_unpause()TC_00_Actions.test_005_suspend()TC_00_Actions.test_006_resume()TC_00_Actions.test_010_run_linux()TC_00_Actions.test_011_run_windows()TC_00_Actions.test_012_run_linux_root()TC_00_Actions.test_013_run_linux_root_vmrootshell()TC_00_Actions.test_015_run_with_args_shell()TC_00_Actions.test_016_run_with_args_exec()
- qubesadmin.tests.vm.dispvm module
- qubesadmin.tests.vm.properties module
TC_00_PropertiesTC_00_Properties.test_000_list()TC_00_Properties.test_001_get_str()TC_00_Properties.test_002_get_int()TC_00_Properties.test_003_get_bool()TC_00_Properties.test_004_get_vm()TC_00_Properties.test_005_get_none_vm()TC_00_Properties.test_006_get_none_bool()TC_00_Properties.test_007_get_none_int()TC_00_Properties.test_008_get_none_str()TC_00_Properties.test_010_get_default()TC_00_Properties.test_011_get_default()TC_00_Properties.test_012_get_invalid()TC_00_Properties.test_020_set_str()TC_00_Properties.test_021_set_int()TC_00_Properties.test_022_set_bool()TC_00_Properties.test_023_set_vm()TC_00_Properties.test_024_set_none()TC_00_Properties.test_030_reset()TC_00_Properties.test_031_reset()TC_00_Properties.test_040_get_default()TC_00_Properties.test_041_get_default_int()TC_00_Properties.test_042_get_default_none()TC_00_Properties.test_050_get_all()TC_00_Properties.test_051_get_all_fallback()
TC_01_SpecialCasesTC_01_SpecialCases.test_000_get_name()TC_01_SpecialCases.test_001_set_name()TC_01_SpecialCases.test_010_power_state_running()TC_01_SpecialCases.test_011_power_state_paused()TC_01_SpecialCases.test_012_power_state_halted()TC_01_SpecialCases.test_012_power_state_transient()TC_01_SpecialCases.test_013_power_state_suspended()TC_01_SpecialCases.test_015_mem()TC_01_SpecialCases.test_020_klass()
- qubesadmin.tests.vm.storage module
- Module contents
- qubesadmin.tests.backup package
- Submodules
- qubesadmin.tests.app module
TC_00_VMCollectionTC_00_VMCollection.test_000_list()TC_00_VMCollection.test_001_getitem()TC_00_VMCollection.test_002_in()TC_00_VMCollection.test_003_iter()TC_00_VMCollection.test_004_delitem()TC_00_VMCollection.test_005_keys()TC_00_VMCollection.test_006_values()TC_00_VMCollection.test_007_getitem_blind_mode()TC_00_VMCollection.test_008_in_blind_mode()TC_00_VMCollection.test_009_getitem_cache_class()TC_00_VMCollection.test_010_getitem_cache_power_state()TC_00_VMCollection.test_011_getitem_non_cache_power_state()TC_00_VMCollection.test_012_getitem_cached_object()
TC_10_QubesBaseTC_10_QubesBase.clone_setup_common_calls()TC_10_QubesBase.setUp()TC_10_QubesBase.tearDown()TC_10_QubesBase.test_010_new_simple()TC_10_QubesBase.test_011_new_template()TC_10_QubesBase.test_012_new_template_based()TC_10_QubesBase.test_013_new_objects_params()TC_10_QubesBase.test_014_new_pool()TC_10_QubesBase.test_015_new_pools()TC_10_QubesBase.test_016_new_template_based_default()TC_10_QubesBase.test_020_get_label()TC_10_QubesBase.test_021_get_nonexistant_label()TC_10_QubesBase.test_030_clone()TC_10_QubesBase.test_031_clone_object()TC_10_QubesBase.test_032_clone_pool()TC_10_QubesBase.test_033_clone_pools()TC_10_QubesBase.test_034_clone_class_change()TC_10_QubesBase.test_035_clone_fail()TC_10_QubesBase.test_036_clone_ignore_errors_prop()TC_10_QubesBase.test_037_clone_ignore_errors_feature()TC_10_QubesBase.test_038_clone_ignore_errors_tag()TC_10_QubesBase.test_039_clone_ignore_errors_firewall()TC_10_QubesBase.test_040_clone_ignore_errors_storage()TC_10_QubesBase.test_041_clone_fail_storage()TC_10_QubesBase.test_042_clone_nondefault_pool()TC_10_QubesBase.test_043_clone_devices()TC_10_QubesBase.test_044_clone_devices_fail()TC_10_QubesBase.test_045_clone_notes_fail()TC_10_QubesBase.test_050_automatic_reset_cache()TC_10_QubesBase.test_051_space_in_vmname()
TC_20_QubesLocalTC_20_QubesLocal.get_request()TC_20_QubesLocal.listen_and_send()TC_20_QubesLocal.setUp()TC_20_QubesLocal.tearDown()TC_20_QubesLocal.test_000_qubesd_call()TC_20_QubesLocal.test_001_qubesd_call_none_arg()TC_20_QubesLocal.test_002_qubesd_call_none_payload()TC_20_QubesLocal.test_003_qubesd_call_payload_stream()TC_20_QubesLocal.test_004_qubesd_call_payload_stream_proc()TC_20_QubesLocal.test_005_qubesd_call_payload_stream_with_prefix()TC_20_QubesLocal.test_010_run_service()TC_20_QubesLocal.test_011_run_service_filter_esc()TC_20_QubesLocal.test_012_run_service_user()TC_20_QubesLocal.test_013_run_service_default_target()TC_20_QubesLocal.test_014_run_service_prefix_data()
TC_30_QubesRemoteTC_30_QubesRemote.setUp()TC_30_QubesRemote.set_proc_stdout()TC_30_QubesRemote.tearDown()TC_30_QubesRemote.test_000_qubesd_call()TC_30_QubesRemote.test_001_qubesd_call_none_arg()TC_30_QubesRemote.test_002_qubesd_call_none_payload()TC_30_QubesRemote.test_003_qubesd_call_payload_stream()TC_30_QubesRemote.test_004_qubesd_call_payload_stream_with_prefix()TC_30_QubesRemote.test_010_run_service()TC_30_QubesRemote.test_011_run_service_filter_esc()TC_30_QubesRemote.test_012_run_service_user()TC_30_QubesRemote.test_013_run_service_default_target()TC_30_QubesRemote.test_014_run_service_no_autostart1()TC_30_QubesRemote.test_015_run_service_no_autostart2()TC_30_QubesRemote.test_016_run_service_prefix_data()
- qubesadmin.tests.devices module
TC_00_DeviceCollectionTC_00_DeviceCollection.setUp()TC_00_DeviceCollection.test_000_available()TC_00_DeviceCollection.test_001_available_desc()TC_00_DeviceCollection.test_002_available_options()TC_00_DeviceCollection.test_010_getitem()TC_00_DeviceCollection.test_011_getitem_missing()TC_00_DeviceCollection.test_020_attach()TC_00_DeviceCollection.test_021_attach_options()TC_00_DeviceCollection.test_022_attach_required()TC_00_DeviceCollection.test_023_attach_required_options()TC_00_DeviceCollection.test_030_detach()TC_00_DeviceCollection.test_040_dedicated()TC_00_DeviceCollection.test_041_assignments_options()TC_00_DeviceCollection.test_042_assignments_cache()TC_00_DeviceCollection.test_050_required()TC_00_DeviceCollection.test_060_attached()TC_00_DeviceCollection.test_070_update_assignment_required()TC_00_DeviceCollection.test_071_update_assignment_ask()TC_00_DeviceCollection.test_072_update_assignment_auto()TC_00_DeviceCollection.test_073_list()TC_00_DeviceCollection.test_080_add_denied_device()TC_00_DeviceCollection.test_081_add_denied_device_empty()TC_00_DeviceCollection.test_082_add_denied_device_multiple()TC_00_DeviceCollection.test_083_allow_device()TC_00_DeviceCollection.test_084_allow_device_empty()TC_00_DeviceCollection.test_085_allow_device_multiple()TC_00_DeviceCollection.test_100_cache_invalidate()
- qubesadmin.tests.errors module
- qubesadmin.tests.events module
TC_00_EventsTC_00_Events.mock_coroutine()TC_00_Events.mock_get_events_reader()TC_00_Events.mock_open_unix_connection()TC_00_Events.read_all()TC_00_Events.send_events()TC_00_Events.setUp()TC_00_Events.test_000_handler_specific()TC_00_Events.test_001_handler_glob()TC_00_Events.test_002_handler_glob_partial()TC_00_Events.test_003_handler_error()TC_00_Events.test_010_listen_for_events()TC_00_Events.test_020_get_events_reader_local()TC_00_Events.test_021_get_events_reader_local_vm()TC_00_Events.test_022_get_events_reader_remote()TC_00_Events.test_023_get_events_reader_remote_vm()TC_00_Events.test_030_events_device()
- qubesadmin.tests.features module
- qubesadmin.tests.firewall module
TC_00_RuleChoiceTC_01_ActionTC_02_DstHostTC_02_DstHost.test_000_hostname()TC_02_DstHost.test_001_ipv4()TC_02_DstHost.test_002_ipv4_prefixlen()TC_02_DstHost.test_003_ipv4_parse_prefixlen()TC_02_DstHost.test_004_ipv4_invalid_prefix()TC_02_DstHost.test_005_ipv4_reject_shortened()TC_02_DstHost.test_006_ipv4_invalid_addr()TC_02_DstHost.test_007_ipv4_invalid_network()TC_02_DstHost.test_010_ipv6()TC_02_DstHost.test_011_ipv6_prefixlen()TC_02_DstHost.test_012_ipv6_parse_prefixlen()TC_02_DstHost.test_013_ipv6_invalid_prefix()TC_02_DstHost.test_014_ipv6_invalid_addr()TC_02_DstHost.test_015_ipv6_invalid_network()TC_02_DstHost.test_020_invalid_hostname()
TC_02_ProtoTC_03_DstPortsTC_04_IcmpTypeTC_05_SpecialTargetTC_06_ExpireTC_07_CommentTC_10_RuleTC_11_FirewallTestOption
- qubesadmin.tests.label module
- qubesadmin.tests.storage module
TestPoolTestPoolVolumeTestPoolVolume.expect_info()TestPoolVolume.setUp()TestPoolVolume.test_000_qubesd_call()TestPoolVolume.test_001_fetch_info()TestPoolVolume.test_010_pool()TestPoolVolume.test_011_vid()TestPoolVolume.test_021_revisions()TestPoolVolume.test_022_revisions_empty()TestPoolVolume.test_030_resize()TestPoolVolume.test_031_revert()TestPoolVolume.test_040_import_data()TestPoolVolume.test_050_clone()TestPoolVolume.test_050_clone_wrong_volume()
TestVMVolumeTestVMVolume.expect_info()TestVMVolume.setUp()TestVMVolume.test_000_qubesd_call()TestVMVolume.test_001_fetch_info()TestVMVolume.test_010_pool()TestVMVolume.test_011_vid()TestVMVolume.test_012_size()TestVMVolume.test_013_usage()TestVMVolume.test_014_rw()TestVMVolume.test_015_snap_on_start()TestVMVolume.test_016_save_on_stop()TestVMVolume.test_017_source_none()TestVMVolume.test_018_source()TestVMVolume.test_020_revisions_to_keep()TestVMVolume.test_021_revisions()TestVMVolume.test_022_revisions_empty()TestVMVolume.test_030_resize()TestVMVolume.test_031_revert()TestVMVolume.test_040_import_data()TestVMVolume.test_050_clone()
- qubesadmin.tests.tags module
TC_00_TagsTC_00_Tags.setUp()TC_00_Tags.test_000_list()TC_00_Tags.test_010_get()TC_00_Tags.test_011_get_missing()TC_00_Tags.test_020_set()TC_00_Tags.test_030_update()TC_00_Tags.test_031_update_from_other()TC_00_Tags.test_040_remove()TC_00_Tags.test_040_remove_missing()TC_00_Tags.test_050_discard()TC_00_Tags.test_051_discard_missing()
- Module contents
- Subpackages
- qubesadmin.tools package
- Submodules
- qubesadmin.tools.dochelpers module
- qubesadmin.tools.qubes_prefs module
- qubesadmin.tools.qvm_backup module
- qubesadmin.tools.qvm_backup_restore module
- qubesadmin.tools.qvm_check module
- qubesadmin.tools.qvm_clone module
- qubesadmin.tools.qvm_create module
- qubesadmin.tools.qvm_device module
- qubesadmin.tools.qvm_features module
- qubesadmin.tools.qvm_firewall module
- qubesadmin.tools.qvm_kill module
- qubesadmin.tools.qvm_ls module
- qubesadmin.tools.qvm_pause module
- qubesadmin.tools.qvm_pool module
- qubesadmin.tools.qvm_prefs module
- qubesadmin.tools.qvm_remove module
- qubesadmin.tools.qvm_run module
- qubesadmin.tools.qvm_service module
- qubesadmin.tools.qvm_shutdown module
- qubesadmin.tools.qvm_start module
- qubesadmin.tools.qvm_start_daemon module
DAEMONLauncherDAEMONLauncher.cleanup_guid()DAEMONLauncher.cleanup_pacat_process()DAEMONLauncher.common_guid_args()DAEMONLauncher.guid_config_file()DAEMONLauncher.guid_pidfile()DAEMONLauncher.is_watched()DAEMONLauncher.kde_guid_args()DAEMONLauncher.on_connection_established()DAEMONLauncher.on_domain_spawn()DAEMONLauncher.on_domain_start()DAEMONLauncher.on_domain_stopped()DAEMONLauncher.on_property_audiovm_set()DAEMONLauncher.on_property_preload_set()DAEMONLauncher.pacat_domid()DAEMONLauncher.pacat_pidfile()DAEMONLauncher.register_events()DAEMONLauncher.send_monitor_layout()DAEMONLauncher.send_monitor_layout_all()DAEMONLauncher.start_audio()DAEMONLauncher.start_audio_for_vm()DAEMONLauncher.start_gui()DAEMONLauncher.start_gui_for_stubdomain()DAEMONLauncher.start_gui_for_vm()DAEMONLauncher.write_guid_config()
KeyboardLayoutXWatcherescape_config_string()get_monitor_layout()main()retrieve_gui_daemon_options()serialize_gui_daemon_options()validator_color()validator_key_sequence()validator_trayicon_mode()
- qubesadmin.tools.qvm_tags module
- qubesadmin.tools.qvm_template module
- qubesadmin.tools.qvm_template_postprocess module
- qubesadmin.tools.qvm_unpause module
- qubesadmin.tools.qvm_volume module
- Module contents
- qubesadmin.vm package
- Module contents
DispVMDispVMWrapperQubesVMQubesVM.appvmsQubesVM.connected_vmsQubesVM.derived_vmsQubesVM.devicesQubesVM.featuresQubesVM.firewallQubesVM.force_shutdown()QubesVM.get_disk_utilization()QubesVM.get_mem()QubesVM.get_notes()QubesVM.get_power_state()QubesVM.is_halted()QubesVM.is_networked()QubesVM.is_paused()QubesVM.is_running()QubesVM.is_suspended()QubesVM.kill()QubesVM.klassQubesVM.logQubesVM.nameQubesVM.pause()QubesVM.prepare_input_for_vmshell()QubesVM.resume()QubesVM.run()QubesVM.run_service()QubesVM.run_service_for_stdio()QubesVM.run_with_args()QubesVM.set_notes()QubesVM.shutdown()QubesVM.start()QubesVM.suspend()QubesVM.tagsQubesVM.unpause()QubesVM.volumes
- Module contents
Submodules¶
qubesadmin.app module¶
Main Qubes() class and related classes.
- class qubesadmin.app.QubesBase[source]¶
Bases:
PropertyHolderMain Qubes application.
This is a base abstract class, don’t use it directly. Use specialized class in py:class:qubesadmin.Qubes instead, which points at
QubesLocalorQubesRemote.- add_new_vm(cls: str | type[QubesVM], name: str, label: str, template: str | QubesVM | None = None, pool: str | None = None, pools: dict | None = None) QubesVM[source]¶
Create new Virtual Machine
Example usage with custom storage pools:
>>> app = qubesadmin.Qubes() >>> pools = {'private': 'external'} >>> vm = app.add_new_vm('AppVM', 'my-new-vm', 'red', >>> 'my-template', pools=pools) >>> vm.netvm = app.domains['sys-whonix']
- Parameters:
cls (str) – name of VM class (AppVM, TemplateVM etc)
name (str) – name of VM
label (str) – label color for new VM
template (str) – template to use (if apply for given VM class), can be also VM object; use None for default value
pool (str) – storage pool to use instead of default one
pools (dict) – storage pool for specific volumes
:return new VM object
- add_pool(name: str, driver: str, **kwargs) None[source]¶
Add a storage pool to config
- Parameters:
name – name of storage pool to create
driver – driver to use, see
pool_drivers()for available driverskwargs – configuration parameters for storage pool, see
pool_driver_parameters()for a list
- blind_mode: bool = False¶
do not check for object (VM, label etc) existence before really needed
- cache_enabled: bool = False¶
cache retrieved properties values
- clone_vm(src_vm: str | QubesVM, new_name: str, new_cls: str | None = None, *, pool: str | None = None, pools: dict | None = None, ignore_errors: bool = False, ignore_volumes: list | None = None, ignore_devices: bool = False) QubesVM[source]¶
Clone Virtual Machine
Example usage with custom storage pools:
>>> app = qubesadmin.Qubes() >>> pools = {'private': 'external'} >>> src_vm = app.domains['personal'] >>> vm = app.clone_vm(src_vm, 'my-new-vm', pools=pools) >>> vm.label = app.labels['green']
- Parameters:
src_vm (QubesVM or str) – source VM
new_name (str) – name of new VM
new_cls (str) – name of VM class (AppVM, TemplateVM etc) - use None to copy it from src_vm
pool (str) – storage pool to use instead of default one
pools (dict) – storage pool for specific volumes
ignore_errors (bool) – should errors on meta-data setting be only logged, or abort the whole operation?
ignore_volumes (list) – do not clone volumes on this list, like ‘private’ or ‘root’
ignore_devices (bool) – if True, do not copy device assignments
:return new VM object
- domains: VMCollection¶
domains (VMs) collection
- get_label(label: str | int) Label[source]¶
Get label as identified by index or name
- Throws QubesLabelNotFoundError:
when label is not found
- static get_vm_class(clsname: str) str[source]¶
Find the class for a domain.
Compatibility function, client tools use str to identify domain classes.
- Parameters:
clsname (str) – name of the class
- Return str:
class
- labels: WrapperObjectsCollection[Label]¶
labels collection
- property local_name: str¶
Get localhost name
- log: Logger¶
logger
- pool_driver_parameters(driver: str) list[str][source]¶
Parameters to initialize storage pool using given driver
- property pool_drivers: Iterable[str]¶
Available storage pool drivers
- pools: WrapperObjectsCollection[Pool]¶
storage pools
- qubesd_call(dest: str | None, method: str, arg: str | None = None, payload: bytes | None = None, payload_stream: IO | None = None) bytes[source]¶
Execute Admin API method.
If payload and payload_stream are both specified, they will be sent in that order.
- Parameters:
dest – Destination VM name
method – Full API method name (‘admin…’)
arg – Method argument (if any)
payload – Payload send to the method
payload_stream – file-like object to read payload from
- Returns:
Data returned by qubesd (string)
Warning
payload_stream will get closed by this function
- qubesd_connection_type: Literal['socket', 'qrexec']¶
type of qubesd connection: either ‘socket’ or ‘qrexec’
- run_service(dest: str, service: str, user: str | None = None, *, filter_esc: bool = False, localcmd: str | None = None, wait: bool = True, autostart: bool = True, prefix_data: bytes | None = None, **kwargs) Popen[source]¶
Run qrexec service in a given destination
kwargs are passed verbatim to
subprocess.Popen().- Parameters:
dest (str) – Destination - may be a VM name or empty string for default (for a given service)
service (str) – service name
filter_esc (bool) – filter escape sequences to protect terminal emulator
user (str) – username to run service as
localcmd (str) – Command to connect stdin/stdout to
wait (bool) – Wait service run
autostart (bool) – Automatically start the target VM
- Return type:
subprocess.Popen
- class qubesadmin.app.QubesLocal[source]¶
Bases:
QubesBaseApplication object communicating through local socket.
Used when running in dom0.
- qubesd_call(dest: str | None, method: str, arg: str | None = None, payload: bytes | None = None, payload_stream: IO | None = None) bytes[source]¶
Execute Admin API method.
If payload and payload_stream are both specified, they will be sent in that order.
- Parameters:
dest – Destination VM name
method – Full API method name (‘admin…’)
arg – Method argument (if any)
payload – Payload send to the method
payload_stream – file-like object to read payload from
- Returns:
Data returned by qubesd (string)
Warning
payload_stream will get closed by this function
- qubesd_connection_type = 'socket'¶
type of qubesd connection: either ‘socket’ or ‘qrexec’
- run_service(dest: str, service: str, user: str | None = None, *, filter_esc: bool = False, localcmd: str | None = None, wait: bool = True, autostart: bool = True, prefix_data: bytes | None = None, **kwargs) Popen[source]¶
Run qrexec service in a given destination
- Parameters:
dest (str) – Destination - may be a VM name or empty string for default (for a given service)
service (str) – service name
filter_esc (bool) – filter escape sequences to protect terminal emulator
user (str) – username to run service as
localcmd (str) – Command to connect stdin/stdout to
wait (bool) – wait for remote process to finish
- Return type:
subprocess.Popen
- class qubesadmin.app.QubesRemote[source]¶
Bases:
QubesBaseApplication object communicating through qrexec services.
Used when running in VM.
- qubesd_call(dest: str | None, method: str, arg: str | None = None, payload: bytes | None = None, payload_stream: IO | None = None) bytes[source]¶
Execute Admin API method.
If payload and payload_stream are both specified, they will be sent in that order.
- Parameters:
dest – Destination VM name
method – Full API method name (‘admin…’)
arg – Method argument (if any)
payload – Payload send to the method
payload_stream – file-like object to read payload from
- Returns:
Data returned by qubesd (string)
Warning
payload_stream will get closed by this function
- qubesd_connection_type = 'qrexec'¶
type of qubesd connection: either ‘socket’ or ‘qrexec’
- run_service(dest: str, service: str, user: str | None = None, *, filter_esc: bool = False, localcmd: str | None = None, wait: bool = True, autostart: bool = True, prefix_data: bytes | None = None, **kwargs) Popen[source]¶
Run qrexec service in a given destination
- Parameters:
dest (str) – Destination - may be a VM name or empty string for default (for a given service)
service (str) – service name
filter_esc (bool) – filter escape sequences to protect terminal emulator
user (str) – username to run service as
localcmd (str) – Command to connect stdin/stdout to
wait (bool) – wait for process to finish
- Return type:
subprocess.Popen
- class qubesadmin.app.VMCollection(app: QubesBase)[source]¶
Bases:
objectCollection of VMs objects
- T = ~T¶
- clear_cache(invalidate_name: str | None = None) None[source]¶
Clear cached list of VMs If invalidate_name is given, remove that object from cache explicitly too.
qubesadmin.base module¶
Base classes for managed objects
- class qubesadmin.base.PropertyHolder(app: QubesBase, method_prefix: str, method_dest: str)[source]¶
Bases:
objectA base class for object having properties retrievable using mgmt API.
Warning: each (non-private) local attribute needs to be defined at class level, even if initialized in __init__; otherwise will be treated as property retrievable using mgmt call.
- clone_properties(src: PropertyHolder, proplist: list[str] | None = None) None[source]¶
Clone properties from other object.
- Parameters:
src (PropertyHolder) – source object
proplist (list) – list of properties (
Noneor omit for all properties)
- property_get_default(item: str) Any[source]¶
Get default property value, regardless of the current value
- Parameters:
item (str) – name of property
- Returns:
default value
- property_is_default(item: str) bool[source]¶
Check if given property have default value
- Parameters:
item (str) – name of property
- Returns:
bool
- property_list() list[str][source]¶
List available properties (their names).
- Returns:
list of strings
- qubesd_call(dest: str | None, method: str, arg: str | None = None, payload: bytes | None = None, payload_stream: BinaryIO | None = None) bytes[source]¶
Call into qubesd using appropriate mechanism. This method should be defined by a subclass.
Only one of payload and payload_stream can be specified.
- Parameters:
dest – Destination VM name
method – Full API method name (‘admin…’)
arg – Method argument (if any)
payload – Payload send to the method
payload_stream – file-like object to read payload from
- Returns:
Data returned by qubesd (string)
- class qubesadmin.base.WrapperObjectsCollection(app: QubesBase, list_method: str, object_class: type[T])[source]¶
Bases:
Generic[T]Collection of simple named objects
- clear_cache(invalidate_name: int | str | None = None) None[source]¶
Clear cached list of names. If invalidate_name is given, remove that object from cache explicitly too.
qubesadmin.config module¶
Configuration variables/constants
- qubesadmin.config.QUBESD_SOCKET = '/var/run/qubesd.sock'¶
path to qubesd socket
qubesadmin.devices module¶
API for various types of devices.
Main concept is that some domain main expose (potentially multiple) devices, which can be attached to other domains. Devices can be of different classes (like ‘pci’, ‘usb’, etc.). Each device class is implemented by an extension.
Devices are identified by pair of (backend domain, port_id), where port_id
is str.
- class qubesadmin.devices.DeviceCollection(vm: QubesVM, class_: str)[source]¶
Bases:
objectBag for devices.
Used as default value for
DeviceManager.__missing__()factory.- Parameters:
vm – VM for which we manage devices
class – device class
- assign(assignment: DeviceAssignment) None[source]¶
Assign device to domain (add to
qubes.xml).- Parameters:
assignment (DeviceAssignment) – device object
- attach(assignment: DeviceAssignment) None[source]¶
Attach (add) device to domain.
- Parameters:
assignment (DeviceAssignment) – device object
- detach(assignment: DeviceAssignment) None[source]¶
Detach (remove) device from domain.
- Parameters:
assignment (DeviceAssignment) – device to detach (obtained from
assignments())
- get_assigned_devices(required_only: bool = False) Iterable[DeviceAssignment][source]¶
Devices assigned to this vm (included in
qubes.xml).Safe to access before libvirt bootstrap.
- get_attached_devices() Iterable[DeviceAssignment][source]¶
List devices which are attached to this vm.
- get_dedicated_devices() Iterable[DeviceAssignment][source]¶
List devices which are attached or assigned to this vm.
- unassign(assignment: DeviceAssignment) None[source]¶
Unassign device from domain (remove from
qubes.xml).- Parameters:
assignment (DeviceAssignment) – device to unassign (obtained from
assignments())
- update_assignment(device: VirtualDevice, required: AssignmentMode) None[source]¶
Update assignment of already attached device.
- Parameters:
device (VirtualDevice) – device for which change required flag
required (bool) – new assignment: None -> unassign device from qube False -> device will be auto-attached to qube True -> device is required to start qube
- class qubesadmin.devices.DeviceManager(vm: QubesVM)[source]¶
Bases:
dictDevice manager that hold all devices by their classes.
- Parameters:
vm – VM for which we manage devices
- allow(*interfaces: Iterable[DeviceInterface]) None[source]¶
Remove given interfaces from denied list.
qubesadmin.exc module¶
Qubes OS exception hierarchy
- exception qubesadmin.exc.BackupAlreadyRunningError(message_format: str, *args, **kwargs)[source]¶
Bases:
QubesExceptionThrown at user when they try to run the same backup twice at the same time
- exception qubesadmin.exc.BackupCancelledError(message_format: str, *args, **kwargs)[source]¶
Bases:
QubesExceptionThrown at user when backup was manually cancelled
- exception qubesadmin.exc.BackupRestoreError(msg: str, backup_log: bytes | None = None)[source]¶
Bases:
QubesExceptionRestoring a backup failed
- exception qubesadmin.exc.DeviceAlreadyAssigned(message_format: str, *args, **kwargs)[source]¶
Bases:
QubesException,KeyErrorTrying to assign already assigned device.
- exception qubesadmin.exc.DeviceAlreadyAttached(message_format: str, *args, **kwargs)[source]¶
Bases:
QubesException,KeyErrorTrying to attach already attached device.
- exception qubesadmin.exc.DeviceNotAssigned(message_format: str, *args, **kwargs)[source]¶
Bases:
QubesException,KeyErrorTrying to unassign not assigned device.
- exception qubesadmin.exc.PermissionDenied[source]¶
Bases:
ExceptionRaised deliberately by handlers when we decide not to cooperate
- exception qubesadmin.exc.ProtocolError[source]¶
Bases:
AssertionErrorRaised when something is wrong with data received
- exception qubesadmin.exc.QubesDaemonAccessError(message_format: str, *args, **kwargs)[source]¶
Bases:
QubesDaemonCommunicationErrorGot empty response from qubesd. This can be lack of permission, or some server-side issue.
- exception qubesadmin.exc.QubesDaemonCommunicationError(message_format: str, *args, **kwargs)[source]¶
Bases:
QubesExceptionError while communicating with qubesd, may mean insufficient permissions as well
- qubesadmin.exc.QubesDaemonNoResponseError¶
alias of
QubesDaemonAccessError
- exception qubesadmin.exc.QubesException(message_format: str, *args, **kwargs)[source]¶
Bases:
ExceptionException that can be shown to the user
- exception qubesadmin.exc.QubesFeatureNotFoundError(message_format: str, *args, **kwargs)[source]¶
Bases:
QubesException,KeyErrorFeature not set for a given domain
- exception qubesadmin.exc.QubesLabelNotFoundError(message_format: str, *args, **kwargs)[source]¶
Bases:
QubesException,KeyErrorLabel does not exists
- exception qubesadmin.exc.QubesMemoryError(message_format: str, *args, **kwargs)[source]¶
Bases:
QubesVMError,MemoryErrorCannot start domain, because not enough memory is available
- exception qubesadmin.exc.QubesNoSuchPropertyError(message_format: str, *args, **kwargs)[source]¶
Bases:
QubesException,AttributeErrorRequested property does not exist
- exception qubesadmin.exc.QubesNoTemplateError(message_format: str, *args, **kwargs)[source]¶
Bases:
QubesVMErrorCannot start domain, because there is no template
- exception qubesadmin.exc.QubesNotImplementedError(message_format: str, *args, **kwargs)[source]¶
Bases:
QubesException,NotImplementedErrorThrown at user when some feature is not implemented
- exception qubesadmin.exc.QubesNotesError(message_format: str, *args, **kwargs)[source]¶
Bases:
QubesExceptionSome problem with qube notes.
- exception qubesadmin.exc.QubesPoolInUseError(message_format: str, *args, **kwargs)[source]¶
Bases:
QubesExceptionVM is in use, cannot remove.
- exception qubesadmin.exc.QubesPropertyAccessError(prop: str)[source]¶
Bases:
QubesDaemonAccessError,AttributeErrorFailed to read/write property value, cause is unknown (insufficient permissions, no such property, invalid value, other)
- exception qubesadmin.exc.QubesPropertyValueError(message_format: str, *args, **kwargs)[source]¶
Bases:
QubesValueErrorCannot set value of qubes.property, because user-supplied value is wrong.
- exception qubesadmin.exc.QubesTagNotFoundError(message_format: str, *args, **kwargs)[source]¶
Bases:
QubesException,KeyErrorTag not set for a given domain
- exception qubesadmin.exc.QubesVMAlreadyStartedError(message_format: str, *args, **kwargs)[source]¶
Bases:
QubesVMErrorRequested qube to start, but it’s already running
- exception qubesadmin.exc.QubesVMError(message_format: str, *args, **kwargs)[source]¶
Bases:
QubesExceptionSome problem with domain state.
- exception qubesadmin.exc.QubesVMInUseError(message_format: str, *args, **kwargs)[source]¶
Bases:
QubesVMErrorVM is in use, cannot remove.
- exception qubesadmin.exc.QubesVMInvalidUUIDError(message_format: str, *args, **kwargs)[source]¶
Bases:
QubesExceptionDomain UUID is invalid
- exception qubesadmin.exc.QubesVMNotFoundError(message_format: str, *args, **kwargs)[source]¶
Bases:
QubesException,KeyErrorDomain cannot be found in the system
- exception qubesadmin.exc.QubesVMNotHaltedError(message_format: str, *args, **kwargs)[source]¶
Bases:
QubesVMErrorDomain is not halted.
This exception is thrown when machine should be halted, but is not (either running or paused).
- exception qubesadmin.exc.QubesVMNotPausedError(message_format: str, *args, **kwargs)[source]¶
Bases:
QubesVMNotStartedErrorDomain is not paused.
This exception is thrown when machine should be paused, but is not.
- exception qubesadmin.exc.QubesVMNotRunningError(message_format: str, *args, **kwargs)[source]¶
Bases:
QubesVMNotStartedErrorDomain is not running.
This exception is thrown when machine should be running but is either halted or paused.
- exception qubesadmin.exc.QubesVMNotStartedError(message_format: str, *args, **kwargs)[source]¶
Bases:
QubesVMErrorDomain is not started.
This exception is thrown when machine is halted, but should be started (that is, either running or paused).
- exception qubesadmin.exc.QubesVMNotSuspendedError(message_format: str, *args, **kwargs)[source]¶
Bases:
QubesVMErrorDomain is not suspended.
This exception is thrown when machine should be suspended but is either halted or running.
- exception qubesadmin.exc.QubesVMShutdownTimeoutError(message_format: str, *args, **kwargs)[source]¶
Bases:
QubesVMErrorDomain shutdown timed out.
- exception qubesadmin.exc.QubesValueError(message_format: str, *args, **kwargs)[source]¶
Bases:
QubesException,ValueErrorCannot set some value, because it is invalid, out of bounds, etc.
- exception qubesadmin.exc.StoragePoolException(message_format: str, *args, **kwargs)[source]¶
Bases:
QubesExceptionA general storage exception
- exception qubesadmin.exc.UnexpectedDeviceProperty(message_format: str, *args, **kwargs)[source]¶
Bases:
QubesException,ValueErrorDevice has unexpected property such as backend_domain, devclass etc.
- exception qubesadmin.exc.UnrecognizedDevice(message_format: str, *args, **kwargs)[source]¶
Bases:
QubesException,ValueErrorDevice identity is not as expected.
qubesadmin.features module¶
VM features interface
- class qubesadmin.features.Features(vm: QubesVM)[source]¶
Bases:
objectManager of the features.
Features can have three distinct values: no value (not present in mapping, which is closest thing to
None), empty string (which is interpreted asFalse) and non-empty string, which isTrue. Anything assigned to the mapping is coerced to strings, however if you assign instances ofbool, they are converted as described above. Be aware that assigning the number 0 (which is considered false in Python) will result in string ‘0’, which is considered true.- NO_DEFAULT = <object object>¶
- check_with_template(item: str) str | None[source]¶
- check_with_template(item: str, default: T) str | T
Check if the vm’s template has the specified feature.
- get(item: str) str | None[source]¶
- get(item: str, default: T) str | T
Get a feature, return default value if missing.
- keys() Iterator[str]¶
qubesadmin.firewall module¶
Firewall configuration interface
- class qubesadmin.firewall.Action(value: object)[source]¶
Bases:
RuleChoiceRule action
- accept: str = 'accept'¶
- drop: str = 'drop'¶
- property rule: str¶
API representation of this rule element
- class qubesadmin.firewall.Comment(value: object)[source]¶
Bases:
RuleOptionUser comment
- property rule: str¶
API representation of this rule element
- class qubesadmin.firewall.DstHost(value: str, prefixlen: int | None = None)[source]¶
Bases:
RuleOptionRepresent host/network address: either IPv4, IPv6, or DNS name
- property rule: str | None¶
API representation of this rule element
- class qubesadmin.firewall.DstPorts(value: int | str)[source]¶
Bases:
RuleOptionDestination port(s), for TCP/UDP only
- property rule: str¶
API representation of this rule element
- class qubesadmin.firewall.Expire(value: SupportsInt)[source]¶
Bases:
RuleOptionRule expire time
- property expired: bool¶
Has this rule expired already?
- property pretty_value: str¶
Human readable representation
- property rule: str¶
API representation of this rule element
- class qubesadmin.firewall.Firewall(vm: QubesVM)[source]¶
Bases:
objectFirewal manager for a VM
- reload() None[source]¶
Force reload the same firewall rules.
Can be used for example to force again names resolution.
- property rules: list[Rule]¶
Firewall rules
You can either copy them, edit and then assign new rules list to this property, or edit in-place and call
save_rules(). Once rules are loaded, they are cached. To reload rules, callload_rules().
- class qubesadmin.firewall.IcmpType(value: SupportsInt)[source]¶
Bases:
RuleOptionICMP packet type
- property rule: str¶
API representation of this rule element
- class qubesadmin.firewall.Proto(value: object)[source]¶
Bases:
RuleChoiceProtocol name
- icmp: str = 'icmp'¶
- property rule: str¶
API representation of this rule element
- tcp: str = 'tcp'¶
- udp: str = 'udp'¶
- class qubesadmin.firewall.Rule(rule: str | None, **kwargs)[source]¶
Bases:
objectA single firewall rule
- property rule: str¶
API representation of this rule
- property specialtarget: SpecialTarget | None¶
Special target, for now only ‘dns’ supported
- class qubesadmin.firewall.RuleChoice(value: object)[source]¶
Bases:
RuleOptionBase class for multiple-choices rule elements
- class qubesadmin.firewall.RuleOption(value: object)[source]¶
Bases:
objectBase class for a single rule element
- property pretty_value: str¶
Human readable representation
- property rule: str¶
API representation of this rule element
- class qubesadmin.firewall.SpecialTarget(value: object)[source]¶
Bases:
RuleChoiceSpecial destination
- dns: str = 'dns'¶
- property rule: str¶
API representation of this rule element
qubesadmin.label module¶
VM Labels
- class qubesadmin.label.Label(app: QubesBase, name: str)[source]¶
Bases:
objectLabel definition for virtual machines
Label specifies colour of the qube icon displayed next to VM’s name.
- Parameters:
color (str) – colour specification as in HTML (
#abcdef)name (str) – label’s name like “red” or “green”
- property color: str¶
color specification as in HTML (
#abcdef)
- property icon: str¶
freedesktop icon name, suitable for use in
PyQt4.QtGui.QIcon.fromTheme()
- property index: int¶
label numeric identifier
- property name: str¶
label’s name like “red” or “green”
qubesadmin.log module¶
Qubes logging routines
See also: qubes.vm.qubesvm.QubesVM.log
qubesadmin.spinner module¶
Qubes CLI spinner
A novice asked the master: “In the east there is a great tree-structure that men call ‘Corporate Headquarters’. It is bloated out of shape with vice presidents and accountants. It issues a multitude of memos, each saying ‘Go, Hence!’ or ‘Go, Hither!’ and nobody knows what is meant. Every year new names are put onto the branches, but all to no avail. How can such an unnatural entity be?”
The master replied: “You perceive this immense structure and are disturbed that it has no rational purpose. Can you not take amusement from its endless gyrations? Do you not enjoy the untroubled ease of programming beneath its sheltering branches? Why are you bothered by its uselessness?”
(Geoffrey James, “The Tao of Programming”, 7.1)
- class qubesadmin.spinner.AbstractSpinner(stream: IO, charset: str = '-\\|/')[source]¶
Bases:
objectThe base class for all Spinners
- Parameters:
stream – file-like object with
.write()methodcharset (str) – the sequence of characters to display
- The spinner should be used as follows:
- class qubesadmin.spinner.DummySpinner(stream: IO, charset: str = '-\\|/')[source]¶
Bases:
AbstractSpinnerDummy spinner, does not do anything
- class qubesadmin.spinner.QubesSpinner(*args, **kwargs)[source]¶
Bases:
AbstractSpinnerBasic spinner
This spinner uses standard ASCII control characters
- class qubesadmin.spinner.QubesSpinnerEnterpriseEdition(stream: IO, charset: str | None = None)[source]¶
Bases:
QubesSpinnerEnterprise spinner
This is tty- and terminfo-aware spinner. Recommended.
qubesadmin.storage module¶
Storage subsystem.
- class qubesadmin.storage.Pool(app: QubesBase, name: str)[source]¶
Bases:
objectA Pool is used to manage different kind of volumes (File based/LVM/Btrfs/…).
- property config: dict[str, str]¶
Storage pool config
- property driver: str¶
Storage pool driver
- property ephemeral_volatile: bool¶
Whether volatile volumes in this pool should be encrypted with an ephemeral key in dom0
- property revisions_to_keep: int¶
Number of revisions to keep around
- property size: int | None¶
Storage pool size, in bytes
- property usage: int | None¶
Space used in the pool, in bytes
- property usage_details: dict[str, int]¶
Storage pool usage details (current - not cached)
- class qubesadmin.storage.Volume(app: QubesBase, pool: str | None = None, vid: str | None = None, vm: str | None = None, vm_name: str | None = None)[source]¶
Bases:
objectStorage volume.
- clone(source: Volume) None[source]¶
Clone data from sane volume of another VM.
This function override existing volume content. This operation is implemented for VM volumes - those in vm.volumes collection (not pool.volumes).
- Parameters:
source – source volume object
- property ephemeral: bool¶
True if volume is read-write.
- import_data(stream: BinaryIO) None[source]¶
Import volume data from a given file-like object.
This function overrides existing volume content.
- Parameters:
stream – file-like object, must support fileno()
- import_data_with_size(stream: IO, size: object) None[source]¶
Import volume data from a given file-like object, informing qubesd that data has a specific size.
This function overrides existing volume content.
- Parameters:
stream – file-like object, must support fileno()
size – size of data in bytes
- is_outdated() bool[source]¶
Returns True if this snapshot of a source volume (for `snap_on_start`=True) is outdated.
- property name: str | None¶
per-VM volume name, if available
- property pool: str¶
Storage volume pool name.
- resize(size: object) None[source]¶
Resize volume.
Currently only extending is supported.
- Parameters:
size (int) – new size in bytes.
- revert(revision: str) None[source]¶
Revert volume to previous revision
- Parameters:
revision (str) – Revision identifier to revert to
- property revisions: list[str]¶
Returns iterable containing revision identifiers
- property revisions_to_keep: int¶
Number of revisions to keep around
- property rw: bool¶
True if volume is read-write.
- property save_on_stop: bool¶
Commit changes to original volume on VM stop.
- property size: int¶
Size of volume, in bytes.
- property snap_on_start: bool¶
Create a snapshot from source on VM start.
- property source: str | None¶
Volume ID of source volume (for
snap_on_start).If None, this volume itself will be used.
- property usage: int¶
Used volume space, in bytes.
- property vid: str¶
Storage volume id, unique within given pool.
qubesadmin.utils module¶
Various utility functions.
- class qubesadmin.utils.DriveAction(option_strings, dest='drive', *, prefix='cdrom:', metavar='IMAGE', required=False, help='Attach drive')[source]¶
Bases:
ActionAction for argument parser that stores drive image path. Intended use for device attachment before domain is started.
- class qubesadmin.utils.LockFile(path: str, nonblock: bool = False)[source]¶
Bases:
objectSimple locking context manager. It opens a file with an advisory lock taken (fcntl.lockf)
- qubesadmin.utils.encode_for_vmexec(args: Iterable[str]) str[source]¶
Encode an argument list for qubes.VMExec call.
- async qubesadmin.utils.generic_action(domains: list[QubesVM], action: str | Callable, *args, **kwargs)[source]¶
Asynchronously run action on qubes and return ones that failed.
- qubesadmin.utils.get_drive_assignment(app, drive_str)[source]¶
Prepare
qubesadmin.device_protocol.DeviceAssignmentobject for a given drive. Intended to be used during before domain is started.If running in dom0, it will also take care about creating the appropriate loop device (if necessary). Otherwise, only existing block devices are supported.
- Parameters:
app – Qubes() instance
drive_str – drive argument
- Returns:
DeviceAssignment matching drive_str
- qubesadmin.utils.kbytes_to_kmg(size: float | int) str[source]¶
Convert kbytes to human readable format.
- async qubesadmin.utils.kill(domains: list[QubesVM], **kwargs)[source]¶
Asynchronously kill qubes and return ones that failed.
- qubesadmin.utils.mbytes_to_kmg(size: float | int) str[source]¶
Convert mbytes to human readable format.
- async qubesadmin.utils.pause(domains: list[QubesVM], **kwargs)[source]¶
Asynchronously pause qubes and return ones that failed.
- qubesadmin.utils.qbool(value: str | int | bool) bool[source]¶
Property setter for boolean properties.
It accepts (case-insensitive)
'0','no'andfalseasFalseand'1','yes'and'true'asTrue.
- async qubesadmin.utils.resume(domains: list[QubesVM], **kwargs)[source]¶
Asynchronously resume qubes and return ones that failed.
- async qubesadmin.utils.shutdown(domains: list[QubesVM], **kwargs)[source]¶
Asynchronously resume shutdown and return ones that failed.
- async qubesadmin.utils.start(domains: list[QubesVM], **kwargs)[source]¶
Asynchronously start qubes and return ones that failed.
- qubesadmin.utils.start_expert(domain, skip_if_running: bool = False, drive: str | None = None)[source]¶
Start the domain, optionally specifying a drive.
- async qubesadmin.utils.suspend(domains: list[QubesVM], **kwargs)[source]¶
Asynchronously suspend qubes and return ones that failed.
- async qubesadmin.utils.unpause(domains: list[QubesVM], **kwargs)[source]¶
Asynchronously unpause qubes and return ones that failed.
- qubesadmin.utils.updates_vms_status(qvm_collection: QubesBase) bool | None[source]¶
Check whether all VMs have the same check-updates value; if yes, return it; otherwise, return None
- qubesadmin.utils.vm_dependencies(app: QubesBase, reference_vm: QubesVM) list[tuple[QubesVM | None, str]][source]¶
Helper function that returns a list of all the places a given VM is used in. Output is a list of tuples (property_holder, property_name), with None as property_holder for global properties
Module contents¶
Qubes OS management client.