GceManager

public class GceManager
extends Object

java.lang.Object
   ↳ com.android.tradefed.device.cloud.GceManager


โปรแกรมช่วยที่จัดการการเรียก GCE เพื่อเริ่ม/หยุดและรวบรวมบันทึกจาก GCE

สรุป

ค่าคงที่

String GCE_HOSTNAME_KEY

String GCE_INSTANCE_CLEANED_KEY

String GCE_INSTANCE_NAME_KEY

String GCE_IP_PRECONFIGURED_KEY

เครื่องมือสร้างสาธารณะ

GceManager(DeviceDescriptor deviceDesc, TestDeviceOptions deviceOptions, IBuildInfo buildInfo)

Ctor

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

Ctor, รูปแบบที่ใช้ระบุชื่ออินสแตนซ์ GCE เพื่อใช้โดยตรงได้

GceManager(DeviceDescriptor deviceDesc, TestDeviceOptions deviceOptions, IBuildInfo buildInfo, List<IBuildInfo> testResourceBuildInfos)

เลิกใช้ตัวสร้างนี้แล้ว ใช้ตัวสร้างอื่นๆ เราจะเก็บตัวสร้างนี้ไว้ชั่วคราวเพื่อความเข้ากันได้แบบย้อนหลัง

เมธอดสาธารณะ

static boolean AcloudShutdown(TestDeviceOptions options, IRunUtil runUtil, String instanceName, String hostname, boolean isIpPreconfigured)

เรียกใช้ Acloud จริงเพื่อปิดอุปกรณ์เสมือนจริง

void cleanUp()
static void collectErrorSignatures(File remoteFile)
static File getBugreportzWithSsh(GceAvdInfo gceAvd, TestDeviceOptions options, IRunUtil runUtil)

รับรายงานข้อบกพร่องจากอุปกรณ์โดยใช้ SSH เพื่อหลีกเลี่ยงปัญหาที่อาจเกิดขึ้นกับการเชื่อมต่อ ADB

HostOrchestratorUtil getHostOrchestratorUtil()

แสดงอินสแตนซ์ของ HostOrchestratorUtil

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 logAndDeleteFile(File tempFile, String dataName, ITestLogger logger)
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, String baseName, List<String> scpArgs)

ดึงข้อมูลไฟล์ระยะไกลจากอินสแตนซ์ที่ซ้อนกันและบันทึก

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

ปิดอินสแตนซ์ GCE ที่เชื่อมโยงกับ startGce()

GceAvdInfo startGce(String ipDevice, String user, Integer offset, MultiMap<String, String> attributes, ITestLogger logger)

พยายามเริ่มอินสแตนซ์ GCE ด้วย Acloud หรือ Oxygen

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

พยายามเริ่มอินสแตนซ์ GCE

GceAvdInfo startGce(String ipDevice, String user, Integer offset, MultiMap<String, String> attributes)

พยายามเริ่มอินสแตนซ์ GCE ด้วย Acloud หรือ Oxygen

List<GceAvdInfo> startMultiDevicesGce(List<IBuildInfo> buildInfos, MultiMap<String, String> attributes)

พยายามเริ่มอินสแตนซ์ GCE แบบหลายอุปกรณ์ด้วย Oxygen

List<GceAvdInfo> startMultiDevicesGce(List<IBuildInfo> buildInfos)

เลิกใช้เมธอดนี้แล้ว Remove this after master branch is updated.

วิธีการที่ได้รับการป้องกัน

static List<String> 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-hostname"

GCE_INSTANCE_CLEANED_KEY

public static final String GCE_INSTANCE_CLEANED_KEY

ค่าคงที่: "gce-instance-clean-called"

GCE_INSTANCE_NAME_KEY

public static final String GCE_INSTANCE_NAME_KEY

ค่าคงที่: "gce-instance-name"

GCE_IP_PRECONFIGURED_KEY

public static final String GCE_IP_PRECONFIGURED_KEY

ค่าคงที่ "gce-ip-pre-configured"

เครื่องมือสร้างสาธารณะ

GceManager

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

Ctor

พารามิเตอร์
deviceDesc DeviceDescriptor: DeviceDescriptor ที่จะเชื่อมโยงกับอุปกรณ์ GCE

deviceOptions TestDeviceOptions: TestDeviceOptions ที่เชื่อมโยงกับอุปกรณ์

buildInfo IBuildInfo: IBuildInfo ที่อธิบายการสร้าง GCE เพื่อเริ่มต้น

GceManager

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

Ctor, รูปแบบที่ใช้ระบุชื่ออินสแตนซ์ GCE เพื่อใช้โดยตรงได้

พารามิเตอร์
deviceDesc DeviceDescriptor: DeviceDescriptor ที่จะเชื่อมโยงกับอุปกรณ์ GCE

deviceOptions TestDeviceOptions: TestDeviceOptions ที่เชื่อมโยงกับอุปกรณ์

buildInfo IBuildInfo: IBuildInfo ที่อธิบายการสร้าง GCE เพื่อเริ่มต้น

gceInstanceName String: ชื่ออินสแตนซ์ที่จะใช้

gceHost String: ชื่อโฮสต์หรือ IP ของอินสแตนซ์ที่จะใช้

GceManager

public GceManager (DeviceDescriptor deviceDesc, 
                TestDeviceOptions deviceOptions, 
                IBuildInfo buildInfo, 
                List<IBuildInfo> testResourceBuildInfos)

เลิกใช้ตัวสร้างนี้แล้ว
ใช้ตัวสร้างอื่นๆ เราจะเก็บตัวสร้างนี้ไว้ชั่วคราวเพื่อความเข้ากันได้แบบย้อนหลัง

พารามิเตอร์
deviceDesc DeviceDescriptor

deviceOptions TestDeviceOptions

buildInfo IBuildInfo

testResourceBuildInfos List

เมธอดสาธารณะ

AcloudShutdown

public static boolean AcloudShutdown (TestDeviceOptions options, 
                IRunUtil runUtil, 
                String instanceName, 
                String hostname, 
                boolean isIpPreconfigured)

เรียกใช้ Acloud จริงเพื่อปิดอุปกรณ์เสมือนจริง

พารามิเตอร์
options TestDeviceOptions: TestDeviceOptions สำหรับตัวเลือก Acloud

runUtil IRunUtil: IRunUtil เพื่อเรียกใช้ Acloud

instanceName String: อินสแตนซ์ที่จะปิด

hostname String: ชื่อโฮสต์ของอินสแตนซ์ ใช้สำหรับ Oxygen Cuttlefish เท่านั้น

isIpPreconfigured boolean: AVD สร้างขึ้นในอุปกรณ์ระยะไกลที่มี IP ที่กำหนดค่าไว้ล่วงหน้าหรือไม่

การคืนสินค้า
boolean จริง หากสำเร็จ

cleanUp

public void cleanUp ()

collectErrorSignatures

public static void collectErrorSignatures (File remoteFile)

พารามิเตอร์
remoteFile File

getBugreportzWithSsh

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

รับรายงานข้อบกพร่องจากอุปกรณ์โดยใช้ SSH เพื่อหลีกเลี่ยงปัญหาที่อาจเกิดขึ้นกับการเชื่อมต่อ ADB

พารามิเตอร์
gceAvd GceAvdInfo: GceAvdInfo ที่อธิบายอุปกรณ์

options TestDeviceOptions: TestDeviceOptions อธิบายตัวเลือกอุปกรณ์ที่จะใช้สำหรับ อุปกรณ์ GCE

runUtil IRunUtil: IRunUtil เพื่อเรียกใช้คำสั่ง

การคืนสินค้า
File ไฟล์ที่ชี้ไปยังรายงานข้อบกพร่อง ZIP หรือ null หากเกิดปัญหา

ส่ง
java.io.IOException
IOException

getHostOrchestratorUtil

public HostOrchestratorUtil getHostOrchestratorUtil ()

แสดงอินสแตนซ์ของ HostOrchestratorUtil

การคืนสินค้า
HostOrchestratorUtil

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 หากเกิดปัญหา

ส่ง
java.io.IOException
IOException

logAndDeleteFile

public static void logAndDeleteFile (File tempFile, 
                String dataName, 
                ITestLogger logger)

พารามิเตอร์
tempFile File

dataName String

logger ITestLogger

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, 
                String baseName, 
                List<String> scpArgs)

ดึงข้อมูลไฟล์ระยะไกลจากอินสแตนซ์ที่ซ้อนกันและบันทึก

พารามิเตอร์
logger ITestLogger: ITestLogger ที่จะบันทึกไฟล์

gceAvd GceAvdInfo: GceAvdInfo ที่อธิบายอุปกรณ์

options TestDeviceOptions: TestDeviceOptions อธิบายตัวเลือกอุปกรณ์ที่จะใช้สำหรับ อุปกรณ์ GCE

runUtil IRunUtil: IRunUtil เพื่อเรียกใช้คำสั่ง

remoteFilePath String: เส้นทางระยะไกลที่ใช้ค้นหาไฟล์

type LogDataType: LogDataType ของไฟล์ที่บันทึก

baseName String: ชื่อฐานที่จะใช้ในการบันทึกไฟล์ หากเป็น Null ระบบจะใช้ชื่อไฟล์จริง แทน

scpArgs List: อาร์กิวเมนต์เพิ่มเติมที่จะส่งไปยังคำสั่ง scp

การคืนสินค้า
boolean บันทึกไฟล์สำเร็จหรือไม่

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: TestDeviceOptions อธิบายตัวเลือกอุปกรณ์ที่จะใช้สำหรับ อุปกรณ์ GCE

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: TestDeviceOptions อธิบายตัวเลือกอุปกรณ์ที่จะใช้สำหรับ อุปกรณ์ GCE

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: TestDeviceOptions อธิบายตัวเลือกอุปกรณ์ที่จะใช้สำหรับ อุปกรณ์ GCE

runUtil IRunUtil: IRunUtil เพื่อเรียกใช้คำสั่ง

timeoutMs long: การหมดเวลาของคำสั่งในหน่วยมิลลิวินาที 0 หมายถึงไม่มีการหมดเวลา

command String: คำสั่งระยะไกลที่จะดำเนินการ

การคืนสินค้า
CommandResult CommandResult ที่มีผลการดำเนินการ

shutdownGce

public boolean shutdownGce ()

ปิดอินสแตนซ์ GCE ที่เชื่อมโยงกับ startGce()

การคืนสินค้า
boolean แสดงค่าเป็นจริงหากมีการขอการปิด GCE แบบไม่บล็อก

startGce

public GceAvdInfo startGce (String ipDevice, 
                String user, 
                Integer offset, 
                MultiMap<String, String> attributes, 
                ITestLogger logger)

พยายามเริ่มอินสแตนซ์ GCE ด้วย Acloud หรือ Oxygen

พารามิเตอร์
ipDevice String: IP เริ่มต้นของอินสแตนซ์ GCE ที่จะเรียกใช้ AVD null หากไม่ เกี่ยวข้อง

user String: โฮสต์ที่เรียกใช้ผู้ใช้ AVD null หากไม่เกี่ยวข้อง

offset Integer: ออฟเซ็ตหมายเลขอุปกรณ์ของ AVD ในโฮสต์ null หากไม่ เกี่ยวข้อง

attributes MultiMap: แอตทริบิวต์ที่เชื่อมโยงกับการเรียกใช้ปัจจุบัน ใช้เพื่อส่งข้อมูลที่เกี่ยวข้อง ไปยังอินสแตนซ์ GCE เพื่อเพิ่มเป็นข้อมูลเมตาของ VM

logger ITestLogger: ITestLogger ที่ใช้บันทึกบันทึกการเปิดตัวอุปกรณ์

