• Home
  • Raw
  • Download

Lines Matching +full:write +full:- +full:host

3 # Use of this source code is governed by a BSD-style license that can be
30 * For the full deployment case, install dev-signed RO firmware
39 * Every servo host is up and running, and accessible via SSH.
85 _LOG_FORMAT = '%(asctime)s | %(levelname)-10s | %(message)s'
91 _LOG_BUCKET_NAME = 'chromeos-install-logs'
93 _OMAHA_STATUS = 'gs://chromeos-build-release-console/omaha_status.json'
96 # host's prior state.
97 _LOCK_REASON_EXISTING = 'Repairing or deploying an existing host'
98 _LOCK_REASON_NEW_HOST = 'Repairing or deploying a new host'
122 def write(self, s): member in _MultiFileWriter
123 """Write a string to the files.
125 @param s Write this string.
128 file.write(s)
158 R##-####.#.#. Will return `None` if no Beta channel
163 omaha_board = board.replace('_', '-')
169 return 'R%s-%s' % (milestone, build)
185 the most up-to-date version.
197 @param report_log File-like object for logging report output.
209 report_log.write('AFE version is %s.\n' % afe_cros)
210 report_log.write('Omaha version is %s.\n' % omaha_cros)
211 report_log.write('AFE firmware is %s.\n' % afe_fw)
226 report_log.write('Selected version %s is too old; '
248 report_log.write(_DIVIDER)
249 report_log.write('Repair CrOS version for board %s is now %s.\n' %
252 report_log.write('Firmware version for model %s is now %s.\n' %
260 This host object is used to update AFE label information for the DUT, but
261 can not be used for installation image on the DUT. In particular, this host
266 @param afe_host AFE Host object for the DUT.
277 """Lock a host in the AFE, and report whether it succeeded.
282 @param afe_host AFE Host instance to be locked.
287 logging.warning('Locking host now.')
297 """Unlock a host in the AFE, and report whether it succeeded.
302 @param afe_host AFE Host instance to be unlocked.
307 logging.warning('Unlocking host.')
316 """Update the attributes for a given host.
319 @param hostname Host name of the DUT.
321 host.
338 """Extract servo attributes from the host attribute dict, setting defaults.
358 Poll the host with the given `host_id` via `afe`, waiting for it
362 @param host_id Id of the host that's expected to become idle.
376 running on the given `afe_host`, abort it, then wait for the host to
380 @param afe_host Host to be aborted.
382 @return A true value if the host is idle at return, or a false value
383 if the host wasn't idle after some reasonable time.
390 # * Host status on the master can lag actual status on the shard
392 # guaranteed to post-date the call to lock the DUT.
404 """Get an AFE Host object for the given host.
406 If the host is found in the database, return the object
409 If no host is found, create one with appropriate servo
413 @param hostname Host name of the DUT.
415 host.
419 whether the Host should be unlocked if subsequent operations
430 raise Exception('Failed to lock host')
433 raise Exception('Failed to abort host, and failed to unlock it')
434 raise Exception('Failed to abort task on host')
435 # This host was pre-existing; if the user didn't supply
475 'provided %s %s does not match the %s %s for host %s' %
480 def _create_host_for_installation(host, arguments): argument
483 The host object yielded by the returned context manager is agnostic of the
487 @param host: A server.hosts.CrosHost object.
492 info = host.host_info_store.get()
493 s_host, s_port, s_serial = _extract_servo_attributes(host.hostname,
495 return preparedut.create_host(host.hostname, arguments.board,
500 def _install_test_image(host, arguments): argument
506 @param host Host instance for the DUT being installed.
509 repair_image = _get_cros_repair_image_name(host)
515 preparedut.download_image_to_servo_usb(host, repair_image)
523 preparedut.flash_firmware_using_servo(host, repair_image)
525 logging.debug('Install FW by chromeos-firmwareupdate.')
526 preparedut.install_firmware(host, arguments.force_firmware)
531 else 'chromeos-firmwareupdate')
535 preparedut.install_test_image(host)
538 raise Exception('chromeos-install failed')
544 First, lock the host if it exists and is unlocked. Then,
553 @param hostname Host name of the DUT.
555 host.
560 host = None
562 host = _create_host(hostname, afe, afe_host)
563 with _create_host_for_installation(host, arguments) as host_to_install:
567 host.labels.update_labels(host)
571 platform = host.get_platform()
582 logging.error('Failed to unlock host!')
585 if host is not None:
586 host.close()
598 @param hostname Host name of the DUT to install on.
631 followed by a divider line. Then results are printed, one host
634 @param report_log File-like object for logging report
643 report_log.write(heading)
644 report_log.write(_DIVIDER)
646 report_log.write('{result.hostname:30} {result.message}\n'
648 report_log.write('\n')
659 @param report_log File-like object for logging report output.
663 corresponding host succeeded.
679 'Host already in %s' % label)
685 'Host added to %s' % _DEFAULT_POOL)
687 report_log.write(_DIVIDER)
690 report_log.write(
717 Return a list of used servo ports for the given servo host.
719 @param servo_hostname: Hostname of the servo host to check for.
722 @returns a list of used ports for the given servo host.
727 for host in host_list:
728 afe_host = afe.get_hosts(hostname=host)
740 @param servo_hostname: Hostname of the servo host.
742 for the given servo host.
745 @returns a free servo port if servo_hostname is non-empty, otherwise an
752 # inferred from the dut hostname (by appending '-servo' to it). We only
757 # If we haven't checked this servo host yet, check the AFE if other duts
758 # used this servo host and grab the ports specified for them.
767 end_port = start_port - 99
769 for port in xrange(start_port, end_port - 1, -1):
780 Get the servo port from the afe if it matches the same servo host hostname.
784 @returns Servo port (int) if servo host hostname matches the one specified
787 @raises _NoAFEServoPortError: When there is no stored host info or servo
788 port host attribute in the AFE for the given host.
807 Get host attributes if a hostname_file was supplied.
821 # If the host already has an entry in the AFE that matches the same
822 # servo host hostname and the servo port is set, use that port.
834 def _get_cros_repair_image_name(host): argument
835 """Get the CrOS repair image name for given host.
837 @param host: hosts.CrosHost object. This object need not have an AFE
840 info = host.host_info_store.get()
842 raise InstallFailedError('Unknown board for given host')
852 dev-signed firmware on the DUT prior to installing the test
861 sys.stderr.write('Installation output logs in %s\n' % arguments.logdir)
881 report_log.write('Dry run - installation and most testing '
894 sys.stderr.write('Logs will be uploaded to %s\n' % (gspath,))
901 sys.stderr.write('Failed to upload logs;'