mirror of
https://github.com/retspen/webvirtcloud
synced 2026-11-11 12:46:49 +00:00
perf(instances): the VM page reads each disk, the state and host info once
Measured on a VM with two disks, a CD-ROM and a NIC: 70 libvirt calls per page, now 43. Within the page's cached_reads block the VM's state, the host's info and domain capabilities, and each disk path's volume are read once; the running and the persistent disk lists share a path's volume. The ISO list takes the active pools in one call instead of looking each up by name; it still refreshes them, so an image copied in by hand shows up. The opt-in DRBD status waits at most 10 s for the compute's ssh, then leaves the status unknown instead of holding the page.
This commit is contained in:
parent
95b4418c96
commit
439f24041e
6 changed files with 278 additions and 52 deletions
|
|
@ -52,6 +52,9 @@ from . import utils
|
|||
from .forms import ConsoleForm, FlavorForm, NewVMForm
|
||||
from .models import Flavor
|
||||
|
||||
# the VM page waits this long (seconds) for the compute's drbdadm status
|
||||
DRBD_STATUS_TIMEOUT = 10
|
||||
|
||||
|
||||
def index(request):
|
||||
instances = None
|
||||
|
|
@ -224,11 +227,15 @@ def drbd_status(request, pk):
|
|||
|
||||
if instance.compute.type == 2 and _valid_ssh_target(instance.compute):
|
||||
conn = instance.compute.login + "@" + instance.compute.hostname
|
||||
remoteDrbdStatus = subprocess.run(
|
||||
["ssh", "--", conn, "sudo", "/usr/sbin/drbdadm", "status"],
|
||||
stdout=subprocess.PIPE,
|
||||
text=True,
|
||||
)
|
||||
try:
|
||||
remoteDrbdStatus = subprocess.run(
|
||||
["ssh", "--", conn, "sudo", "/usr/sbin/drbdadm", "status"],
|
||||
stdout=subprocess.PIPE,
|
||||
text=True,
|
||||
timeout=DRBD_STATUS_TIMEOUT,
|
||||
)
|
||||
except subprocess.TimeoutExpired:
|
||||
return result
|
||||
|
||||
if remoteDrbdStatus.stdout:
|
||||
instanceFindDrbd = re.compile(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue