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

public static final String GCE_IP_PRECONFIGURED_KEY

ผู้รับเหมาก่อสร้างสาธารณะ

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)

รับ bugreportz จากอุปกรณ์โดยใช้ 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 ()

ปิดอินสแตนซ์ 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

startMultiDevicesGce ( buildInfos) startMultiDevicesGce ( buildInfos)

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

startMultiDevicesGce ( buildInfos, MultiMap <String, String> attributes) startMultiDevicesGce ( buildInfos, MultiMap <String, String> attributes)

พยายามเริ่มอินสแตนซ์ gce ของอุปกรณ์หลายเครื่องด้วย Oxygen

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

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

GCE_IP_PRECONFIGURED_KEY

public static final String GCE_IP_PRECONFIGURED_KEY

ผู้รับเหมาก่อสร้างสาธารณะ

GceManager

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

คตอร์

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

deviceOptions TestDeviceOptions : TestDeviceOptions ที่เกี่ยวข้องกับอุปกรณ์

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

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 build เพื่อเริ่มต้น

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

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

วิธีการสาธารณะ

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 : ชื่อโฮสต์ของอินสแตนซ์ ใช้สำหรับปลาหมึกออกซิเจนเท่านั้น

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

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

ทำความสะอาด

public void cleanUp ()

รับ BugreportzWithSsh

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

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

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

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

runUtil IRunUtil : IRunUtil เพื่อรันคำสั่ง

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

ขว้าง
IOข้อยกเว้น

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

ขว้าง
IOข้อยกเว้น

logNestedRemoteFile.log

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.log

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 : ชื่อฐานที่จะใช้บันทึกไฟล์ หากเป็นโมฆะ ชื่อไฟล์จริงจะถูกนำมาใช้

การส่งคืน
boolean ไม่ว่าไฟล์จะถูกบันทึกสำเร็จหรือไม่

logSerialOutput

public void logSerialOutput (GceAvdInfo infos, 
                ITestLogger logger)

บันทึกเอาต์พุตอนุกรมของอุปกรณ์ที่อธิบายโดย GceAvdInfo

พารามิเตอร์
infos GceAvdInfo : GceAvdInfo ที่อธิบายอินสแตนซ์

logger ITestLogger : ITestLogger ที่จะบันทึกบันทึกอนุกรม

ระยะไกล SshCommandExecution

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 ที่มีผลการดำเนินการ

ปิดระบบGce

public boolean shutdownGce ()

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

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

เริ่มต้นGce

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

เริ่มต้นGce

public GceAvdInfo startGce ()

การส่งคืน
GceAvdInfo

ขว้าง
TargetSetupError

เริ่มต้นGce

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

เริ่มต้นGce

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

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

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

การส่งคืน

ขว้าง
TargetSetupError

startMultiDevicesGce

public  startMultiDevicesGce ( buildInfos, 
                MultiMap<String, String> attributes)

พยายามเริ่มอินสแตนซ์ gce ของอุปกรณ์หลายเครื่องด้วย Oxygen

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

attributes MultiMap : คุณลักษณะที่เกี่ยวข้องกับการร้องขอปัจจุบัน

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

ขว้าง
TargetSetupError

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

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

การส่งคืน

แยกInstanceName

protected String extractInstanceName (String bootupLogs)

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

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

การส่งคืน
String