GceManager
public
class
GceManager
extends Object
| java.lang.Object | |
| ↳ | com.android.tradefed.device.cloud.GceManager |
Helper qui gère les appels GCE pour démarrer/arrêter et collecter les journaux de GCE.
Résumé
Constantes | |
|---|---|
String |
GCE_HOSTNAME_KEY
|
String |
GCE_INSTANCE_CLEANED_KEY
|
String |
GCE_INSTANCE_NAME_KEY
|
String |
GCE_IP_PRECONFIGURED_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 celui-ci temporairement pour assurer la rétrocompatibilité. |
|
GceManager(DeviceDescriptor deviceDesc, TestDeviceOptions deviceOptions, IBuildInfo buildInfo, String gceInstanceName, String gceHost)
Ctor, variation that can be used to provide the GCE instance name to use directly. |
|
Méthodes publiques | |
|---|---|
static
boolean
|
AcloudShutdown(TestDeviceOptions options, IRunUtil runUtil, String instanceName, String hostname, boolean isIpPreconfigured)
Exécution Acloud réelle pour arrêter l'appareil virtuel. |
void
|
cleanUp()
|
static
File
|
getBugreportzWithSsh(GceAvdInfo gceAvd, TestDeviceOptions options, IRunUtil runUtil)
Obtenez un bugreportz depuis l'appareil à l'aide de ssh pour éviter tout problème potentiel de connexion adb. |
HostOrchestratorUtil
|
getHostOrchestratorUtil()
Renvoie l'instance de |
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)
Obtenez un rapport de bug via SSH pour une instance imbriquée. |
static
void
|
logAndDeleteFile(File tempFile, String dataName, ITestLogger logger)
|
static
void
|
logDirectory(File remoteDirectory, String baseName, ITestLogger logger, LogDataType type)
|
static
boolean
|
logNestedRemoteFile(ITestLogger logger, GceAvdInfo gceAvd, TestDeviceOptions options, IRunUtil runUtil, String remoteFilePath, LogDataType type)
Récupérez un fichier distant à partir d'une instance imbriquée et enregistrez-le. |
static
boolean
|
logNestedRemoteFile(ITestLogger logger, GceAvdInfo gceAvd, TestDeviceOptions options, IRunUtil runUtil, String remoteFilePath, LogDataType type, String baseName)
Récupérez un fichier distant à partir d'une instance imbriquée et enregistrez-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 à distance via SSH sur une instance. |
boolean
|
shutdownGce()
Arrêtez l'instance GCE associée à |
GceAvdInfo
|
startGce(String ipDevice, String user, Integer offset, MultiMap<String, String> attributes, ITestLogger logger)
Essayez de démarrer une instance GCE avec Acloud ou Oxygen. |
GceAvdInfo
|
startGce()
|
GceAvdInfo
|
startGce(String ipDevice, MultiMap<String, String> attributes)
Tentative de démarrage d'une instance GCE. |
GceAvdInfo
|
startGce(String ipDevice, String user, Integer offset, MultiMap<String, String> attributes)
Essayez de démarrer une instance GCE avec Acloud ou Oxygen. |
|
startMultiDevicesGce(
Cette méthode est obsolète. Supprimez ce texte une fois la branche principale mise à jour. |
|
startMultiDevicesGce(
Tentative de démarrage d'une instance GCE multi-appareils avec Oxygen. |
Méthodes protégées | |
|---|---|
static
|
buildShutdownCommand(File config, TestDeviceOptions options, String instanceName, String hostname, boolean isIpPreconfigured)
|
String
|
extractInstanceName(String bootupLogs)
Récupérez le nom de l'instance à partir des journaux de démarrage GCE. |
Constantes
GCE_HOSTNAME_KEY
public static final String GCE_HOSTNAME_KEY
Valeur constante : "gce-hostname"
GCE_INSTANCE_CLEANED_KEY
public static final String GCE_INSTANCE_CLEANED_KEY
Valeur constante : "gce-instance-clean-called"
GCE_INSTANCE_NAME_KEY
public static final String GCE_INSTANCE_NAME_KEY
Valeur constante : "gce-instance-name"
GCE_IP_PRECONFIGURED_KEY
public static final String GCE_IP_PRECONFIGURED_KEY
Valeur constante : "gce-ip-pre-configured"
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 le build GCE à démarrer. |
GceManager
public GceManager (DeviceDescriptor deviceDesc, TestDeviceOptions deviceOptions, IBuildInfo buildInfo,testResourceBuildInfos)
Ce constructeur est obsolète.
Utilisez d'autres constructeurs. Nous conservons celui-ci 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, variation that can be used to provide the GCE instance name to use directly.
| Paramètres | |
|---|---|
deviceDesc |
DeviceDescriptor : DeviceDescriptor qui sera associé à l'appareil GCE. |
deviceOptions |
TestDeviceOptions : TestDeviceOptions associé à l'appareil |
buildInfo |
IBuildInfo : IBuildInfo décrivant le build 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, boolean isIpPreconfigured)
Exécution Acloud réelle 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 Oxygen cuttlefish. |
isIpPreconfigured |
boolean : indique si l'AVD a été créé sur un appareil distant avec une adresse IP préconfigurée. |
| Renvoie | |
|---|---|
boolean |
"True" si l'opération a réussi. |
cleanUp
public void cleanUp ()
getBugreportzWithSsh
public static File getBugreportzWithSsh (GceAvdInfo gceAvd, TestDeviceOptions options, IRunUtil runUtil)
Obtenez un bugreportz depuis l'appareil à l'aide de ssh pour éviter tout problème potentiel de connexion adb.
| Paramètres | |
|---|---|
gceAvd |
GceAvdInfo : GceAvdInfo décrivant l'appareil. |
options |
TestDeviceOptions : TestDeviceOptions décrivant les options de l'appareil à utiliser pour l'appareil GCE. |
runUtil |
IRunUtil : un IRunUtil pour exécuter des commandes. |
| Renvoie | |
|---|---|
File |
Fichier pointant vers le rapport de bug ZIP, ou null si un problème s'est produit. |
| Génère | |
|---|---|
|
IOException |
getHostOrchestratorUtil
public HostOrchestratorUtil getHostOrchestratorUtil ()
Renvoie l'instance de HostOrchestratorUtil.
| Renvoie | |
|---|---|
HostOrchestratorUtil |
|
getInstanceSerialLog
public static String getInstanceSerialLog (GceAvdInfo infos, File avdConfigFile, File jsonKeyFile, IRunUtil runUtil)
Lit le contenu actuel du journal 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 : un IRunUtil pour 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)
Obtenez 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 décrivant l'appareil. |
options |
TestDeviceOptions : TestDeviceOptions décrivant les options de l'appareil à utiliser pour l'appareil GCE. |
runUtil |
IRunUtil : un IRunUtil pour exécuter des commandes. |
| Renvoie | |
|---|---|
File |
Fichier pointant vers le rapport de bug ZIP, ou null si un problème s'est produit. |
| Génère | |
|---|---|
|
IOException |
logAndDeleteFile
public static void logAndDeleteFile (File tempFile,
String dataName,
ITestLogger logger)| Paramètres | |
|---|---|
tempFile |
File |
dataName |
String |
logger |
ITestLogger |
logDirectory
public static void logDirectory (File remoteDirectory,
String baseName,
ITestLogger logger,
LogDataType type)| Paramètres | |
|---|---|
remoteDirectory |
File |
baseName |
String |
logger |
ITestLogger |
type |
LogDataType |
logNestedRemoteFile
public static boolean logNestedRemoteFile (ITestLogger logger, GceAvdInfo gceAvd, TestDeviceOptions options, IRunUtil runUtil, String remoteFilePath, LogDataType type)
Récupérez un fichier distant à partir d'une instance imbriquée et enregistrez-le.
| Paramètres | |
|---|---|
logger |
ITestLogger : ITestLogger où enregistrer le fichier. |
gceAvd |
GceAvdInfo : GceAvdInfo décrivant l'appareil. |
options |
TestDeviceOptions : TestDeviceOptions décrivant les options de l'appareil à utiliser pour l'appareil GCE. |
runUtil |
IRunUtil : un IRunUtil pour exécuter des commandes. |
remoteFilePath |
String : chemin d'accès distant au fichier. |
type |
LogDataType : LogDataType du fichier journalisé. |
| Renvoie | |
|---|---|
boolean |
indique si le fichier a bien été enregistré. |
logNestedRemoteFile
public static boolean logNestedRemoteFile (ITestLogger logger, GceAvdInfo gceAvd, TestDeviceOptions options, IRunUtil runUtil, String remoteFilePath, LogDataType type, String baseName)
Récupérez un fichier distant à partir d'une instance imbriquée et enregistrez-le.
| Paramètres | |
|---|---|
logger |
ITestLogger : ITestLogger où enregistrer le fichier. |
gceAvd |
GceAvdInfo : GceAvdInfo décrivant l'appareil. |
options |
TestDeviceOptions : TestDeviceOptions décrivant les options de l'appareil à utiliser pour l'appareil GCE. |
runUtil |
IRunUtil : un IRunUtil pour exécuter des commandes. |
remoteFilePath |
String : chemin d'accès distant au fichier. |
type |
LogDataType : LogDataType du fichier journalisé. |
baseName |
String : nom de base à utiliser pour enregistrer le fichier. Si la valeur est nulle, le nom de fichier réel sera utilisé. |
| Renvoie | |
|---|---|
boolean |
indique si le fichier a bien été enregistré. |
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 à distance via SSH sur une instance.
| Paramètres | |
|---|---|
gceAvd |
GceAvdInfo : GceAvdInfo décrivant l'appareil. |
options |
TestDeviceOptions : TestDeviceOptions décrivant les options de l'appareil à utiliser pour l'appareil GCE. |
runUtil |
IRunUtil : un IRunUtil pour 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 d'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, String user, Integer offset, MultiMap<String, String> attributes, ITestLogger logger)
Essayez de démarrer une instance GCE avec Acloud ou Oxygen.
| Paramètres | |
|---|---|
ipDevice |
String : adresse IP initiale de l'instance GCE dans laquelle exécuter l'AVD, null si non applicable |
user |
String : utilisateur hôte exécutant l'AVD, null si non applicable |
offset |
Integer : décalage du numéro de l'appareil de l'AVD dans l'hôte, null si non applicable |
attributes |
MultiMap : attributs associés à l'invocation actuelle, utilisés pour transmettre les informations applicables à l'instance GCE à ajouter en tant que métadonnées de VM. |
logger |
ITestLogger : ITestLogger où enregistrer les journaux de lancement de l'appareil. |
| Renvoie | |
|---|---|
GceAvdInfo |
GceAvdInfo décrivant l'instance GCE. Il peut s'agir d'une instance BOOT_FAIL. |
| Génère | |
|---|---|
|
com.android.tradefed.targetprep.TargetSetupError |
TargetSetupError |
|
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'invocation actuelle, utilisés pour transmettre les informations applicables à l'instance GCE à ajouter en tant que métadonnées de VM. |
| Renvoie | |
|---|---|
GceAvdInfo |
GceAvdInfo décrivant l'instance GCE. Il peut s'agir d'une instance BOOT_FAIL. |
| Génère | |
|---|---|
|
com.android.tradefed.targetprep.TargetSetupError |
TargetSetupError |
|
startGce
public GceAvdInfo startGce (String ipDevice, String user, Integer offset, MultiMap<String, String> attributes)
Essayez de démarrer une instance GCE avec Acloud ou Oxygen.
| Paramètres | |
|---|---|
ipDevice |
String : adresse IP initiale de l'instance GCE dans laquelle exécuter l'AVD, null si non applicable |
user |
String : utilisateur hôte exécutant l'AVD, null si non applicable |
offset |
Integer : décalage du numéro de l'appareil de l'AVD dans l'hôte, null si non applicable |
attributes |
MultiMap : attributs associés à l'invocation actuelle, utilisés pour transmettre les informations applicables à l'instance GCE à ajouter en tant que métadonnées de VM. |
| Renvoie | |
|---|---|
GceAvdInfo |
GceAvdInfo décrivant l'instance GCE. Il peut s'agir d'une instance BOOT_FAIL. |
| Génère | |
|---|---|
|
com.android.tradefed.targetprep.TargetSetupError |
TargetSetupError |
|
startMultiDevicesGce
publicstartMultiDevicesGce ( buildInfos)
Cette méthode est obsolète.
Remove this after master branch is updated.
| Paramètres | |
|---|---|
buildInfos |
|
| Renvoie | |
|---|---|
|
|
| Génère | |
|---|---|
TargetSetupError |
|
startMultiDevicesGce
publicstartMultiDevicesGce ( buildInfos, MultiMap<String, String> attributes)
Tentative de démarrage d'une instance GCE multi-appareils avec Oxygen.
| Paramètres | |
|---|---|
buildInfos |
: ERROR(/List |
attributes |
MultiMap : attributs associés à l'invocation actuelle. |
| Renvoie | |
|---|---|
|
ERROR(/List décrivant les informations AVD GCE. |
| Génère | |
|---|---|
TargetSetupError |
|
Méthodes protégées
buildShutdownCommand
protected staticbuildShutdownCommand (File config, TestDeviceOptions options, String instanceName, String hostname, boolean isIpPreconfigured)
| Paramètres | |
|---|---|
config |
File |
options |
TestDeviceOptions |
instanceName |
String |
hostname |
String |
isIpPreconfigured |
boolean |
| Renvoie | |
|---|---|
|
|
extractInstanceName
protected String extractInstanceName (String bootupLogs)
Récupérez le nom de l'instance à partir des journaux de démarrage GCE. Recherchez le modèle "name": "gce-
| Paramètres | |
|---|---|
bootupLogs |
String |
| Renvoie | |
|---|---|
String |
|