Coverage for drivers/cbtutil : 75%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
"""Utility for CBT log file operations""" #!/usr/bin/python # # Copyright (C) Citrix Systems Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published # by the Free Software Foundation; version 2.1 only. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public License # along with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # # Helper functions pertaining to VHD operations #
"""Create and initialise log file for tracking changed blocks"""
"""Set parent field in log file"""
"""Get parent field from log file""" uret = uuid.UUID(ret.strip()) #TODO: Need to check for NULL UUID # Ideally, we want to do # if uuid.UUID(ret.strip()).int == 0 # return None # Pylint doesn't like this for reason though return str(uret)
"""Set child field in log file"""
"""Get parent field from log file""" cmd = [CBT_UTIL, "get", "-n", file_name, "-c"] ret = _call_cbt_util(cmd) uret = uuid.UUID(ret.strip()) #TODO: Need to check for NULL UUID return str(uret)
"""Set consistency field in log file""" else:
"""Get consistency field from log file"""
"""Get bitmap field from log file""" #Do not strip the return string. It's a byte string and stripping #it sometimes leads to loss of information
"""Set size field in log file""" cmd = [CBT_UTIL, "set", "-n", filename, "-s", str(size)] _call_cbt_util(cmd)
"""Get size field from log file""" cmd = [CBT_UTIL, "get", "-n", file_name, "-s"] ret = _call_cbt_util(cmd) return int(ret.strip())
"""Coalesce bitmap contents of parent onto child log file""" cmd = [CBT_UTIL, "coalesce", "-p", parent_path, "-c", child_path] _call_cbt_util(cmd)
|