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)

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

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

コンストラクタ。直接使用する 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)

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

パラメータ
deviceDesc DeviceDescriptor

deviceOptions TestDeviceOptions

buildInfo IBuildInfo

testResourceBuildInfos

GceManager

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

コンストラクタ。直接使用する 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

cleanUp

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

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

戻り値
GceAvdInfo

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

保護されたメソッド

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