From cfbccc0a749ecb223fb1b76a98c008738a1f37a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Tue, 4 Jul 2017 03:32:32 +0200 Subject: [PATCH] vm: drop old is_outdated/commit_changes This code is unused now. Theoretically this is_outdated implementation should be moved to FileVolume, but since we don't have VM reference there, it isn't possible to read appropriate xenstore entry. As we're phasing out file pool, simply ignore it for now. QubesOS/qubes-issues#2256 --- qubes/vm/qubesvm.py | 39 --------------------------------------- qubes/vm/templatevm.py | 10 ---------- 2 files changed, 49 deletions(-) diff --git a/qubes/vm/qubesvm.py b/qubes/vm/qubesvm.py index 9b1261af..2fe480a1 100644 --- a/qubes/vm/qubesvm.py +++ b/qubes/vm/qubesvm.py @@ -1643,45 +1643,6 @@ class QubesVM(qubes.vm.mix.net.NetVMMixin, qubes.vm.BaseVM): return None - def is_outdated(self): - '''Check whether domain needs restart to update root image from \ - template. - - :returns: :py:obj:`True` if is outdated, :py:obj:`False` otherwise. - :rtype: bool - ''' - # pylint: disable=no-member - - # Makes sense only on VM based on template - if self.template is None: - return False - - if not self.is_running(): - return False - - if not hasattr(self.template, 'rootcow_img'): - return False - - rootimg_inode = os.stat(self.template.root_img) - try: - rootcow_inode = os.stat(self.template.rootcow_img) - except OSError: - # The only case when rootcow_img doesn't exists is in the middle of - # commit_changes, so VM is outdated right now - return True - - current_dmdev = "/dev/mapper/snapshot-{0:x}:{1}-{2:x}:{3}".format( - rootimg_inode[2], rootimg_inode[1], - rootcow_inode[2], rootcow_inode[1]) - - # FIXME - # 51712 (0xCA00) is xvda - # backend node name not available through xenapi :( - used_dmdev = self.app.vmm.xs.read('', - '/local/domain/0/backend/vbd/{}/51712/node'.format(self.xid)) - - return used_dmdev != current_dmdev - # # helper methods # diff --git a/qubes/vm/templatevm.py b/qubes/vm/templatevm.py index 89128ba3..7c4d62bb 100644 --- a/qubes/vm/templatevm.py +++ b/qubes/vm/templatevm.py @@ -99,13 +99,3 @@ class TemplateVM(QubesVM): } } super(TemplateVM, self).__init__(*args, **kwargs) - - def commit_changes(self): - '''Commit changes to template''' - self.log.debug('commit_changes()') - - if not self.app.vmm.offline_mode: - assert not self.is_running(), \ - 'Attempt to commit changes on running Template VM!' - - self.storage.commit()