• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2019 - The Android Open Source Project
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#     http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14r"""GoldfishRemoteImageRemoteInstance class.
15
16Create class that is responsible for creating a goldfish remote instance AVD
17with a remote image.
18"""
19
20from acloud.create import base_avd_create
21from acloud.internal.lib import utils
22from acloud.public.actions import create_goldfish_action
23
24
25class GoldfishRemoteImageRemoteInstance(base_avd_create.BaseAVDCreate):
26    """Create class for a remote image remote instance AVD."""
27
28    @utils.TimeExecute(function_description="Total time: ",
29                       print_before_call=False, print_status=False)
30    def _CreateAVD(self, avd_spec, no_prompts):
31        """Create the AVD.
32
33        Args:
34            avd_spec: AVDSpec object that tells us what we're going to create.
35            no_prompts: Boolean, True to skip all prompts.
36
37        Returns:
38            A Report instance.
39        """
40        report = create_goldfish_action.CreateDevices(avd_spec=avd_spec)
41
42        # Launch vnc client if we're auto-connecting.
43        if avd_spec.connect_vnc:
44            utils.LaunchVNCFromReport(report, avd_spec, no_prompts)
45        return report
46