GceManager

public class GceManager
extends Object

java.lang.Object의 클래스
   ↳ com.android.tradefed.device.cloud.GceManager


GCE 호출을 시작/중지하고 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, 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를 사용하여 기기에서 bugreportz를 가져옵니다.

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

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, MultiMap<String, String> attributes)

산소가 포함된 멀티 기기 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: AVD가 사전 구성된 IP로 원격 기기에서 만들어졌는지 여부

반환 값
boolean 성공한 경우 true

정리

public void cleanUp ()

getBugreportzWithSsh

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

잠재적인 adb 연결 문제를 방지하기 위해 ssh를 사용하여 기기에서 bugreportz를 가져옵니다.

매개변수
gceAvd GceAvdInfo: 기기를 설명하는 GceAvdInfo입니다.

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

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

반환 값
File zip 버그 신고를 가리키는 파일 또는 문제가 발생한 경우 null입니다.

생성 값
IOException

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입니다.

생성 값
IOException

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

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

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입니다.

원격 SshCommand 실행

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를 반환합니다.

startGCE

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

startGCE

public GceAvdInfo startGce ()

반환 값
GceAvdInfo

생성 값
TargetSetupError

startGCE

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

startGCE

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)

산소가 포함된 멀티 기기 gce 인스턴스를 시작하려고 합니다.

매개변수
buildInfos : ERROR(/List)

attributes MultiMap: 현재 호출과 연결된 속성

반환 값
GCE Avd 정보를 설명하는 ERROR(/List)

생성 값
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

반환 값

추출 인스턴스 이름

protected String extractInstanceName (String bootupLogs)

gce 부팅 로그에서 인스턴스 이름을 검색합니다. 'name': 'gce-' 패턴을 검색하여 이름을 추출합니다. gce 부팅 실패 시 시도한 인스턴스 이름이 json에 표시되지 않으므로 결과 파일 대신 로그에서 추출합니다.

매개변수
bootupLogs String

반환 값
String