Kaynağa Gözat

tests: copy pool configuration into qubes-test.xml

If template choosen for the tests is installed in non-default storage
pool, this pool also needs to be imported into qubes-test.xml.
Marek Marczykowski-Górecki 7 yıl önce
ebeveyn
işleme
bd9300b38e
1 değiştirilmiş dosya ile 10 ekleme ve 0 silme
  1. 10 0
      qubes/tests/__init__.py

+ 10 - 0
qubes/tests/__init__.py

@@ -507,10 +507,20 @@ class SystemTestsMixin(object):
         elif isinstance(template, str):
             template = self.host_app.domains[template]
 
+        used_pools = [vol.pool for vol in template.volumes.values()]
+
+        for pool in used_pools:
+            if pool in self.app.pools:
+                continue
+            self.app.add_pool(**self.host_app.pools[pool].config)
+
         template_vm = self.app.add_new_vm(qubes.vm.templatevm.TemplateVM,
             name=template.name,
             uuid=template.uuid,
             label='black')
+        for name, volume in template_vm.volumes.items():
+            if volume.pool != template.volumes[name].pool:
+                template_vm.storage.init_volume(name, volume.config)
         self.app.default_template = template_vm
 
     def init_networking(self):