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) 使用 ssh 從裝置取得錯誤報告,以避免任何 adb 連線潛在問題。 |
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 | |
公共方法
Acloud關機
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 : AVD 是否是在具有預先配置 IP 的遠端設備上建立的 |
清理
public void cleanUp ()
getBugreportzWithSsh
public static File getBugreportzWithSsh (GceAvdInfo gceAvd,
TestDeviceOptions options,
IRunUtil runUtil)
使用 ssh 從裝置取得錯誤報告,以避免任何 adb 連線潛在問題。
退貨 |
---|
File | 指向 zip 錯誤報告的文件,如果發生問題則為 null。 |
取得實例序列日誌
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。 |
關閉Gce
public boolean shutdownGce ()
關閉與startGce()
關聯的 Gce 實例。
退貨 |
---|
boolean | 如果請求 gce shutdown 作為非阻塞,則傳回 true。 |
啟動Gce
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 記錄設備啟動日誌的位置。 |
啟動Gce
public GceAvdInfo startGce (String ipDevice,
MultiMap<String, String> attributes)
嘗試啟動 gce 實例。
參數 |
---|
ipDevice | String :執行 AVD 的 GCE 實例的初始 IP,如果不適用則為null |
attributes | MultiMap :與目前呼叫關聯的屬性,用於將適用的資訊傳遞到 GCE 實例以作為 VM 元資料添加 |
啟動Gce
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 元資料添加 |
啟動多設備Gce
public startMultiDevicesGce ( buildInfos)
此方法已被棄用。
master 分支更新後刪除它。
啟動多設備Gce
public startMultiDevicesGce ( buildInfos,
MultiMap<String, String> attributes)
嘗試使用 Oxygen 啟動多裝置 gce 執行個體。
受保護的方法
建置GceCmd
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 |
建置關機命令
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 中。