mirror of
https://github.com/retspen/webvirtcloud
synced 2026-11-09 19:56:48 +00:00
feat(instances): external snapshot delete runs as a job
This commit is contained in:
parent
c26419c757
commit
079e2ca5ca
12 changed files with 624 additions and 45 deletions
|
|
@ -8,6 +8,8 @@ from libvirt import (
|
|||
VIR_DOMAIN_XML_SECURE,
|
||||
libvirtError,
|
||||
)
|
||||
from operations import claims
|
||||
from operations.models import Claim
|
||||
from vrtManager.instance import wvmInstance
|
||||
from webvirtcloud.settings import QEMU_CONSOLE_LISTENER_ADDRESSES
|
||||
|
||||
|
|
@ -281,6 +283,11 @@ class Instance(models.Model):
|
|||
except libvirtError:
|
||||
return []
|
||||
|
||||
@cached_property
|
||||
def held_by_job(self) -> bool:
|
||||
# a queued job has no libvirt block job yet; a job's claim still holds the VM
|
||||
return Claim.objects.filter(resource=claims.instance_key(self.uuid), operation__isnull=False).exists()
|
||||
|
||||
@cached_property
|
||||
def inst_xml(self):
|
||||
return self.proxy._XMLDesc(VIR_DOMAIN_XML_SECURE)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue