Kaynağa Gözat

Remove more core2 code

Rusty Bird 4 yıl önce
ebeveyn
işleme
d527e01136

+ 0 - 12
.coveragerc

@@ -1,12 +0,0 @@
-[report]
-exclude_lines =
-    pragma: no cover
-    ^\s*def __repr__
-    ^\s*(el)?if os\.name ==
-    ^\s*raise (RuntimeError|NotImplementedError)
-    ^\s*except ImportError
-[paths]
-source =
-    qubes
-    /usr/lib/python2.7/site-packages/qubes
-    /usr/lib64/python2.7/site-packages/qubes

+ 0 - 30
qubes/config.py

@@ -30,7 +30,6 @@ import os.path
 
 qubes_base_dir = "/var/lib/qubes"
 system_path = {
-    'qubes_guid_path': '/usr/bin/qubes-guid',
     'qrexec_daemon_path': '/usr/sbin/qrexec-daemon',
     'qrexec_client_path': '/usr/bin/qrexec-client',
     'qrexec_rpc_multiplexer': '/usr/lib/qubes/qubes-rpc-multiplexer',
@@ -39,29 +38,12 @@ system_path = {
     # Relative to qubes_base_dir
     'qubes_appvms_dir': 'appvms',
     'qubes_templates_dir': 'vm-templates',
-    'qubes_servicevms_dir': 'servicevms',
     'qubes_store_filename': 'qubes.xml',
     'qubes_kernels_base_dir': 'vm-kernels',
 
     # qubes_icon_dir is obsolete
     # use QIcon.fromTheme() where applicable
     'qubes_icon_dir': '/usr/share/icons/hicolor/128x128/devices',
-
-    'qrexec_policy_dir': '/etc/qubes-rpc/policy',
-
-    'config_template_pv': '/usr/share/qubes/vm-template.xml',
-}
-
-vm_files = {
-    'root_img': 'root.img',
-    'rootcow_img': 'root-cow.img',
-    'volatile_img': 'volatile.img',
-    'clean_volatile_img': 'clean-volatile.img.tar',
-    'private_img': 'private.img',
-    'kernels_subdir': 'kernels',
-    'firewall_conf': 'firewall.xml',
-    'whitelisted_appmenus': 'whitelisted-appmenus.list',
-    'updates_stat_file': 'updates.stat',
 }
 
 defaults = {
@@ -73,8 +55,6 @@ defaults = {
     'kernelopts_common': ('root=/dev/mapper/dmroot ro nomodeset console=hvc0 '
              'rd_NO_PLYMOUTH rd.plymouth.enable=0 plymouth.enable=0 '),
 
-    'dom0_update_check_interval': 6*3600,
-
     'private_img_size': 2*1024*1024*1024,
     'root_img_size': 10*1024*1024*1024,
 
@@ -89,16 +69,6 @@ defaults = {
             'name': 'linux-kernel'
         }
     },
-
-    # how long (in sec) to wait for VMs to shutdown,
-    # before killing them (when used qvm-run with --wait option),
-    'shutdown_counter_max': 60,
-
-    'vm_default_netmask': "255.255.255.0",
-
-    'appvm_label': 'red',
-    'template_label': 'black',
-    'servicevm_label': 'red',
 }
 
 max_qid = 254

+ 0 - 3
qubes/tests/__init__.py

@@ -878,7 +878,6 @@ class SystemTestCase(QubesTestCase):
     def _remove_vm_disk(vmname):
         for dirspec in (
                 'qubes_appvms_dir',
-                'qubes_servicevms_dir',
                 'qubes_templates_dir'):
             dirpath = os.path.join(qubes.config.qubes_base_dir,
                 qubes.config.system_path[dirspec], vmname)
@@ -1018,7 +1017,6 @@ class SystemTestCase(QubesTestCase):
         vmnames = set()
         for dirspec in (
                 'qubes_appvms_dir',
-                'qubes_servicevms_dir',
                 'qubes_templates_dir'):
             dirpath = os.path.join(qubes.config.qubes_base_dir,
                 qubes.config.system_path[dirspec])
@@ -1432,7 +1430,6 @@ def load_tests(loader, tests, pattern): # pylint: disable=unused-argument
             'qubes.tests.integ.salt',
             'qubes.tests.integ.backup',
             'qubes.tests.integ.backupcompatibility',
-#           'qubes.tests.regressions',
 
             # external modules
             'qubes.tests.extra',

+ 0 - 10
qubes/vm/adminvm.py

@@ -300,13 +300,3 @@ class AdminVM(qubes.vm.BaseVM):
                 args[0], *stdouterr)
 
         return stdouterr
