mirror of
https://github.com/retspen/webvirtcloud
synced 2026-12-02 17:06:09 +00:00
One host could be added twice, under another name, as TCP and SSH, or by another address: its VMs were listed once per record, each with its own owners, and counted twice in the capacity totals. A compute with VMs could also be pointed at another host: the owners of a VM then reached the VM with the same UUID there, a restored or copied one. A compute now keeps its libvirt host UUID. Adding a compute or changing its connection, on the web or the API, connects and reads it: a host that is already a compute is refused, and a compute with VMs moves only to an address of the same host, which must answer. Computes added before are read when another one is checked.
27 lines
727 B
Python
27 lines
727 B
Python
"""Test doubles for the computes tests."""
|
|
|
|
from unittest.mock import patch
|
|
|
|
from libvirt import libvirtError
|
|
|
|
|
|
def no_host_answers(test):
|
|
"""For test: the hosts a compute form or API call tries (Compute.clean)
|
|
cannot be reached, so none is connected to, the machine's own libvirt
|
|
least of all."""
|
|
patcher = patch("computes.models.wvmHostDetails", side_effect=libvirtError("unreachable"))
|
|
patcher.start()
|
|
test.addCleanup(patcher.stop)
|
|
|
|
|
|
class Domain:
|
|
"""A libvirt domain as the VM list reads it: its name and UUID."""
|
|
|
|
def __init__(self, name, uuid):
|
|
self._name, self._uuid = name, uuid
|
|
|
|
def name(self):
|
|
return self._name
|
|
|
|
def UUIDString(self):
|
|
return self._uuid
|