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

public static final String GCE_IP_PRECONFIGURED_KEY

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

GceManager(DeviceDescriptor deviceDesc, TestDeviceOptions deviceOptions, IBuildInfo buildInfo)

Ctor

GceManager(DeviceDescriptor deviceDesc, TestDeviceOptions deviceOptions, IBuildInfo buildInfo, testResourceBuildInfos)

このコンストラクタは非推奨となりました。 他のコンストラクタを使用してください。これは下位互換性のために一時的に保持されています。

GceManager(DeviceDescriptor deviceDesc, TestDeviceOptions deviceOptions, IBuildInfo buildInfo, String gceInstanceName, String gceHost)

直接使用する 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 void logDirectory(File remoteDirectory, String baseName, ITestLogger logger, LogDataType type)
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, MultiMap<String, String> attributes)

マルチデバイス GCE インスタンスを Oxygen で起動しようとしました。

保護されたメソッド

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

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

GceManager

public GceManager (DeviceDescriptor deviceDesc, 
                TestDeviceOptions deviceOptions, 
                IBuildInfo buildInfo)

クリック率

パラメータ
deviceDesc DeviceDescriptor: GCE デバイスに関連付けられる DeviceDescriptor

deviceOptions TestDeviceOptions: デバイスに関連付けられた TestDeviceOptions

buildInfo IBuildInfo: 開始する gce ビルドを記述する IBuildInfo

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

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

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

パブリック メソッド

AcloudShutdown

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 Cuttlefish にのみ使用されます。

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

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

例外
IOException

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。

例外
IOException

logDirectory

public static void logDirectory (File remoteDirectory, 
                String baseName, 
                ITestLogger logger, 
                LogDataType type)

パラメータ
remoteDirectory File

baseName String

logger ITestLogger

type LogDataType

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: 現在の呼び出しに関連付けられた属性。VM メタデータとして追加される GCE インスタンスに該当情報を渡すために使用されます。

logger ITestLogger: デバイスの起動ログをログに記録する ITestLogger

戻り値
GceAvdInfo GCE インスタンスを記述する GceAvdInfo。BOOT_FAIL インスタンスである可能性があります。

例外
com.android.tradefed.targetprep.TargetSetupError
TargetSetupError

startGce

public GceAvdInfo startGce ()

戻り値
GceAvdInfo

例外
TargetSetupError

startGce

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

gce インスタンスの起動を試みます。

パラメータ
ipDevice String: AVD を実行する GCE インスタンスの初期 IP(該当しない場合は null

attributes MultiMap: 現在の呼び出しに関連付けられた属性。VM メタデータとして追加される GCE インスタンスに該当情報を渡すために使用されます。

戻り値
GceAvdInfo GCE インスタンスを記述する GceAvdInfo。BOOT_FAIL インスタンスである可能性があります。

例外
com.android.tradefed.targetprep.TargetSetupError
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: 現在の呼び出しに関連付けられた属性。VM メタデータとして追加される GCE インスタンスに該当情報を渡すために使用されます。

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

マルチデバイスの GCE インスタンスを Oxygen で起動しようとします。

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

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

戻り値
GCE Avd 情報を記述する ERROR(/List)

例外
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

戻り値

buildShutdownCommand

protected static  buildShutdownCommand (File config, 
                TestDeviceOptions options, 
                String instanceName, 
                String hostname, 
                boolean isIpPreconfigured)

パラメータ
config File

options TestDeviceOptions

instanceName String

hostname String

isIpPreconfigured boolean

戻り値

extractInstanceName

protected String extractInstanceName (String bootupLogs)

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

パラメータ
bootupLogs String

戻り値
String