GceManager
public class GceManager
extends Object
java.lang.Object | |
↳ | com.android.tradefed.device.cloud.GceManager |
GCEからログを開始/停止および収集するためのGCE呼び出しを管理するヘルパー。
概要
田畑 | |
---|---|
public static final String | GCE_HOSTNAME_KEY |
public static final String | GCE_INSTANCE_CLEANED_KEY |
public static final String | GCE_INSTANCE_NAME_KEY
|
パブリックコンストラクター | |
---|---|
GceManager (DeviceDescriptor deviceDesc, TestDeviceOptions deviceOptions, IBuildInfo buildInfo) コンストラクター | |
GceManager (DeviceDescriptor deviceDesc, TestDeviceOptions deviceOptions, IBuildInfo buildInfo, testResourceBuildInfos) GceManager (DeviceDescriptor deviceDesc, TestDeviceOptions deviceOptions, IBuildInfo buildInfo, testResourceBuildInfos) このコンストラクターは非推奨です。他のコンストラクターを使用します。下位互換性のためにこれを一時的に保持します。 | |
GceManager (DeviceDescriptor deviceDesc, TestDeviceOptions deviceOptions, IBuildInfo buildInfo, String gceInstanceName, String gceHost) Ctor、直接使用するGCEインスタンス名を提供するために使用できるバリエーション。 |
パブリックメソッド | |
---|---|
static boolean | AcloudShutdown (TestDeviceOptions options, IRunUtil runUtil, String instanceName, String hostname) 実際のAcloudを実行して、仮想デバイスをシャットダウンします。 |
void | cleanUp () |
static File | getBugreportzWithSsh ( GceAvdInfo gceAvd, TestDeviceOptions options, IRunUtil runUtil) sshを使用してデバイスからbugreportzを取得し、adb接続の潜在的な問題を回避します。 |
static String | getInstanceSerialLog ( GceAvdInfo infos, File avdConfigFile, File jsonKeyFile, IRunUtil runUtil) GceAvdインスタンスのシリアルログの現在の内容を読み取ります。 |
static File | getNestedDeviceSshBugreportz ( GceAvdInfo gceAvd, TestDeviceOptions options, IRunUtil runUtil) ネストされたインスタンスのssh経由でバグレポートを取得します。 |
static void | logNestedRemoteFile (ITestLogger logger, GceAvdInfo gceAvd, TestDeviceOptions options, IRunUtil runUtil, String remoteFilePath, LogDataType type) ネストされたインスタンスからリモートファイルをフェッチしてログに記録します。 |
static void | logNestedRemoteFile (ITestLogger logger, GceAvdInfo gceAvd, TestDeviceOptions options, IRunUtil runUtil, String remoteFilePath, LogDataType type, String baseName) ネストされたインスタンスからリモートファイルをフェッチしてログに記録します。 |
void | logSerialOutput ( GceAvdInfo infos, ITestLogger logger) 記載されたデバイスのシリアル出力ログ |
static CommandResult | remoteSshCommandExecution ( GceAvdInfo gceAvd, TestDeviceOptions options, IRunUtil runUtil, long timeoutMs, String... command) インスタンスでsshを介してリモートコマンドを実行します。 |
boolean | shutdownGce () シャットダウン付きassociated GCEインスタンス |
GceAvdInfo | startGce () |
GceAvdInfo | startGce (String ipDevice, MultiMap<String, String> attributes) gceインスタンスの開始を試みます |
保護されたメソッド | |
---|---|
buildGceCmd (File reportFile, IBuildInfo b, String ipDevice, MultiMap<String, String> attributes) GCEを起動するコマンドをビルドして返します。 | |
String | extractInstanceName (String bootupLogs) gceブートログからインスタンス名を取得します。 |
田畑
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
パブリックコンストラクター
GceManager
public GceManager (DeviceDescriptor deviceDesc, TestDeviceOptions deviceOptions, IBuildInfo buildInfo)
コンストラクター
パラメーター | |
---|---|
deviceDesc | DeviceDescriptor : DeviceDescriptor GCEデバイスに関連付けられます。 |
deviceOptions | TestDeviceOptions :AのTestDeviceOptions デバイスに関連付けられています。 |
buildInfo | IBuildInfo :A IBuildInfo 開始にGCEビルドを記述する。 |
GceManager
public GceManager (DeviceDescriptor deviceDesc, TestDeviceOptions deviceOptions, IBuildInfo buildInfo,testResourceBuildInfos)
このコンストラクターは非推奨です。
他のコンストラクターを使用します。下位互換性のためにこれを一時的に保持します。
パラメーター | |
---|---|
deviceDesc | DeviceDescriptor |
deviceOptions | TestDeviceOptions |
buildInfo | IBuildInfo |
testResourceBuildInfos |
GceManager
public GceManager (DeviceDescriptor deviceDesc, TestDeviceOptions deviceOptions, IBuildInfo buildInfo, String gceInstanceName, String gceHost)
Ctor、直接使用するGCEインスタンス名を提供するために使用できるバリエーション。
パラメーター | |
---|---|
deviceDesc | DeviceDescriptor : DeviceDescriptor GCEデバイスに関連付けられます。 |
deviceOptions | TestDeviceOptions :AのTestDeviceOptions デバイスに関連付けられています |
buildInfo | IBuildInfo :A IBuildInfo 開始にGCEビルドを記述する。 |
gceInstanceName | String :インスタンス名を使用します。 |
gceHost | String :使用するインスタンスのホスト名またはIP。 |
パブリックメソッド
AcloudShutdown
public static boolean AcloudShutdown (TestDeviceOptions options, IRunUtil runUtil, String instanceName, String hostname)
実際のAcloudを実行して、仮想デバイスをシャットダウンします。
パラメーター | |
---|---|
options | TestDeviceOptions : TestDeviceOptions Acloudオプションの |
runUtil | IRunUtil : IRunUtil Acloudを実行します |
instanceName | String :シャットダウンするインスタンス。 |
hostname | String :インスタンスのホスト名は、酸素のみのイカを使用します。 |
戻り値 | |
---|---|
boolean | 成功した場合はTrue |
掃除
public void cleanUp ()
getBugreportzWithSsh
public static File getBugreportzWithSsh (GceAvdInfo gceAvd, TestDeviceOptions options, IRunUtil runUtil)
sshを使用してデバイスからbugreportzを取得し、adb接続の潜在的な問題を回避します。
パラメーター | |
---|---|
gceAvd | GceAvdInfo : GceAvdInfo 装置が記載されています。 |
options | TestDeviceOptions : TestDeviceOptions GCE装置に使用されるデバイス・オプションを記述する。 |
runUtil | IRunUtil : IRunUtil コマンドを実行します。 |
戻り値 | |
---|---|
File | zipバグレポートを指すファイル。問題が発生した場合はnull。 |
getInstanceSerialLog
public static String getInstanceSerialLog (GceAvdInfo infos, File avdConfigFile, File jsonKeyFile, IRunUtil runUtil)
GceAvdインスタンスのシリアルログの現在の内容を読み取ります。
パラメーター | |
---|---|
infos | GceAvdInfo : GceAvdInfo インスタンスを記述する。 |
avdConfigFile | File :AVD設定ファイル |
jsonKeyFile | File :サービスアカウントJSONキーファイル。 |
runUtil | IRunUtil : IRunUtil コマンドを実行します。 |
戻り値 | |
---|---|
String | シリアルログ出力。問題が発生した場合はnull。 |
getNestedDeviceSshBugreportz
public static File getNestedDeviceSshBugreportz (GceAvdInfo gceAvd, TestDeviceOptions options, IRunUtil runUtil)
ネストされたインスタンスのssh経由でバグレポートを取得します。これには、ネストされた仮想インスタンスでadbをリクエストする必要があります。
パラメーター | |
---|---|
gceAvd | GceAvdInfo : GceAvdInfo 装置が記載されています。 |
options | TestDeviceOptions : TestDeviceOptions GCE装置に使用されるデバイス・オプションを記述する。 |
runUtil | IRunUtil : IRunUtil コマンドを実行します。 |
戻り値 | |
---|---|
File | zipバグレポートを指すファイル。問題が発生した場合はnull。 |
logNestedRemoteFile
public static void logNestedRemoteFile (ITestLogger logger, GceAvdInfo gceAvd, TestDeviceOptions options, IRunUtil runUtil, String remoteFilePath, LogDataType type)
ネストされたインスタンスからリモートファイルをフェッチしてログに記録します。
パラメーター | |
---|---|
logger | ITestLogger : ITestLogger ファイルをログに記録します。 |
gceAvd | GceAvdInfo : GceAvdInfo 装置が記載されています。 |
options | TestDeviceOptions : TestDeviceOptions GCE装置に使用されるデバイス・オプションを記述する。 |
runUtil | IRunUtil : IRunUtil コマンドを実行します。 |
remoteFilePath | String :ファイルを見つけるためのリモートパス。 |
type | LogDataType : LogDataType ログに記録されたファイルの。 |
logNestedRemoteFile
public static void logNestedRemoteFile (ITestLogger logger, GceAvdInfo gceAvd, TestDeviceOptions options, IRunUtil runUtil, String remoteFilePath, LogDataType type, String baseName)
ネストされたインスタンスからリモートファイルをフェッチしてログに記録します。
パラメーター | |
---|---|
logger | ITestLogger : ITestLogger ファイルをログに記録します。 |
gceAvd | GceAvdInfo : GceAvdInfo 装置が記載されています。 |
options | TestDeviceOptions : TestDeviceOptions GCE装置に使用されるデバイス・オプションを記述する。 |
runUtil | IRunUtil : IRunUtil コマンドを実行します。 |
remoteFilePath | String :ファイルを見つけるためのリモートパス。 |
type | LogDataType : LogDataType ログに記録されたファイルの。 |
baseName | String :ログファイルに使用するベース名。 nullの場合、実際のファイル名が使用されます。 |
logSerialOutput
public void logSerialOutput (GceAvdInfo infos, ITestLogger logger)
記載されたデバイスのシリアル出力ログGceAvdInfo
。
パラメーター | |
---|---|
infos | GceAvdInfo : GceAvdInfo インスタンスを記述する。 |
logger | ITestLogger : ITestLogger シリアルログを記録します。 |
remoteSshCommandExecution
public static CommandResult remoteSshCommandExecution (GceAvdInfo gceAvd, TestDeviceOptions options, IRunUtil runUtil, long timeoutMs, String... command)
インスタンスでsshを介してリモートコマンドを実行します。
パラメーター | |
---|---|
gceAvd | GceAvdInfo : GceAvdInfo 装置が記載されています。 |
options | TestDeviceOptions : TestDeviceOptions GCE装置に使用されるデバイス・オプションを記述する。 |
runUtil | IRunUtil : IRunUtil コマンドを実行します。 |
timeoutMs | long :コマンドのミリ秒でタイムアウト。 0はタイムアウトがないことを意味します。 |
command | String :リモートコマンドを実行します。 |
戻り値 | |
---|---|
CommandResult | CommandResult 実行の結果を含みます。 |
shutdownGce
public boolean shutdownGce ()
シャットダウンに関連付けられGCEインスタンスstartGce()
戻り値 | |
---|---|
boolean | gceシャットダウンが非ブロッキングとして要求された場合はtrueを返します。 |
startGce
public GceAvdInfo startGce (String ipDevice, MultiMap<String, String> attributes)
gceインスタンスの開始を試みます
パラメーター | |
---|---|
ipDevice | String :でAVDを実行するためにGCEインスタンスの初期IP、 null ない場合は、適用 |
attributes | MultiMap :、現在の呼び出しに関連付けられたVMメタデータとして追加するGCEインスタンスに適用可能な情報をダウン渡すために使用される属性 |
戻り値 | |
---|---|
GceAvdInfo | GceAvdInfo GCEインスタンスを記述する。 BOOT_FAILインスタンスである可能性があります。 |
投げる | |
---|---|
TargetSetupError |
保護されたメソッド
buildGceCmd
protectedbuildGceCmd (File reportFile, IBuildInfo b, String ipDevice, MultiMap<String, String> attributes)
GCEを起動するコマンドをビルドして返します。テストのために公開されました。
パラメーター | |
---|---|
reportFile | File |
b | IBuildInfo |
ipDevice | String |
attributes | MultiMap |
戻り値 | |
---|---|
extractInstanceName
protected String extractInstanceName (String bootupLogs)
gceブートログからインスタンス名を取得します。 '名前'を検索します: 'gce-
パラメーター | |
---|---|
bootupLogs | String |
戻り値 | |
---|---|
String |