Gceマネージャー
public class GceManager
extends Object
java.lang.Object |
↳ | com.android.tradefed.device.cloud.GceManager |
GCE 呼び出しを管理して、GCE からログを開始/停止および収集するヘルパー。
まとめ
パブリック コンストラクター |
---|
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
public static final String GCE_IP_PRECONFIGURED_KEY
パブリック コンストラクター
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 : インスタンスのホスト名。酸素イカにのみ使用されます。 |
isIpPreconfigured | boolean : AVD が事前設定された IP を持つリモート デバイスで作成されたかどうか |
掃除
public void cleanUp ()
getBugreportzWithSsh
public static File getBugreportzWithSsh (GceAvdInfo gceAvd,
TestDeviceOptions options,
IRunUtil runUtil)
adb 接続の潜在的な問題を回避するために、ssh を使用してデバイスからバグレポートを取得します。
戻り値 |
---|
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 をリクエストする必要があります。
戻り値 |
---|
File | zip バグレポートを指すファイル、または問題が発生した場合は null。 |
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 | ファイルが正常にログに記録されたかどうか。 |
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 : 実行するリモート コマンド。 |
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 : 現在の呼び出しに関連付けられた属性。適用可能な情報を GCE インスタンスに渡して VM メタデータとして追加するために使用されます。 |
logger | ITestLogger : デバイスの起動ログを記録するITestLogger 。 |
startGce
public GceAvdInfo startGce (String ipDevice,
MultiMap<String, String> attributes)
gce インスタンスの起動を試みます。
パラメーター |
---|
ipDevice | String : AVD を実行する GCE インスタンスの初期 IP、該当しない場合はnull |
attributes | MultiMap : 現在の呼び出しに関連付けられた属性。適用可能な情報を GCE インスタンスに渡して VM メタデータとして追加するために使用されます。 |
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 : 現在の呼び出しに関連付けられた属性。適用可能な情報を GCE インスタンスに渡して VM メタデータとして追加するために使用されます。 |
startMultiDevicesGce
public startMultiDevicesGce ( buildInfos)
このメソッドは非推奨です。
master ブランチが更新されたら、これを削除します。
startMultiDevicesGce
public startMultiDevicesGce ( buildInfos,
MultiMap<String, String> attributes)
Oxygen を使用して複数のデバイスの gce インスタンスを開始しようとしています。
保護されたメソッド
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 |
protected String extractInstanceName (String bootupLogs)
gce ブート ログからインスタンス名を取得します。 「名前」を検索: 「gce- ' その名前を抽出するパターン。結果ファイルではなくログから抽出します。これは、gce の起動に失敗すると、試行されたインスタンス名が json に表示されないためです。