การคืนสินค้า
GceAvdInfo GceAvdInfo อธิบายอินสแตนซ์ GCE อาจเป็นอินสแตนซ์ 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: IP เริ่มต้นของอินสแตนซ์ GCE ที่จะเรียกใช้ AVD null หากไม่ เกี่ยวข้อง

attributes MultiMap: แอตทริบิวต์ที่เชื่อมโยงกับการเรียกใช้ปัจจุบัน ใช้เพื่อส่งข้อมูลที่เกี่ยวข้อง ไปยังอินสแตนซ์ GCE เพื่อเพิ่มเป็นข้อมูลเมตาของ VM

การคืนสินค้า
GceAvdInfo GceAvdInfo อธิบายอินสแตนซ์ GCE อาจเป็นอินสแตนซ์ BOOT_FAIL

ส่ง
com.android.tradefed.targetprep.TargetSetupError
TargetSetupError

startGce

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

พยายามเริ่มอินสแตนซ์ GCE ด้วย Acloud หรือ Oxygen

พารามิเตอร์
ipDevice String: IP เริ่มต้นของอินสแตนซ์ GCE ที่จะเรียกใช้ AVD null หากไม่ เกี่ยวข้อง

user String: โฮสต์ที่เรียกใช้ผู้ใช้ AVD null หากไม่เกี่ยวข้อง

offset Integer: ออฟเซ็ตหมายเลขอุปกรณ์ของ AVD ในโฮสต์ null หากไม่ เกี่ยวข้อง

attributes MultiMap: แอตทริบิวต์ที่เชื่อมโยงกับการเรียกใช้ปัจจุบัน ใช้สำหรับส่งข้อมูลที่เกี่ยวข้อง ไปยังอินสแตนซ์ GCE เพื่อเพิ่มเป็นข้อมูลเมตาของ VM

การคืนสินค้า
GceAvdInfo GceAvdInfo อธิบายอินสแตนซ์ GCE อาจเป็นอินสแตนซ์ BOOT_FAIL

ส่ง
com.android.tradefed.targetprep.TargetSetupError
TargetSetupError

startMultiDevicesGce

public List<GceAvdInfo> startMultiDevicesGce (List<IBuildInfo> buildInfos, 
                MultiMap<String, String> attributes)

พยายามเริ่มอินสแตนซ์ GCE แบบหลายอุปกรณ์ด้วย Oxygen

พารามิเตอร์
buildInfos List: ERROR(/List)

attributes MultiMap: แอตทริบิวต์ที่เชื่อมโยงกับการเรียกใช้ปัจจุบัน

การคืนสินค้า
List<GceAvdInfo> ERROR(/List)ที่อธิบายข้อมูล AVD ของ GCE

ส่ง
TargetSetupError

startMultiDevicesGce

public List<GceAvdInfo> startMultiDevicesGce (List<IBuildInfo> buildInfos)

เลิกใช้เมธอดนี้แล้ว
นำออกหลังจากอัปเดตสาขาหลักแล้ว

พารามิเตอร์
buildInfos List

การคืนสินค้า
List<GceAvdInfo>

ส่ง
TargetSetupError

วิธีการที่ได้รับการป้องกัน

buildShutdownCommand

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

พารามิเตอร์
config File

options TestDeviceOptions

instanceName String

hostname String

isIpPreconfigured boolean

การคืนสินค้า
List<String>

extractInstanceName

protected String extractInstanceName (String bootupLogs)

ดึงข้อมูลชื่ออินสแตนซ์จากบันทึกการบูตของ GCE ค้นหา "ชื่อ" ที่มีรูปแบบ "gce-" เพื่อดึงชื่อของอินสแตนซ์ เราดึงข้อมูลจากบันทึกแทนที่จะดึงจากไฟล์ผลลัพธ์เนื่องจากเมื่อการบูต GCE ล้มเหลว ชื่ออินสแตนซ์ที่พยายามจะไม่แสดงใน JSON

พารามิเตอร์
bootupLogs String

การคืนสินค้า
String