Gceマネージャー
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 |
public static final String | GCE_IP_PRECONFIGURED_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, boolean isIpPreconfigured) 実際の Acloud を実行して仮想デバイスをシャットダウンします。 |
void | cleanUp () |
static File | getBugreportzWithSsh ( GceAvdInfo gceAvd, TestDeviceOptions options, IRunUtil runUtil) adb 接続の潜在的な問題を回避するために、ssh を使用してデバイスからバグレポートを取得します。 |
static String | getInstanceSerialLog ( GceAvdInfo infos, File avdConfigFile, File jsonKeyFile, IRunUtil runUtil) Gce Avd インスタンスのシリアル ログの現在の内容を読み取ります。 |
static File | getNestedDeviceSshBugreportz ( GceAvdInfo gceAvd, TestDeviceOptions options, IRunUtil runUtil) ネストされたインスタンスの ssh 経由でバグレポートを取得します。 |
static boolean | logNestedRemoteFile ( ITestLogger logger, GceAvdInfo gceAvd, TestDeviceOptions options, IRunUtil runUtil, String remoteFilePath, LogDataType type) ネストされたインスタンスからリモート ファイルを取得し、ログに記録します。 |
static boolean | 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 () |
GceAvdInfo | startGce (String ipDevice, String user, Integer offset, MultiMap <String, String> attributes, ITestLogger logger) Acloud または Oxygen のいずれかで gce インスタンスを開始しようとします。 |
GceAvdInfo | startGce (String ipDevice, String user, Integer offset, MultiMap <String, String> attributes) Acloud または Oxygen のいずれかで gce インスタンスを開始しようとします。 |
GceAvdInfo | startGce () |
GceAvdInfo | startGce (String ipDevice, MultiMap <String, String> attributes) gce インスタンスの起動を試みます。 |
startMultiDevicesGce ( buildInfos) startMultiDevicesGce ( buildInfos) Oxygen を使用して複数のデバイスの gce インスタンスを開始しようとしています。 |
保護されたメソッド | |
---|---|
buildGceCmd (File reportFile, IBuildInfo b, String ipDevice, String user, Integer offset, MultiMap <String, String> attributes) コマンドをビルドして返し、GCE を起動します。 | |
static | buildShutdownCommand (File config, TestDeviceOptions options, String instanceName, String hostname, boolean isIpPreconfigured) |
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
GCE_IP_PRECONFIGURED_KEY
public static final String GCE_IP_PRECONFIGURED_KEY
パブリック コンストラクター
Gceマネージャー
public GceManager (DeviceDescriptor deviceDesc, TestDeviceOptions deviceOptions, IBuildInfo buildInfo)
中心
パラメーター | |
---|---|
deviceDesc | DeviceDescriptor : GCE デバイスに関連付けられるDeviceDescriptor 。 |
deviceOptions | TestDeviceOptions : デバイスに関連付けられたTestDeviceOptions 。 |
buildInfo | IBuildInfo : 開始するIBuildInfo ビルドを記述する IBuildInfo。 |
Gceマネージャー
public GceManager (DeviceDescriptor deviceDesc, TestDeviceOptions deviceOptions, IBuildInfo buildInfo,testResourceBuildInfos)
このコンストラクターは非推奨です。
他のコンストラクターを使用してください。これは後方互換性のために一時的に保持されます。
パラメーター | |
---|---|
deviceDesc | DeviceDescriptor |
deviceOptions | TestDeviceOptions |
buildInfo | IBuildInfo |
testResourceBuildInfos |
Gceマネージャー
public GceManager (DeviceDescriptor deviceDesc, TestDeviceOptions deviceOptions, IBuildInfo buildInfo, String gceInstanceName, String gceHost)
Ctor、直接使用する GCE インスタンス名を提供するために使用できるバリエーション。
パラメーター | |
---|---|
deviceDesc | DeviceDescriptor : GCE デバイスに関連付けられるDeviceDescriptor 。 |
deviceOptions | TestDeviceOptions : デバイスに関連付けられたTestDeviceOptions |
buildInfo | IBuildInfo : 開始するIBuildInfo ビルドを記述する IBuildInfo。 |
gceInstanceName | String : 使用するインスタンス名。 |
gceHost | String : 使用するインスタンスのホスト名または IP。 |
公開メソッド
クラウドシャットダウン
public static boolean AcloudShutdown (TestDeviceOptions options, IRunUtil runUtil, String instanceName, String hostname, boolean isIpPreconfigured)
実際の Acloud を実行して仮想デバイスをシャットダウンします。
パラメーター | |
---|---|
options | TestDeviceOptions : TestDeviceOptions オプションの TestDeviceOptions |
runUtil | IRunUtil : IRunUtil を実行するための IRunUtil |
instanceName | String : シャットダウンするインスタンス。 |
hostname | String : インスタンスのホスト名。酸素イカにのみ使用されます。 |
isIpPreconfigured | boolean : AVD が事前設定された IP を持つリモート デバイスで作成されたかどうか |
戻り値 | |
---|---|
boolean | 成功した場合は真 |
掃除
public void cleanUp ()
getBugreportzWithSsh
public static File getBugreportzWithSsh (GceAvdInfo gceAvd, TestDeviceOptions options, IRunUtil runUtil)
adb 接続の潜在的な問題を回避するために、ssh を使用してデバイスからバグレポートを取得します。
パラメーター | |
---|---|
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)
Gce Avd インスタンスのシリアル ログの現在の内容を読み取ります。
パラメーター | |
---|---|
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 boolean 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 。 |
戻り値 | |
---|---|
boolean | ファイルが正常にログに記録されたかどうか。 |
logNestedRemoteFile
public static boolean 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 の場合、実際のファイル名が使用されます。 |
戻り値 | |
---|---|
boolean | ファイルが正常にログに記録されたかどうか。 |
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 : 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, String user, Integer offset, MultiMap<String, String> attributes, ITestLogger logger)
Acloud または Oxygen のいずれかで gce インスタンスを開始しようとします。
パラメーター | |
---|---|
ipDevice | String : AVD を実行する GCE インスタンスの初期 IP、該当しない場合はnull |
user | String : AVD のホスト実行ユーザー、該当しない場合はnull |
offset | Integer : ホスト内の AVD のデバイス番号オフセット。該当しない場合はnull |
attributes | MultiMap : 現在の呼び出しに関連付けられた属性。適用可能な情報を GCE インスタンスに渡して VM メタデータとして追加するために使用されます。 |
logger | ITestLogger : デバイスの起動ログを記録するITestLogger 。 |
戻り値 | |
---|---|
GceAvdInfo | GCE インスタンスを記述するGceAvdInfo 。 BOOT_FAIL インスタンスである可能性があります。 |
スロー | |
---|---|
TargetSetupError |
startGce
public GceAvdInfo startGce (String ipDevice, String user, Integer offset, MultiMap<String, String> attributes)
Acloud または Oxygen のいずれかで gce インスタンスを開始しようとします。
パラメーター | |
---|---|
ipDevice | String : AVD を実行する GCE インスタンスの初期 IP、該当しない場合はnull |
user | String : AVD のホスト実行ユーザー、該当しない場合はnull |
offset | Integer : ホスト内の AVD のデバイス番号オフセット。該当しない場合はnull |
attributes | MultiMap : 現在の呼び出しに関連付けられた属性。適用可能な情報を GCE インスタンスに渡して VM メタデータとして追加するために使用されます。 |
戻り値 | |
---|---|
GceAvdInfo | GCE インスタンスを記述するGceAvdInfo 。 BOOT_FAIL インスタンスである可能性があります。 |
スロー | |
---|---|
TargetSetupError |
startGce
public GceAvdInfo startGce (String ipDevice, MultiMap<String, String> attributes)
gce インスタンスの起動を試みます。
パラメーター | |
---|---|
ipDevice | String : AVD を実行する GCE インスタンスの初期 IP、該当しない場合はnull |
attributes | MultiMap : 現在の呼び出しに関連付けられた属性。適用可能な情報を GCE インスタンスに渡して VM メタデータとして追加するために使用されます。 |
戻り値 | |
---|---|
GceAvdInfo | GCE インスタンスを記述するGceAvdInfo 。 BOOT_FAIL インスタンスである可能性があります。 |
スロー | |
---|---|
TargetSetupError |
startMultiDevicesGce
publicstartMultiDevicesGce ( buildInfos)
Oxygen を使用して複数のデバイスの gce インスタンスを開始しようとしています。
パラメーター | |
---|---|
buildInfos | ERROR(/List ) ERROR(/List ) |
戻り値 | |
---|---|
a ERROR(/List ) ERROR(/List ) GCE Avd Info を記述します。 |
スロー | |
---|---|
TargetSetupError |
保護されたメソッド
buildGceCmd
protectedbuildGceCmd (File reportFile, IBuildInfo b, String ipDevice, String user, Integer offset, MultiMap<String, String> attributes)
コマンドをビルドして返し、GCE を起動します。テストのために公開。
パラメーター | |
---|---|
reportFile | File |
b | IBuildInfo |
ipDevice | String |
user | String |
offset | Integer |
attributes | MultiMap |
戻り値 | |
---|---|
buildShutdownCommand
protected staticbuildShutdownCommand (File config, TestDeviceOptions options, String instanceName, String hostname, boolean isIpPreconfigured)
パラメーター | |
---|---|
config | File |
options | TestDeviceOptions |
instanceName | String |
hostname | String |
isIpPreconfigured | boolean |
戻り値 | |
---|---|
抽出インスタンス名
protected String extractInstanceName (String bootupLogs)
gce ブート ログからインスタンス名を取得します。 「名前」を検索: 「gce-
パラメーター | |
---|---|
bootupLogs | String |
戻り値 | |
---|---|
String |