-
-#   def __init__(self, **kwargs):
-#       super(QubesAdminVm, self).__init__(qid=0, name="dom0",
-#                                            dir_path=None,
-#                                            private_img = None,
-#                                            template = None,
-#                                            maxmem = 0,
-#                                            vcpus = 0,
-#                                            label = defaults["template_label"],
-#                                            **kwargs)

+ 3 - 11
qubes/vm/qubesvm.py

@@ -29,7 +29,6 @@ import shutil
 import string
 import subprocess
 import uuid
-import warnings
 
 import libvirt  # pylint: disable=import-error
 import lxml
@@ -1161,7 +1160,7 @@ class QubesVM(qubes.vm.mix.net.NetVMMixin, qubes.vm.BaseVM):
             except Exception as exc:  # pylint: disable=bare-except
                 self.log.error('Start failed: %s', str(exc))
                 # This avoids losing the exception if an exception is
-                # raised in self.force_shutdown(), because the vm is not
+                # raised in self._kill_locked(), because the vm is not
                 # running or paused
                 try:
                     yield from self._kill_locked()
@@ -1293,13 +1292,6 @@ class QubesVM(qubes.vm.mix.net.NetVMMixin, qubes.vm.BaseVM):
         # make sure all shutdown tasks are completed
         yield from self._ensure_shutdown_handled()
 
