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)

Ctor

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)

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

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

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)

Ctor

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

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

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

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)

Ctor ซึ่งเป็นตัวแปรที่สามารถใช้เพื่อระบุชื่ออินสแตนซ์ GCE ที่จะใช้ได้โดยตรง

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

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

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

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

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

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

AcloudShutdown

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

Acloud จริงทำงานเพื่อปิดอุปกรณ์เสมือน

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

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

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

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

คิกรีเทิร์น
boolean จริง หากสําเร็จ

cleanUp

public void cleanUp ()

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 หรือเป็นค่าว่างหากเกิดปัญหา

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 เอาต์พุตบันทึกซีเรียลหรือค่าว่างหากเกิดข้อผิดพลาด

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 หรือเป็นค่าว่างหากเกิดปัญหา

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

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

คิกรีเทิร์น
boolean แสดงผลเป็น "จริง" หากมีการส่งคำขอปิด GCE แบบไม่บล็อก

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

การโยน
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