blob: bd57e9dd4b5b682a7682519c08de7494c2fbed46 [file] [log] [blame]
# Copyright 2007 Google Inc. Released under the GPL v2
This module defines the Guest class in the Host hierarchy.
Implementation details:
You should import the "hosts" package instead of importing each type of host.
Guest: a virtual machine on which you can run programs
__author__ = """ (Martin J. Bligh), (Benjamin Poirier), (Ryan Stutsman)
from autotest_lib.server.hosts import ssh_host
class Guest(ssh_host.SSHHost):
This class represents a virtual machine on which you can run
It is not the machine autoserv is running on.
Implementation details:
This is an abstract class, leaf subclasses must implement the methods
listed here and in parent classes which have no implementation. They
may reimplement methods which already have an implementation. You
must not instantiate this class but should instantiate one of those
leaf subclasses.
controlling_hypervisor = None
def _initialize(self, controlling_hypervisor, *args, **dargs):
Construct a Guest object
controlling_hypervisor: Hypervisor object that is
responsible for the creation and management of
this guest
hostname = controlling_hypervisor.new_guest()
super(Guest, self)._initialize(hostname, *args, **dargs)
self.controlling_hypervisor = controlling_hypervisor
def __del__(self):
Destroy a Guest object
super(Guest, self).__del__()
def hardreset(self, timeout=600, wait=True):
Perform a "hardreset" of the guest.
It is restarted through the hypervisor. That will restart it
even if the guest otherwise innaccessible through ssh.
return self.controlling_hypervisor.reset_guest(self.hostname)