-    def force_shutdown(self, *args, **kwargs):
-        """Deprecated alias for :py:meth:`kill`"""
-        warnings.warn(
-            'Call to deprecated function force_shutdown(), use kill() instead',
-            DeprecationWarning, stacklevel=2)
-        return self.kill(*args, **kwargs)
-
     @asyncio.coroutine
     def suspend(self):
         """Suspend (pause) domain.
@@ -1802,8 +1794,8 @@ class QubesVM(qubes.vm.mix.net.NetVMMixin, qubes.vm.BaseVM):
                 Halting -> Transient [style="invis"];
 
                 Running -> Halted
-                    [label="force_shutdown()"
-                        URL="#qubes.vm.qubesvm.QubesVM.force_shutdown"
+                    [label="kill()"
+                        URL="#qubes.vm.qubesvm.QubesVM.kill"
                         constraint=false];
 
                 Running -> Crashed [constraint=false];

+ 0 - 9
qubes/vm/templatevm.py

@@ -21,8 +21,6 @@
 
 ''' This module contains the TemplateVM implementation '''
 
-import warnings
-
 import qubes
 import qubes.config
 import qubes.vm.qubesvm
@@ -36,13 +34,6 @@ class TemplateVM(QubesVM):
 
     dir_path_prefix = qubes.config.system_path['qubes_templates_dir']
 
-    @property
-    def rootcow_img(self):
-        '''COW image'''
-        warnings.warn("rootcow_img is deprecated, use "
-                      "volumes['root'].path_origin", DeprecationWarning)
-        return self.volumes['root'].path_cow
-
     @property
     def appvms(self):
         ''' Returns a generator containing all domains based on the current

+ 0 - 123
qvm-tools/qvm-top

@@ -1,123 +0,0 @@
-#!/usr/bin/python2
-# -*- encoding: utf8 -*-
-#
-# The Qubes OS Project, http://www.qubes-os.org
-#
-# Copyright (C) 2010  Joanna Rutkowska <joanna@invisiblethingslab.com>
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License, or (at your option) any later version.
-#
-# This library 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
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, see <https://www.gnu.org/licenses/>.
-#
-#
-
-from qubes.qubes import QubesVmCollection
-from qubes.qubes import QubesHost
-from qubes.qubes import QubesException
-from optparse import OptionParser
-import sys
-
-def main():
-    usage = "usage: %prog [options]"
-    parser = OptionParser (usage)
-
-    parser.add_option("--list", dest="list_top",
-                      action="store_true", default=False,
-                      help="n m : One line summary of top n vms with more than m cpu_time %")
-
-    (options, args) = parser.parse_args ()
-
-    qvm_collection = QubesVmCollection()
-    qvm_collection.lock_db_for_reading()
-    qvm_collection.load()
-    qvm_collection.unlock_db()
-
-    fields_to_display = ["name", "cpu", "mem"]
-
-    cpu_usages = None
-    qhost = QubesHost()
-    (measure_time, cpu_usages) = qhost.measure_cpu_usage(qvm_collection)
-
-    vms_list = [vm for vm in qvm_collection.values() if vm.is_running()]
-    vms_list = sorted(vms_list, key= lambda vm: 1-cpu_usages[vm.get_xid()]['cpu_usage'])
-
-    no_vms = len (vms_list)
-    vms_to_display = vms_list
-
-    if options.list_top:
-        any_shown = False
-        ndisp = 3
-        cputh = 0
-        if len(args) > 0:
-            ndisp = int(args[0])
-        if len(args) > 1:
-            cputh = int(args[1])
-
-        for vm in vms_to_display[:ndisp]:
-            cpu = cpu_usages[vm.get_xid()]['cpu_usage']
-            if cpu > cputh:
-                any_shown = True
-                sys.stdout.write("%d %s, " % (cpu, vm.name))
-
-        if any_shown:
-            sys.stdout.write(" ... | ")
-
-        totalMem = 0
-        dom0mem = 0
-        for vm in vms_to_display:
-            if not vm.name == "dom0":
-                totalMem += vm.get_mem()
-            else:
-                dom0mem = vm.get_mem()
-        totalMem /= 1024.0 * 1024.0
-        dom0mem /= 1024.0 * 1024.0
-        sys.stdout.write("%.1f G + %.1f G" % (totalMem, dom0mem))
-        return
-
-    max_width = { 'name': 0, 'cpu': 0, 'mem': 0 }
-    data_to_display = []
-    for vm in vms_to_display:
-        data_row = {}
-        data_row['name'] = vm.name
-        max_width['name'] = max(max_width['name'], len(data_row['name']))
-        data_row['cpu'] = "%.1f" % (cpu_usages[vm.get_xid()]['cpu_usage'])
-        max_width['cpu'] = max(max_width['cpu'], len(data_row['cpu']))
-        data_row['mem'] = "%d" % (vm.get_mem() / (1024.0))
-        max_width['mem'] = max(max_width['mem'], len(data_row['mem']))
-        data_to_display.append(data_row)
-
-    # Display the header
-    s = ""
-    for f in fields_to_display:
-        fmt="{{0:-^{0}}}-+".format(max_width[f] + 1)
-        s += fmt.format('-')
-    print s
-    s = ""
-    for f in fields_to_display:
-        fmt="{{0:>{0}}} |".format(max_width[f] + 1)
-        s += fmt.format(f)
-    print s
-    s = ""
-    for f in fields_to_display:
-        fmt="{{0:-^{0}}}-+".format(max_width[f] + 1)
-        s += fmt.format('-')
-    print s
-
-    # ... and the actual data
-    for row in data_to_display:
-        s = ""
-        for f in fields_to_display:
-            fmt="{{0:>{0}}} |".format(max_width[f] + 1)
-            s += fmt.format(row[f])
-        print s
-
-main()

+ 0 - 79
tests/regressions.py

@@ -1,79 +0,0 @@
-#!/usr/bin/python2 -O
-# coding=utf-8
-
-#
-# The Qubes OS Project, https://www.qubes-os.org/
-#
-# Copyright (C) 2014-2015
-#       Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
-# Copyright (C) 2015  Wojtek Porczyk <woju@invisiblethingslab.com>
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License, or (at your option) any later version.
-#
-# This library 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
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, see <https://www.gnu.org/licenses/>.
-#
-
-import multiprocessing
-import os
-import time
-import unittest
-
-import qubes.qubes
-import qubes.tests
-import subprocess
-
-
-class TC_00_Regressions(qubes.tests.SystemTestsMixin, qubes.tests.QubesTestCase):
-    # Bug: #906
-    def test_000_bug_906_db_locking(self):
-        def create_vm(vmname):
-            qc = qubes.qubes.QubesVmCollection()
-            qc.lock_db_for_writing()
-            qc.load()
-            time.sleep(1)
-            qc.add_new_vm('QubesAppVm',
-                name=vmname, template=qc.get_default_template())
-            qc.save()
-            qc.unlock_db()
-
-        vmname1, vmname2 = map(self.make_vm_name, ('test1', 'test2'))
-        t = multiprocessing.Process(target=create_vm, args=(vmname1,))
-        t.start()
-        create_vm(vmname2)
-        t.join()
-
-        qc = qubes.qubes.QubesVmCollection()
-        qc.lock_db_for_reading()
-        qc.load()
-        qc.unlock_db()
-
-        self.assertIsNotNone(qc.get_vm_by_name(vmname1))
-        self.assertIsNotNone(qc.get_vm_by_name(vmname2))
-
-    def test_bug_1389_dispvm_qubesdb_crash(self):
-        """
-        Sometimes QubesDB instance in DispVM crashes at startup.
-        Unfortunately we don't have reliable way to reproduce it, so try twice
-        :return:
-        """
-        self.qc.unlock_db()
-        for try_no in xrange(2):
-            p = subprocess.Popen(['/usr/lib/qubes/qfile-daemon-dvm',
-                                  'qubes.VMShell', 'dom0', 'DEFAULT'],
-                                 stdin=subprocess.PIPE,
-                                 stdout=subprocess.PIPE,
-                                 stderr=open(os.devnull, 'w'))
-            p.stdin.write("qubesdb-read /name || echo ERROR\n")
-            dispvm_name = p.stdout.readline()
-            p.stdin.close()
-            self.assertTrue(dispvm_name.startswith("disp"),
-                                 "Try {} failed".format(try_no))