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

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

GceManager(DeviceDescriptor deviceDesc, TestDeviceOptions deviceOptions, IBuildInfo buildInfo)

クリック率

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

<ph type="x-smartling-placeholder"></ph> このコンストラクタは非推奨となりました。 他のコンストラクタを使用します。これは下位互換性のために一時的に保持されています。

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

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

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)

<ph type="x-smartling-placeholder"></ph> このコンストラクタは非推奨となりました。
他のコンストラクタを使用します。これは下位互換性のために一時的に保持されています。

パラメータ
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)

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

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

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

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

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

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

クリーンアップ

public void cleanUp ()

getBugreportzWithSsh

public static File getBugreportzWithSsh (GceAvdInfo gceAvd, 
                TestDeviceOptions options, 
                IRunUtil runUtil)

adb 接続の潜在的な問題を回避するために、SSH を使用してデバイスからバグレポートを取得します。

パラメータ
gceAvd GceAvdInfo: デバイスを記述する GceAvdInfo

options TestDeviceOptions: 使用されるデバイス オプションを記述する TestDeviceOptions GCE デバイス。

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: 使用されるデバイス オプションを記述する TestDeviceOptions GCE デバイス。

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: 使用されるデバイス オプションを記述する TestDeviceOptions GCE デバイス。

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: 使用されるデバイス オプションを記述する TestDeviceOptions GCE デバイス。

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

RemoteSshCommandExecution

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

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

パラメータ
gceAvd GceAvdInfo: デバイスを記述する GceAvdInfo

options TestDeviceOptions: 使用されるデバイス オプションを記述する TestDeviceOptions GCE デバイス。

runUtil IRunUtil: コマンドを実行する IRunUtil

timeoutMs long: コマンドのタイムアウト(ミリ秒単位)。0 はタイムアウトがないことを意味します。

command String: 実行するリモート コマンド。

戻り値
CommandResult CommandResult には実行結果が含まれます。

shutdownGce

public boolean shutdownGce ()

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

戻り値
boolean gce のシャットダウンが非ブロックとしてリクエストされた場合に true を返します。

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

例外
TargetSetupError

保護されたメソッド

buildGceCmd

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

GCE を起動するコマンドをビルドして返します。テスト用に公開されています。

パラメータ
reportFile File

b IBuildInfo

ipDevice String

attributes MultiMap

戻り値

extractInstanceName

protected String extractInstanceName (String bootupLogs)

gce ブートログからインスタンス名を取得します。「name」を検索: 「gce-」 その名前を抽出します。結果ファイルではなくログから抽出します GCE ブートに失敗すると、試行したインスタンス名が JSON に表示されません。 で確認できます。

パラメータ
bootupLogs String

戻り値
String