def reboot_setup(self): # save the partition list and mount points, as well as the cpu count partition_list = partition_lib.get_partition_list(self, exclude_swap=False) mount_info = partition_lib.get_mount_info(partition_list) self._state.set('client', 'mount_info', mount_info) self._state.set('client', 'cpu_count', utils.count_cpus())
def _check_post_reboot(self, subdir, running_id=None): """ Function to perform post boot checks such as if the system configuration has changed across reboots (specifically, CPUs and partitions). @param subdir: The subdir to use in the job.record call. @param running_id: An optional running_id to include in the reboot failure log message @raise JobError: Raised if the current configuration does not match the pre-reboot configuration. """ abort_on_mismatch = GLOBAL_CONFIG.get_config_value('CLIENT', 'abort_on_mismatch', type=bool, default=False) # check to see if any partitions have changed partition_list = partition_lib.get_partition_list(self, exclude_swap=False) mount_info = partition_lib.get_mount_info(partition_list) old_mount_info = self._state.get('client', 'mount_info') if mount_info != old_mount_info: new_entries = mount_info - old_mount_info old_entries = old_mount_info - mount_info description = ("mounted partitions are different after reboot " "(old entries: %s, new entries: %s)" % (old_entries, new_entries)) if abort_on_mismatch: self._record_reboot_failure(subdir, "reboot.verify_config", description, running_id=running_id) raise error.JobError("Reboot failed: %s" % description) else: logging.warning(description) # check to see if any CPUs have changed cpu_count = utils.count_cpus() old_count = self._state.get('client', 'cpu_count') if cpu_count != old_count: description = ('Number of CPUs changed after reboot ' '(old count: %d, new count: %d)' % (old_count, cpu_count)) if abort_on_mismatch: self._record_reboot_failure(subdir, 'reboot.verify_config', description, running_id=running_id) raise error.JobError('Reboot failed: %s' % description) else: logging.warning(description)
def _check_post_reboot(self, subdir, running_id=None): """ Function to perform post boot checks such as if the system configuration has changed across reboots (specifically, CPUs and partitions). @param subdir: The subdir to use in the job.record call. @param running_id: An optional running_id to include in the reboot failure log message @raise JobError: Raised if the current configuration does not match the pre-reboot configuration. """ # check to see if any partitions have changed partition_list = partition_lib.get_partition_list(self, exclude_swap=False) mount_info = partition_lib.get_mount_info(partition_list) old_mount_info = self._state.get("client", "mount_info") if mount_info != old_mount_info: new_entries = mount_info - old_mount_info old_entries = old_mount_info - mount_info description = "mounted partitions are different after reboot " "(old entries: %s, new entries: %s)" % ( old_entries, new_entries, ) self._record_reboot_failure(subdir, "reboot.verify_config", description, running_id=running_id) raise error.JobError("Reboot failed: %s" % description) # check to see if any CPUs have changed cpu_count = utils.count_cpus() old_count = self._state.get("client", "cpu_count") if cpu_count != old_count: description = "Number of CPUs changed after reboot " "(old count: %d, new count: %d)" % ( old_count, cpu_count, ) self._record_reboot_failure(subdir, "reboot.verify_config", description, running_id=running_id) raise error.JobError("Reboot failed: %s" % description)