mirror of
https://github.com/retspen/webvirtcloud
synced 2026-11-11 12:46:49 +00:00
feat(instances): a VM's options in one list, each saved when it can be
Settings > Options was four forms under bold sentences, most of them disabled while the VM ran. The owner chose this layout from three rendered options: one list, each row a setting with its description on the left and its control on the right: VM details (title, description), Template, primary video model, QEMU guest agent. vCPU hot plug moved to Resize > CPU, next to the vCPU counts. Codex reviewed the four forms; these are fixed: - Title, description and the video model are saved while the VM runs: they are in the persistent definition, used at the next start. - The template flag has its own form and view, set_template, for superusers and staff, and only for a shut-off VM: a running VM made a template left the quota while it kept running. Turning a template back into a VM checks the quota there, and each change is audited. The title form no longer touches the flag. - A new video model stays the primary one; the old model's memory and head settings, which are its own, go with it. - The agent and vCPU hot plug forms show the persistent definition; they showed the running VM's, so a pending change looked undone. - Enabling the guest agent adds its channel only where it is missing: saving Enabled again failed, and a channel pending the next start kept a running VM from getting one. - The agent line tells a VM that is not running, one without a channel, and a connected or not connected agent apart.
This commit is contained in:
parent
46188d3230
commit
a993c12db0
13 changed files with 272 additions and 172 deletions
|
|
@ -544,12 +544,10 @@ class LiveDataLossTestCase(TestCase):
|
|||
return (f"<disk type='file' device='disk'><driver name='qemu' type='qcow2'/><source file='{path}'/>"
|
||||
"<target dev='sda' bus='scsi'/></disk>")
|
||||
|
||||
agent = "<channel type='unix'><target type='virtio' name='org.qemu.guest_agent.0'/></channel>"
|
||||
cases = (
|
||||
("disk", lambda n: disk(livetest.create_volume(self.conn, P + n + "-pending")),
|
||||
lambda vm, n: vm.attach_disk("sda", livetest.create_volume(self.conn, P + n + "-new"),
|
||||
target_bus="scsi", format_type="qcow2")),
|
||||
("agent", lambda n: agent, lambda vm, n: vm.add_guest_agent()),
|
||||
)
|
||||
both = (0, libvirt.VIR_DOMAIN_XML_INACTIVE)
|
||||
for paused in (False, True):
|
||||
|
|
@ -566,6 +564,19 @@ class LiveDataLossTestCase(TestCase):
|
|||
attach(inst.proxy, name)
|
||||
self.assertEqual([dom.XMLDesc(flags) for flags in both], before)
|
||||
|
||||
def test_an_agent_channel_pending_the_next_start_is_added_to_the_running_vm_only(self):
|
||||
from lxml import etree
|
||||
|
||||
agent = "<channel type='unix'><target type='virtio' name='org.qemu.guest_agent.0'/></channel>"
|
||||
dom, inst = self.vm("agent-pending", [], extra_devices="<controller type='virtio-serial'/>")
|
||||
dom.create()
|
||||
dom.attachDeviceFlags(agent, libvirt.VIR_DOMAIN_AFFECT_CONFIG) # pending: persistent only
|
||||
channels = "devices/channel/target[@name='org.qemu.guest_agent.0']"
|
||||
for _attempt in range(2): # saving Enabled again changes nothing
|
||||
inst.proxy.add_guest_agent()
|
||||
self.assertEqual([len(etree.fromstring(dom.XMLDesc(flags)).xpath(channels))
|
||||
for flags in (0, libvirt.VIR_DOMAIN_XML_INACTIVE)], [1, 1])
|
||||
|
||||
def test_a_nic_without_a_mac_gets_the_same_one_in_both_definitions(self):
|
||||
from lxml import etree
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue