libvirtobject: reapply autostart setting after rename

Fixes: #204
This commit is contained in:
coreyberla 2021-07-28 15:02:25 -07:00 committed by Cole Robinson
parent f3127e0029
commit b2835da3c8

View File

@ -102,6 +102,7 @@ class vmmLibvirtObject(vmmGObject):
def define_name(self, newname):
oldname = self.get_xmlobj().name
oldautostart = self.get_autostart()
self.ensure_latest_xml()
xmlobj = self._make_xmlobj_to_define()
@ -117,6 +118,7 @@ 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