libvirtobject: rename autostart tweaks

* Silence some pylint
* set_autostart failure shouldn't reset the old name

Signed-off-by: Cole Robinson <crobinso@redhat.com>
This commit is contained in:
Cole Robinson 2021-07-31 19:21:09 -04:00
parent b2835da3c8
commit be05135867
1 changed files with 8 additions and 1 deletions

View File

@ -96,6 +96,12 @@ class vmmLibvirtObject(vmmGObject):
def is_nodedev(self):
return self.class_name() == "nodedev"
def get_autostart(self): # pragma: no cover
pass
def set_autostart(self, val): # pragma: no cover
ignore = val
pass
def change_name_backend(self, newbackend):
# Used for changing the backing object after a rename
self._backend = newbackend
@ -118,13 +124,14 @@ class vmmLibvirtObject(vmmGObject):
try:
self._name = newname
self.conn.rename_object(self, origxml, newxml)
self.set_autostart(oldautostart)
except Exception: # pragma: no cover
self._name = oldname
raise
finally:
self.__force_refresh_xml()
self.set_autostart(oldautostart)
#############################################################
# Functions that should probably be overridden in sub class #