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

パブリックコンストラクター

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)

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 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)

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

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

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

boolean shutdownGce ()

startGce()に関連付けられた 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

パブリックコンストラクター

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)

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

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

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

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

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

戻り値
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。

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 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 の場合、実際のファイル名が使用されます。

ログシリアル出力

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 ()

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

投げる
TargetSetupError

保護されたメソッド

buildGceCmd

protected  buildGceCmd (File reportFile, 
                IBuildInfo b, 
                String ipDevice, 
                MultiMap<String, String> attributes)

GCE を起動するコマンドをビルドして返します。テストのために露出しました。

パラメーター
reportFile File

b IBuildInfo

ipDevice String

attributes MultiMap

戻り値

抽出インスタンス名

protected String extractInstanceName (String bootupLogs)

gce ブート ログからインスタンス名を取得します。 「名前」を検索します:「gce-」 ' パターンを使用してその名前を抽出します。 gce ブートが失敗すると、試行されたインスタンス名が json に表示されないため、結果ファイルではなくログから抽出します。

パラメーター
bootupLogs String

戻り値
String