diff --git a/answerfile.py b/answerfile.py index 8547818f..8862b5f3 100644 --- a/answerfile.py +++ b/answerfile.py @@ -227,9 +227,9 @@ def parseExistingInstallation(self): logger.log('Primary disk: ' + disk) results['primary-disk'] = disk - results['fs-type'] = getStrAttribute(inst[0], ['fs-type'], default=default_dom0fs_type) - if results['fs-type'] not in dom0fs_types: - raise AnswerfileException("Expected fs-type to be one of %s" % (", ".join(dom0fs_types))) + results['fs-type'] = getStrAttribute(inst[0], ['fs-type'], default=default_rootfs_type) + if results['fs-type'] not in allowed_rootfs_types: + raise AnswerfileException("Expected fs-type to be one of %s" % (", ".join(allowed_rootfs_types))) installations = product.findXenSourceProducts() installations = [x for x in installations if x.primary_disk == disk or diskutil.idFromPartition(x.primary_disk) == disk] @@ -308,9 +308,9 @@ def parseDisks(self): inc_primary = getBoolAttribute(node, ['guest-storage', 'gueststorage'], default=True) results['sr-at-end'] = getBoolAttribute(node, ['sr-at-end'], default=True) - results['fs-type'] = getStrAttribute(node, ['fs-type'], default=default_dom0fs_type) - if results['fs-type'] not in dom0fs_types: - raise AnswerfileException("Expected fs-type to be one of %s" % (", ".join(dom0fs_types))) + results['fs-type'] = getStrAttribute(node, ['fs-type'], default=default_rootfs_type) + if results['fs-type'] not in allowed_rootfs_types: + raise AnswerfileException("Expected fs-type to be one of %s" % (", ".join(allowed_rootfs_types))) # Guest disk(s) (Local SR) guest_disks = set() diff --git a/constants.py b/constants.py index 42ed735a..de99fc43 100644 --- a/constants.py +++ b/constants.py @@ -88,8 +88,8 @@ def error_string(error, logname, with_hd): # filesystems and partitions types: bootfs_type = 'vfat' -dom0fs_types = ('ext3', 'ext4') -default_dom0fs_type = 'ext4' +allowed_rootfs_types = ('ext3', 'ext4') +default_rootfs_type = 'ext4' # filesystems and partitions labels: bootfs_label = "BOOT-%s" diff --git a/install.py b/install.py index e2f1bf0a..b4681cc5 100755 --- a/install.py +++ b/install.py @@ -98,7 +98,7 @@ def go(ui, args, answerfile_address, answerfile_script): 'root-password': ('pwdhash', '!!'), 'services': { s: None for s in constants.SERVICES }, # default state for services, example {'sshd': None} 'preserve-first-partition': constants.PRESERVE_IF_UTILITY, - 'fs-type': constants.default_dom0fs_type, + 'fs-type': constants.default_rootfs_type, } suppress_extra_cd_dialog = False serial_console = None diff --git a/product.py b/product.py index b773577f..7ef18eb9 100644 --- a/product.py +++ b/product.py @@ -560,7 +560,7 @@ def findXenSourceBackups(): for p in partitions: b = None try: - b = util.TempMount(p, 'backup-', ['ro'], diskutil.fs_type_from_device(p)) + b = util.TempMount(p, 'backup-', ['ro']) if os.path.exists(os.path.join(b.mount_point, '.xen-backup-partition')): backup = XenServerBackup(p, b.mount_point) logger.log("Found a backup: %s" % (repr(backup),)) diff --git a/restore.py b/restore.py index 28ada4ab..b4ff71f8 100644 --- a/restore.py +++ b/restore.py @@ -80,7 +80,7 @@ def restoreFromBackup(backup, progress=lambda x: ()): if restore_fs_type != diskutil.fs_type_from_device(logs_partition): try: util.mkfs(restore_fs_type, logs_partition) - except Exception as e: + except OSError as e: raise RuntimeError("Failed to format logs filesystem (%s): %s" % (fs_type, e)) if efi_boot: