GceManager
public class GceManager
extends Object
java.lang.Object | |
↳ | com.android.tradefed.device.cloud.GceManager |
GCEからログを開始/停止および収集するためのGCE呼び出しを管理するヘルパー。
概要
田畑 | |
---|---|
public static final String | GCE_INSTANCE_CLEANED_KEY |
public static final String | GCE_INSTANCE_NAME_KEY
|
パブリックコンストラクター | |
---|---|
GceManager (DeviceDescriptor deviceDesc, TestDeviceOptions deviceOptions, IBuildInfo buildInfo) Ctor | |
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) 実際の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) |
void | logStableHostImageInfos (IBuildInfo build) 使用した安定したホストイメージに関連する情報をログに記録します。 |
static CommandResult | remoteSshCommandExecution (GceAvdInfo gceAvd, TestDeviceOptions options, IRunUtil runUtil, long timeoutMs, String... command) インスタンスでsshを介してリモートコマンドを実行します。 |
boolean | shutdownGce () |
GceAvdInfo | startGce () |
GceAvdInfo | startGce (String ipDevice) gceインスタンスを開始しようとしています |
保護されたメソッド | |
---|---|
buildGceCmd (File reportFile, IBuildInfo b, String ipDevice) コマンドをビルドして返し、GCEを起動します。 | |
String | extractInstanceName (String bootupLogs) gceブートログからインスタンス名を取得します。 |
田畑
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)
Ctor
パラメーター | |
---|---|
deviceDesc | DeviceDescriptor :GCEデバイスに関連付けられるDeviceDescriptor 。 |
deviceOptions | TestDeviceOptions :デバイスに関連付けられた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 :GCEデバイスに関連付けられるDeviceDescriptor 。 |
deviceOptions | TestDeviceOptions :デバイスに関連付けられたTestDeviceOptions |
buildInfo | IBuildInfo :A IBuildInfo 開始にGCEビルドを記述する。 |
gceInstanceName | String :使用するインスタンス名。 |
gceHost | String :使用するインスタンスのホスト名またはIP。 |
パブリックメソッド
AcloudShutdown
public static boolean AcloudShutdown (TestDeviceOptions options, IRunUtil runUtil, String instanceName)
実際のAcloudを実行して、仮想デバイスをシャットダウンします。
パラメーター | |
---|---|
options | TestDeviceOptions : TestDeviceOptions Acloudオプションの |
runUtil | IRunUtil : IRunUtil を実行するためのIRunUtil |
instanceName | 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 :GCEデバイスに使用されるデバイスオプションを説明するTestDeviceOptions 。 |
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 :GCEデバイスに使用されるデバイスオプションを説明するTestDeviceOptions 。 |
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 :GCEデバイスに使用されるデバイスオプションを説明するTestDeviceOptions 。 |
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 :GCEデバイスに使用されるデバイスオプションを説明するTestDeviceOptions 。 |
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 。 |
logStableHostImageInfos
public void logStableHostImageInfos (IBuildInfo build)
使用した安定したホストイメージに関連する情報をログに記録します。
パラメーター | |
---|---|
build | IBuildInfo |
remoteSshCommandExecution
public static CommandResult remoteSshCommandExecution (GceAvdInfo gceAvd, TestDeviceOptions options, IRunUtil runUtil, long timeoutMs, String... command)
インスタンスでsshを介してリモートコマンドを実行します。
パラメーター | |
---|---|
gceAvd | GceAvdInfo :デバイスを説明するGceAvdInfo 。 |
options | TestDeviceOptions :GCEデバイスに使用されるデバイスオプションを説明するTestDeviceOptions 。 |
runUtil | IRunUtil :コマンドを実行するためのIRunUtil 。 |
timeoutMs | long :コマンドのタイムアウト(ミリ秒単位)。 0はタイムアウトがないことを意味します。 |
command | String :実行するリモートコマンド。 |
戻り値 | |
---|---|
CommandResult | 実行の結果を含むCommandResult 。 |
shutdownGce
public boolean shutdownGce ()
startGce()
関連付けられているGceインスタンスをシャットダウンします。
戻り値 | |
---|---|
boolean | gceシャットダウンが非ブロッキングとして要求された場合はtrueを返します。 |
startGce
public GceAvdInfo startGce (String ipDevice)
gceインスタンスを開始しようとしています
パラメーター | |
---|---|
ipDevice | String |
戻り値 | |
---|---|
GceAvdInfo | GCEインスタンスを説明するGceAvdInfo 。 BOOT_FAILインスタンスである可能性があります。 |
投げる | |
---|---|
TargetSetupError |
保護されたメソッド
buildGceCmd
protectedbuildGceCmd (File reportFile, IBuildInfo b, String ipDevice)
コマンドをビルドして返し、GCEを起動します。テスト用に公開。
パラメーター | |
---|---|
reportFile | File |
b | IBuildInfo |
ipDevice | String |
戻り値 | |
---|---|
extractInstanceName
protected String extractInstanceName (String bootupLogs)
gceブートログからインスタンス名を取得します。 '名前'を検索します: 'gce-
パラメーター | |
---|---|
bootupLogs | String |
戻り値 | |
---|---|
String |