Skip to content

Commit

Permalink
vm: drop old is_outdated/commit_changes
Browse files Browse the repository at this point in the history
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
  • Loading branch information
marmarek committed Jul 4, 2017
1 parent 12adf8b commit cfbccc0
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 49 deletions.
39 changes: 0 additions & 39 deletions qubes/vm/qubesvm.py
Original file line number Diff line number Diff line change
Expand Up @@ -1643,45 +1643,6 @@ def get_start_time(self):

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
#
Expand Down
10 changes: 0 additions & 10 deletions qubes/vm/templatevm.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,3 @@ def __init__(self, *args, **kwargs):
}
}
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()

0 comments on commit cfbccc0

Please sign in to comment.