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)

직접 사용할 GCE 인스턴스 이름을 제공하는 데 사용할 수 있는 변형인 Ctor입니다.

공개 메소드

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)

adb 연결 잠재적인 문제를 방지하려면 SSH를 사용하여 장치에서 버그 보고서를 받으세요.

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)

이 방법은 더 이상 사용되지 않습니다. 마스터 브랜치가 업데이트된 후 이를 제거하세요.

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

GCE_IP_PRECONFIGURED_KEY

public static final String GCE_IP_PRECONFIGURED_KEY

공개 생성자

GceManager

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

토르

매개변수
deviceDesc DeviceDescriptor : GCE 장치와 연결될 DeviceDescriptor .

deviceOptions TestDeviceOptions : 장치와 연결된 TestDeviceOptions .

buildInfo IBuildInfo : 시작할 gce 빌드를 설명하는 IBuildInfo 입니다.

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)

직접 사용할 GCE 인스턴스 이름을 제공하는 데 사용할 수 있는 변형인 Ctor입니다.

매개변수
deviceDesc DeviceDescriptor : GCE 장치와 연결될 DeviceDescriptor .

deviceOptions TestDeviceOptions : 장치와 연결된 TestDeviceOptions

buildInfo IBuildInfo : 시작할 gce 빌드를 설명하는 IBuildInfo .

gceInstanceName String : 사용할 인스턴스 이름입니다.

gceHost String : 사용할 인스턴스의 호스트 이름 또는 IP입니다.

공개 메소드

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 : 사전 구성된 IP를 사용하여 AVD가 원격 장치에서 생성되었는지 여부

보고
boolean 성공하면 참

대청소

public void cleanUp ()

getBugreportzWithSsh

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

adb 연결 잠재적인 문제를 방지하려면 SSH를 사용하여 장치에서 버그 보고서를 받으세요.

매개변수
gceAvd GceAvdInfo : 장치를 설명하는 GceAvdInfo .

options TestDeviceOptions : GCE 장치에 사용될 장치 옵션을 설명하는 TestDeviceOptions 입니다.

runUtil IRunUtil : 명령을 실행하는 IRunUtil 입니다.

보고
File zip 버그 보고서를 가리키는 파일이거나, 문제가 발생한 경우 null입니다.

던지기
IO예외

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 : GCE 장치에 사용될 장치 옵션을 설명하는 TestDeviceOptions 입니다.

runUtil IRunUtil : 명령을 실행하는 IRunUtil 입니다.

보고
File zip 버그 보고서를 가리키는 파일이거나, 문제가 발생한 경우 null입니다.

던지기
IO예외

로그NestedRemote파일

public static boolean logNestedRemoteFile (ITestLogger logger, 
                GceAvdInfo gceAvd, 
                TestDeviceOptions options, 
                IRunUtil runUtil, 
                String remoteFilePath, 
                LogDataType type)

중첩된 인스턴스에서 원격 파일을 가져와서 기록합니다.

매개변수
logger ITestLogger : 파일을 기록할 ITestLogger .

gceAvd GceAvdInfo : 장치를 설명하는 GceAvdInfo .

options TestDeviceOptions : GCE 장치에 사용될 장치 옵션을 설명하는 TestDeviceOptions 입니다.

runUtil IRunUtil : 명령을 실행하는 IRunUtil 입니다.

remoteFilePath String : 파일을 찾을 수 있는 원격 경로입니다.

type LogDataType : 기록된 파일의 LogDataType .

보고
boolean 파일이 성공적으로 기록되었는지 여부.

로그NestedRemote파일

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 : GCE 장치에 사용될 장치 옵션을 설명하는 TestDeviceOptions 입니다.

runUtil IRunUtil : 명령을 실행하는 IRunUtil 입니다.

remoteFilePath String : 파일을 찾을 수 있는 원격 경로입니다.

type LogDataType : 기록된 파일의 LogDataType .

baseName String : 파일을 기록하는 데 사용할 기본 이름입니다. null인 경우 실제 파일 이름이 사용됩니다.

보고
boolean 파일이 성공적으로 기록되었는지 여부.

로그직렬출력

public void logSerialOutput (GceAvdInfo infos, 
                ITestLogger logger)

GceAvdInfo 에 설명된 장치의 직렬 출력을 기록합니다.

매개변수
infos GceAvdInfo : 인스턴스를 설명하는 GceAvdInfo .

logger ITestLogger : 직렬 로그를 기록할 ITestLogger .

원격Ssh명령실행

public static CommandResult remoteSshCommandExecution (GceAvdInfo gceAvd, 
                TestDeviceOptions options, 
                IRunUtil runUtil, 
                long timeoutMs, 
                String... command)

인스턴스에서 SSH를 통해 원격 명령을 실행합니다.

매개변수
gceAvd GceAvdInfo : 장치를 설명하는 GceAvdInfo .

options TestDeviceOptions : GCE 장치에 사용될 장치 옵션을 설명하는 TestDeviceOptions 입니다.

runUtil IRunUtil : 명령을 실행하는 IRunUtil 입니다.

timeoutMs long : 명령의 시간 초과(밀리초)입니다. 0은 시간 초과가 없음을 의미합니다.

command String : 실행할 원격 명령입니다.

보고
CommandResult 실행 결과가 포함된 CommandResult 입니다.

종료Gce

public boolean shutdownGce ()

startGce() 와 연결된 Gce 인스턴스를 종료합니다.

보고
boolean gce 종료가 비차단으로 요청된 경우 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 : VM 메타데이터로 추가할 적용 가능한 정보를 GCE 인스턴스로 전달하는 데 사용되는 현재 호출과 관련된 속성

logger ITestLogger : 장치 실행 로그를 기록하는 ITestLogger .

보고
GceAvdInfo GCE 인스턴스를 설명하는 GceAvdInfo . 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 : AVD를 실행할 GCE 인스턴스의 초기 IP, 해당되지 않는 경우 null

attributes MultiMap : VM 메타데이터로 추가할 적용 가능한 정보를 GCE 인스턴스로 전달하는 데 사용되는 현재 호출과 관련된 속성

보고
GceAvdInfo GCE 인스턴스를 설명하는 GceAvdInfo . BOOT_FAIL 인스턴스일 수 있습니다.

던지기
com.android.tradefed.targetprep.TargetSetupError
TargetSetupError

시작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 : VM 메타데이터로 추가할 적용 가능한 정보를 GCE 인스턴스로 전달하는 데 사용되는 현재 호출과 관련된 속성

보고
GceAvdInfo GCE 인스턴스를 설명하는 GceAvdInfo . BOOT_FAIL 인스턴스일 수 있습니다.

던지기
com.android.tradefed.targetprep.TargetSetupError
TargetSetupError

startMultiDevicesGce

public  startMultiDevicesGce ( buildInfos)

이 방법은 더 이상 사용되지 않습니다.
마스터 브랜치가 업데이트된 후 이를 제거하세요.

매개변수
buildInfos

보고

던지기
TargetSetupError

startMultiDevicesGce

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

Oxygen을 사용하여 다중 기기 GCE 인스턴스를 시작해 보세요.

매개변수
buildInfos : ERROR(/List ) ERROR(/List )

attributes MultiMap : 현재 호출과 관련된 속성

보고
ERROR(/List ) ERROR(/List ) GCE 평균 정보를 설명합니다.

던지기
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

보고

buildShutdown명령

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