Gceマネージャー

public class GceManager
extends Object

java.lang.オブジェクト
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)

GceAvdInfoで記述されたデバイスのシリアル出力をログに記録します。

static CommandResult remoteSshCommandExecution ( GceAvdInfo gceAvd, TestDeviceOptions options, IRunUtil runUtil, long timeoutMs, String... command)

インスタンス上で ssh 経由でリモート コマンドを実行します。

boolean shutdownGce ()

startGce()に関連付けられた Gce インスタンスをシャットダウンします。

GceAvdInfo startGce (String ipDevice, String user, Integer offset, MultiMap <String, String> attributes, ITestLogger logger)

Acloud または Oxygen のいずれかを使用して gce インスタンスを起動してみます。

GceAvdInfo startGce ()
GceAvdInfo startGce (String ipDevice, MultiMap <String, String> attributes)

gce インスタンスを起動してみます。

GceAvdInfo startGce (String ipDevice, String user, Integer offset, MultiMap <String, String> attributes)

Acloud または Oxygen のいずれかを使用して gce インスタンスを起動してみます。

startMultiDevicesGce ( buildInfos) startMultiDevicesGce ( buildInfos)

このメソッドは廃止されました。 master ブランチが更新された後、これを削除します。

startMultiDevicesGce ( buildInfos, MultiMap <String, String> attributes) startMultiDevicesGce ( buildInfos, MultiMap <String, String> attributes)

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 : 開始する gce ビルドを記述する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 : 開始する gce ビルドを記述するIBuildInfo

gceInstanceName String : 使用するインスタンス名。

gceHost String : 使用するインスタンスのホスト名または IP。

パブリックメソッド

クラウドシャットダウン

public static boolean AcloudShutdown (TestDeviceOptions options, 
                IRunUtil runUtil, 
                String instanceName, 
                String hostname, 
                boolean isIpPreconfigured)

実際に Acloud を実行して仮想デバイスをシャットダウンします。

パラメーター
options TestDeviceOptions : Acloud オプションのTestDeviceOptions

runUtil IRunUtil : Acloud を実行するためのIRunUtil

instanceName String : シャットダウンするインスタンス。

hostname String : インスタンスのホスト名。Oxygen イカにのみ使用されます。

isIpPreconfigured boolean : AVD が事前構成された IP を持つリモート デバイス上に作成されたかどうか

戻り値
boolean成功した場合は True

掃除

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。

投げる
IO例外

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。

投げる
IO例外

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ファイルが正常に記録されたかどうか。

ログシリアル出力

public void logSerialOutput (GceAvdInfo infos, 
                ITestLogger logger)

GceAvdInfoで記述されたデバイスのシリアル出力をログに記録します。

パラメーター
infos GceAvdInfo : インスタンスを説明するGceAvdInfo

logger ITestLogger : シリアル ログを記録するITestLogger

リモートSshコマンド実行

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

シャットダウンGce

public boolean shutdownGce ()

startGce()に関連付けられた Gce インスタンスをシャットダウンします。

戻り値
boolean gce シャットダウンがノンブロッキングとして要求された場合は true を返します。

スタートGce

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 インスタンスである可能性があります。

投げる
com.android.tradefed.targetprep.TargetSetupError
TargetSetupError

スタートGce

public GceAvdInfo startGce ()

戻り値
GceAvdInfo

投げる
TargetSetupError

スタートGce

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 インスタンスである可能性があります。

投げる
com.android.tradefed.targetprep.TargetSetupError
TargetSetupError

スタートGce

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 インスタンスである可能性があります。

投げる
com.android.tradefed.targetprep.TargetSetupError
TargetSetupError

startMultiDevicesGce

public  startMultiDevicesGce ( buildInfos)

このメソッドは廃止されました。
master ブランチが更新された後、これを削除します。

パラメーター
buildInfos

戻り値

投げる
TargetSetupError

startMultiDevicesGce

public  startMultiDevicesGce ( buildInfos, 
                MultiMap<String, String> attributes)

Oxygen を使用してマルチデバイスの gce インスタンスを起動しようとします。

パラメーター
buildInfos : ERROR(/List ) ERROR(/List )

attributes MultiMap : 現在の呼び出しに関連付けられた属性

戻り値
ERROR(/List ) ERROR(/List ) GCE Avd Info について説明します。

投げる
TargetSetupError

保護されたメソッド

buildGceCmd

protected  buildGceCmd (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

戻り値

buildShutdownコマンド

protected static  buildShutdownCommand (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-」 ' パターンを使用してその名前を抽出します。 gce ブートが失敗すると、試行されたインスタンス名が json に表示されないため、結果ファイルではなくログから抽出します。

パラメーター
bootupLogs String

戻り値
String