GceManager
public
class
GceManager
extends Object
java.lang.Object | |
↳ | com.android.tradefed.device.cloud.GceManager |
Assistant qui gère les appels GCE pour démarrer/arrêter et collecter les journaux de GCE.
Résumé
Champs | |
---|---|
public
static
final
String |
GCE_HOSTNAME_KEY
|
public
static
final
String |
GCE_INSTANCE_CLEANED_KEY
|
public
static
final
String |
GCE_INSTANCE_NAME_KEY
|
Constructeurs publics | |
---|---|
GceManager(DeviceDescriptor deviceDesc, TestDeviceOptions deviceOptions, IBuildInfo buildInfo)
Ctor |
|
GceManager(DeviceDescriptor deviceDesc, TestDeviceOptions deviceOptions, IBuildInfo buildInfo,
Ce constructeur est obsolète. Utilisez d'autres constructeurs. Nous conservons cette option temporairement pour assurer la rétrocompatibilité. |
|
GceManager(DeviceDescriptor deviceDesc, TestDeviceOptions deviceOptions, IBuildInfo buildInfo, String gceInstanceName, String gceHost)
Ctor, variante permettant de fournir le nom de l'instance GCE à utiliser directement. |
Méthodes publiques | |
---|---|
static
boolean
|
AcloudShutdown(TestDeviceOptions options, IRunUtil runUtil, String instanceName, String hostname)
Exécution réelle d'Acloud pour arrêter l'appareil virtuel. |
void
|
cleanUp()
|
static
File
|
getBugreportzWithSsh(GceAvdInfo gceAvd, TestDeviceOptions options, IRunUtil runUtil)
Obtenez un bugreportz de l'appareil à l'aide de ssh pour éviter tout problème de connexion adb potentiel. |
static
String
|
getInstanceSerialLog(GceAvdInfo infos, File avdConfigFile, File jsonKeyFile, IRunUtil runUtil)
Lit le contenu actuel du journal de série de l'instance Gce Avd. |
static
File
|
getNestedDeviceSshBugreportz(GceAvdInfo gceAvd, TestDeviceOptions options, IRunUtil runUtil)
Obtenir un rapport de bug via ssh pour une instance imbriquée |
static
void
|
logNestedRemoteFile(ITestLogger logger, GceAvdInfo gceAvd, TestDeviceOptions options, IRunUtil runUtil, String remoteFilePath, LogDataType type)
Extrayez un fichier distant à partir d'une instance imbriquée et consignez-le. |
static
void
|
logNestedRemoteFile(ITestLogger logger, GceAvdInfo gceAvd, TestDeviceOptions options, IRunUtil runUtil, String remoteFilePath, LogDataType type, String baseName)
Extrayez un fichier distant à partir d'une instance imbriquée et consignez-le. |
void
|
logSerialOutput(GceAvdInfo infos, ITestLogger logger)
Enregistrez la sortie série d'un appareil décrit par |
static
CommandResult
|
remoteSshCommandExecution(GceAvdInfo gceAvd, TestDeviceOptions options, IRunUtil runUtil, long timeoutMs, String... command)
Exécutez la commande distante via ssh sur une instance. |
boolean
|
shutdownGce()
Arrêtez l'instance GCE associée à |
GceAvdInfo
|
startGce()
|
GceAvdInfo
|
startGce(String ipDevice, MultiMap<String, String> attributes)
Tentative de démarrage d'une instance gce |
Méthodes protégées | |
---|---|
|
buildGceCmd(File reportFile, IBuildInfo b, String ipDevice, MultiMap<String, String> attributes)
Créez et renvoyez la commande permettant de lancer GCE. |
String
|
extractInstanceName(String bootupLogs)
Récupérez le nom de l'instance à partir des journaux de démarrage gce. |
Champs
GCE_HOSTNAME_KEY
public static final String GCE_HOSTNAME_KEY
GCE_INSTANCE_CLEANED_KEY
public static final String GCE_INSTANCE_CLEANED_KEY
GCE_INSTANCE_NAME_KEY
public static final String GCE_INSTANCE_NAME_KEY
Constructeurs publics
GceManager
public GceManager (DeviceDescriptor deviceDesc, TestDeviceOptions deviceOptions, IBuildInfo buildInfo)
Ctor
Paramètres | |
---|---|
deviceDesc |
DeviceDescriptor : DeviceDescriptor qui sera associé à l'appareil GCE. |
deviceOptions |
TestDeviceOptions : TestDeviceOptions associé à l'appareil. |
buildInfo |
IBuildInfo : IBuildInfo décrivant la compilation gce à démarrer.
|
GceManager
public GceManager (DeviceDescriptor deviceDesc, TestDeviceOptions deviceOptions, IBuildInfo buildInfo,testResourceBuildInfos)
Ce constructeur est obsolète.
Utilisez d'autres constructeurs. Nous conservons cette option temporairement pour assurer la rétrocompatibilité.
Paramètres | |
---|---|
deviceDesc |
DeviceDescriptor |
deviceOptions |
TestDeviceOptions |
buildInfo |
IBuildInfo |
testResourceBuildInfos |
|
GceManager
public GceManager (DeviceDescriptor deviceDesc, TestDeviceOptions deviceOptions, IBuildInfo buildInfo, String gceInstanceName, String gceHost)
Ctor, variante permettant de fournir le nom de l'instance GCE à utiliser directement.
Paramètres | |
---|---|
deviceDesc |
DeviceDescriptor : DeviceDescriptor qui sera associé à l'appareil GCE. |
deviceOptions |
TestDeviceOptions : TestDeviceOptions associé à l'appareil |
buildInfo |
IBuildInfo : IBuildInfo décrivant la compilation gce à démarrer. |
gceInstanceName |
String : nom de l'instance à utiliser. |
gceHost |
String : nom d'hôte ou adresse IP de l'instance à utiliser.
|
Méthodes publiques
AcloudShutdown
public static boolean AcloudShutdown (TestDeviceOptions options, IRunUtil runUtil, String instanceName, String hostname)
Exécution réelle d'Acloud pour arrêter l'appareil virtuel.
Paramètres | |
---|---|
options |
TestDeviceOptions : TestDeviceOptions pour les options Acloud |
runUtil |
IRunUtil : IRunUtil pour exécuter Acloud |
instanceName |
String : instance à arrêter. |
hostname |
String : nom d'hôte de l'instance, utilisé uniquement pour les cuttlefish Oxygen. |
Renvoie | |
---|---|
boolean |
"True" si la requête a réussi |
cleanUp
public void cleanUp ()
getBugreportzWithSsh
public static File getBugreportzWithSsh (GceAvdInfo gceAvd, TestDeviceOptions options, IRunUtil runUtil)
Obtenez un bugreportz de l'appareil à l'aide de ssh pour éviter tout problème de connexion adb potentiel.
Paramètres | |
---|---|
gceAvd |
GceAvdInfo : GceAvdInfo qui décrit l'appareil. |
options |
TestDeviceOptions : TestDeviceOptions décrivant les options d'appareil à utiliser pour l'appareil GCE. |
runUtil |
IRunUtil : IRunUtil permettant d'exécuter des commandes. |
Renvoie | |
---|---|
File |
Fichier pointant vers le bugreport ZIP, ou valeur nulle en cas de problème. |
getInstanceSerialLog
public static String getInstanceSerialLog (GceAvdInfo infos, File avdConfigFile, File jsonKeyFile, IRunUtil runUtil)
Lit le contenu actuel du journal de série de l'instance Gce Avd.
Paramètres | |
---|---|
infos |
GceAvdInfo : GceAvdInfo décrivant l'instance. |
avdConfigFile |
File : fichier de configuration de l'AVD |
jsonKeyFile |
File : fichier de clé JSON du compte de service. |
runUtil |
IRunUtil : IRunUtil permettant d'exécuter des commandes. |
Renvoie | |
---|---|
String |
Sortie du journal série ou valeur nulle en cas de problème. |
getNestedDeviceSshBugreportz
public static File getNestedDeviceSshBugreportz (GceAvdInfo gceAvd, TestDeviceOptions options, IRunUtil runUtil)
Obtenir un rapport de bug via ssh pour une instance imbriquée Pour ce faire, vous devez demander l'adb dans l'instance virtuelle imbriquée.
Paramètres | |
---|---|
gceAvd |
GceAvdInfo : GceAvdInfo qui décrit l'appareil. |
options |
TestDeviceOptions : TestDeviceOptions décrivant les options d'appareil à utiliser pour l'appareil GCE. |
runUtil |
IRunUtil : IRunUtil permettant d'exécuter des commandes. |
Renvoie | |
---|---|
File |
Fichier pointant vers le bugreport ZIP, ou valeur nulle en cas de problème. |
logNestedRemoteFile
public static void logNestedRemoteFile (ITestLogger logger, GceAvdInfo gceAvd, TestDeviceOptions options, IRunUtil runUtil, String remoteFilePath, LogDataType type)
Extrayez un fichier distant à partir d'une instance imbriquée et consignez-le.
Paramètres | |
---|---|
logger |
ITestLogger : ITestLogger où consigner le fichier. |
gceAvd |
GceAvdInfo : GceAvdInfo qui décrit l'appareil. |
options |
TestDeviceOptions : TestDeviceOptions décrivant les options d'appareil à utiliser pour l'appareil GCE. |
runUtil |
IRunUtil : IRunUtil permettant d'exécuter des commandes. |
remoteFilePath |
String : chemin d'accès distant du fichier. |
type |
LogDataType : LogDataType du fichier journalisé.
|
logNestedRemoteFile
public static void logNestedRemoteFile (ITestLogger logger, GceAvdInfo gceAvd, TestDeviceOptions options, IRunUtil runUtil, String remoteFilePath, LogDataType type, String baseName)
Extrayez un fichier distant à partir d'une instance imbriquée et consignez-le.
Paramètres | |
---|---|
logger |
ITestLogger : ITestLogger où consigner le fichier. |
gceAvd |
GceAvdInfo : GceAvdInfo qui décrit l'appareil. |
options |
TestDeviceOptions : TestDeviceOptions décrivant les options d'appareil à utiliser pour l'appareil GCE. |
runUtil |
IRunUtil : IRunUtil permettant d'exécuter des commandes. |
remoteFilePath |
String : chemin d'accès distant du fichier. |
type |
LogDataType : LogDataType du fichier journalisé. |
baseName |
String : nom de base à utiliser pour consigner le fichier. Si la valeur est nulle, le nom de fichier réel est utilisé.
|
logSerialOutput
public void logSerialOutput (GceAvdInfo infos, ITestLogger logger)
Enregistrez la sortie série d'un appareil décrit par GceAvdInfo
.
Paramètres | |
---|---|
infos |
GceAvdInfo : GceAvdInfo décrivant l'instance. |
logger |
ITestLogger : ITestLogger où enregistrer le journal série.
|
remoteSshCommandExecution
public static CommandResult remoteSshCommandExecution (GceAvdInfo gceAvd, TestDeviceOptions options, IRunUtil runUtil, long timeoutMs, String... command)
Exécutez la commande distante via ssh sur une instance.
Paramètres | |
---|---|
gceAvd |
GceAvdInfo : GceAvdInfo qui décrit l'appareil. |
options |
TestDeviceOptions : TestDeviceOptions décrivant les options d'appareil à utiliser pour l'appareil GCE. |
runUtil |
IRunUtil : IRunUtil permettant d'exécuter des commandes. |
timeoutMs |
long : délai d'expiration de la commande, en millisecondes. 0 signifie qu'il n'y a pas de délai avant expiration. |
command |
String : commande à exécuter à distance. |
Renvoie | |
---|---|
CommandResult |
CommandResult contenant le résultat de l'exécution.
|
shutdownGce
public boolean shutdownGce ()
Arrêtez l'instance GCE associée à startGce()
.
Renvoie | |
---|---|
boolean |
Renvoie "true" si l'arrêt de gce a été demandé comme non bloquant. |
startGce
public GceAvdInfo startGce (String ipDevice, MultiMap<String, String> attributes)
Tentative de démarrage d'une instance gce
Paramètres | |
---|---|
ipDevice |
String : adresse IP initiale de l'instance GCE dans laquelle exécuter l'AVD, null si non applicable |
attributes |
MultiMap : attributs associés à l'appel en cours, utilisés pour transmettre les informations applicables à l'instance GCE afin qu'elles soient ajoutées en tant que métadonnées de VM |
Renvoie | |
---|---|
GceAvdInfo |
un GceAvdInfo décrivant l'instance GCE. Il peut s'agir d'une instance BOOT_FAIL. |
Génère | |
---|---|
TargetSetupError |
Méthodes protégées
buildGceCmd
protectedbuildGceCmd (File reportFile, IBuildInfo b, String ipDevice, MultiMap<String, String> attributes)
Créez et renvoyez la commande permettant de lancer GCE. Exposé à des fins de test.
Paramètres | |
---|---|
reportFile |
File |
b |
IBuildInfo |
ipDevice |
String |
attributes |
MultiMap |
Renvoie | |
---|---|
|
extractInstanceName
protected String extractInstanceName (String bootupLogs)
Récupérez le nom de l'instance dans les journaux de démarrage gce. Recherchez le format "name": "gce-
Paramètres | |
---|---|
bootupLogs |
String |
Renvoie | |
---|---|
String |