From f2b8ad7d38ab17447f588cb9f46e11205e9aa87a Mon Sep 17 00:00:00 2001 From: qubesuser Date: Sat, 11 Nov 2017 02:36:17 +0100 Subject: [PATCH] remove unused netid code it's unused and has a netid property with name different than key that would cause issues in the next commit --- qubes/app.py | 8 -------- qubes/config.py | 1 - qubes/tests/app.py | 6 ------ qubes/tests/init.py | 7 ------- qubes/vm/adminvm.py | 2 +- 5 files changed, 1 insertion(+), 23 deletions(-) diff --git a/qubes/app.py b/qubes/app.py index bdc2c904..1c960d36 100644 --- a/qubes/app.py +++ b/qubes/app.py @@ -536,14 +536,6 @@ class VMCollection(object): raise LookupError("Cannot find unused qid!") - def get_new_unused_netid(self): - used_ids = set([vm.netid for vm in self]) # if vm.is_netvm()]) - for i in range(1, qubes.config.max_netid): - if i not in used_ids: - return i - raise LookupError("Cannot find unused netid!") - - def get_new_unused_dispid(self): for _ in range(int(qubes.config.max_dispid ** 0.5)): dispid = random.SystemRandom().randrange(qubes.config.max_dispid) diff --git a/qubes/config.py b/qubes/config.py index ded236aa..ec6e16d2 100644 --- a/qubes/config.py +++ b/qubes/config.py @@ -100,7 +100,6 @@ defaults = { } max_qid = 254 -max_netid = 254 max_dispid = 10000 #: built-in standard labels, if creating new one, allocate them above this # number, at least until label index is removed from API diff --git a/qubes/tests/app.py b/qubes/tests/app.py index 3b3b7944..ee3650ef 100644 --- a/qubes/tests/app.py +++ b/qubes/tests/app.py @@ -257,12 +257,6 @@ class TC_30_VMCollection(qubes.tests.QubesTestCase): self.vms.get_new_unused_qid() - def test_101_get_new_unused_netid(self): - self.vms.add(self.testvm1) - self.vms.add(self.testvm2) - - self.vms.get_new_unused_netid() - # def test_200_get_vms_based_on(self): # pass diff --git a/qubes/tests/init.py b/qubes/tests/init.py index 2b23aa0d..a2d41de9 100644 --- a/qubes/tests/init.py +++ b/qubes/tests/init.py @@ -323,7 +323,6 @@ class TC_20_PropertyHolder(qubes.tests.QubesTestCase): class TestVM(qubes.vm.BaseVM): qid = qubes.property('qid', type=int) name = qubes.property('name') - netid = qid uuid = uuid.uuid5(uuid.NAMESPACE_DNS, 'testvm') def __lt__(self, other): @@ -452,12 +451,6 @@ class TC_30_VMCollection(qubes.tests.QubesTestCase): self.vms.get_new_unused_qid() - def test_101_get_new_unused_netid(self): - self.vms.add(self.testvm1) - self.vms.add(self.testvm2) - - self.vms.get_new_unused_netid() - # def test_200_get_vms_based_on(self): # pass diff --git a/qubes/vm/adminvm.py b/qubes/vm/adminvm.py index 43c9da4a..faea5f33 100644 --- a/qubes/vm/adminvm.py +++ b/qubes/vm/adminvm.py @@ -189,7 +189,7 @@ class AdminVM(qubes.vm.BaseVM): # def __init__(self, **kwargs): -# super(QubesAdminVm, self).__init__(qid=0, name="dom0", netid=0, +# super(QubesAdminVm, self).__init__(qid=0, name="dom0", # dir_path=None, # private_img = None, # template = None,