@@ -503,15 +503,15 @@ def vms(self):
503503 def add (self , value , _enable_events = True ):
504504 """Add VM to collection
505505
506- :param qubes.vm.LocalVM value: VM to add
506+ :param qubes.vm.BaseVM value: VM to add
507507 :param _enable_events:
508508 :raises TypeError: when value is of wrong type
509509 :raises ValueError: when there is already VM which has equal ``qid``
510510 """
511511
512512 # this violates duck typing, but is needed
513513 # for VMProperty to function correctly
514- if not isinstance (value , qubes .vm .LocalVM ):
514+ if not isinstance (value , qubes .vm .BaseVM ):
515515 raise TypeError (
516516 "{} holds only LocalVM instances" .format (
517517 self .__class__ .__name__
@@ -545,7 +545,7 @@ def __getitem__(self, key):
545545 return vm
546546 raise KeyError (key )
547547
548- if isinstance (key , qubes .vm .LocalVM ):
548+ if isinstance (key , qubes .vm .BaseVM ):
549549 key = key .uuid
550550
551551 if isinstance (key , uuid .UUID ):
@@ -559,10 +559,11 @@ def __getitem__(self, key):
559559
560560 def __delitem__ (self , key ):
561561 vm = self [key ]
562- if not vm .is_halted ():
562+ if isinstance ( vm , qubes . vm . qubesvm . QubesVM ) and not vm .is_halted ():
563563 raise qubes .exc .QubesVMNotHaltedError (vm )
564564 self .app .fire_event ("domain-pre-delete" , pre_event = True , vm = vm )
565- vm .libvirt_undefine ()
565+ if isinstance (vm , qubes .vm .qubesvm .QubesVM ):
566+ vm .libvirt_undefine ()
566567 del self ._dict [vm .qid ]
567568 self .app .fire_event ("domain-delete" , vm = vm )
568569 if getattr (vm , "dispid" , None ):
@@ -1654,8 +1655,11 @@ def on_domain_pre_deleted(self, event, vm):
16541655 "see 'journalctl -u qubesd -e' in dom0 for "
16551656 "details" .format (vm .name ),
16561657 )
1657-
1658- assignments = vm .get_provided_assignments ()
1658+ self .log .critical (vm )
1659+ if isinstance (vm , qubes .vm .qubesvm .QubesVM ):
1660+ assignments = vm .get_provided_assignments ()
1661+ else :
1662+ assignments = []
16591663 if assignments :
16601664 desc = ", " .join (assignment .port_id for assignment in assignments )
16611665 raise qubes .exc .QubesVMInUseError (
0 commit comments