mirror of
https://github.com/retspen/webvirtcloud
synced 2026-11-08 11:16:47 +00:00
test(instances): the live suite expects vCPUs to wait for a shut-off VM
42a1783 refuses a vCPU change on a running VM, also on a direct
request: the VM would get them only at its next start, past the quota
counted now. The live data-loss test still posted vCPUs to a running VM
and expected the change to be pending, so it failed on every connection
type. It now expects the refusal, with its message, and the definition's
vCPUs unchanged; the pending options part is as before.
This commit is contained in:
parent
2e2dd9849d
commit
e6a6b7f3cf
1 changed files with 9 additions and 7 deletions
|
|
@ -447,7 +447,7 @@ class LiveDataLossTestCase(TestCase):
|
|||
self.assertEqual((disk.find("driver").get("cache"), disk.findtext("serial")), ("none", "wvc-serial"))
|
||||
self.assertEqual(dom.XMLDesc(0), live)
|
||||
|
||||
def test_pending_options_and_cpu_changes_are_shown_and_kept_by_the_next_edit(self):
|
||||
def test_pending_options_are_shown_and_kept_by_the_next_edit_and_cpus_wait_for_shut_off(self):
|
||||
from lxml import etree, html
|
||||
|
||||
dom, inst = self.vm("options-pending", [])
|
||||
|
|
@ -459,17 +459,19 @@ class LiveDataLossTestCase(TestCase):
|
|||
(form,) = html.fromstring(page).xpath("//form[@action=$a]", a=reverse(f"instances:{view}", args=[inst.id]))
|
||||
return dict(form.form_values()) # what the form would post
|
||||
|
||||
# the buttons are disabled while it runs; a direct post is pending
|
||||
# the buttons are disabled while it runs; a direct post of options is pending
|
||||
self.post("change_options", inst, {**form("change_options"), "title": "wvc-title"})
|
||||
self.post("resizevm_cpu", inst, {**form("resizevm_cpu"), "vcpu": "2"})
|
||||
options, cpu = form("change_options"), form("resizevm_cpu")
|
||||
self.assertEqual((options["title"], cpu["vcpu"]), ("wvc-title", "2"))
|
||||
options = form("change_options")
|
||||
self.assertEqual(options["title"], "wvc-title")
|
||||
self.post("change_options", inst, {**options, "description": "wvc-description"})
|
||||
self.post("resizevm_cpu", inst, {**cpu, "cur_vcpu": "1"})
|
||||
# vCPUs are refused: the VM would get them at its next start, past the quota counted now
|
||||
response = self.post("resizevm_cpu", inst, {**form("resizevm_cpu"), "vcpu": "2"})
|
||||
self.assertIn("Shut off the VM to change its vCPUs",
|
||||
[str(m) for m in get_messages(response.wsgi_request)])
|
||||
|
||||
tree = etree.fromstring(dom.XMLDesc(libvirt.VIR_DOMAIN_XML_INACTIVE))
|
||||
self.assertEqual((tree.findtext("title"), tree.findtext("description"), tree.findtext("vcpu")),
|
||||
("wvc-title", "wvc-description", "2"))
|
||||
("wvc-title", "wvc-description", "1"))
|
||||
self.assertEqual(dom.XMLDesc(0), live)
|
||||
|
||||
def test_pending_boot_order_and_video_are_shown_and_a_live_only_choice_changes_nothing(self):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue