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, 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

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)

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

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)

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

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

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

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

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-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, 
                 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, 
                boolean isIpPreconfigured)

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

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

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

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

hostname String: ชื่อโฮสต์ของอินสแตนซ์ ใช้สำหรับปลาหมึกกระดอง Oxygen เท่านั้น

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

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

cleanUp

public void cleanUp ()

getBugreportzWithSsh

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

การขว้าง
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 หากเกิดปัญหา

การขว้าง
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)

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

พารามิเตอร์
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: ชื่อฐานที่จะใช้ในการบันทึกไฟล์ หากเป็นค่าว่าง ระบบจะใช้ชื่อไฟล์จริง แทน

คิกรีเทิร์น
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  startMultiDevicesGce ( buildInfos)

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

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

คิกรีเทิร์น

การขว้าง
TargetSetupError

startMultiDevicesGce

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

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

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

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

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

การขว้าง
TargetSetupError

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

buildShutdownCommand

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

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

options TestDeviceOptions

instanceName String

hostname String

isIpPreconfigured boolean

คิกรีเทิร์น

extractInstanceName

protected String extractInstanceName (String bootupLogs)

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

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

คิกรีเทิร์น
String