• Home
  • Raw
  • Download

Lines Matching full:container

21 from autotest_lib.site_utils.lxc.container import Container
34 """A wrapper class to interact with containers in a specific container path.
47 @param base_name: Name of the base container image. Used to initialize a
52 @param base_container_path: Path to the directory used for the base container.
60 # Pass in the container path so that the bucket is hermetic (i.e. so
61 # that if the container path is customized, the base image doesn't
62 # fall back to using the default container path).
65 container = BaseImage(base_container_path, base_name).get()
75 base_container=container,
84 include the base container, or any containers owned by the container
90 indexed by container name.
95 logging.debug("Clearing cached container info")
98 # The keys of `containers` are container.ContainerId object, not a
103 container = Container.create_from_existing_dir(self.container_path,
106 if container.id is not None:
107 containers[container.id] = container
115 """Get a container with matching name.
117 @param container_id: ID of the container.
119 @return: A container object with matching name. Returns None if no
120 container matches the given name.
122 logging.debug("Fetching LXC container with id %s", container_id)
124 logging.debug("Found container %s in cache", container_id)
127 container = self.get_all().get(container_id, None)
128 if container:
129 return container
132 "Could not find container by container id object: %s (%s)",
134 # When load container Ids from disk, we cast job_id from NoneType to a
137 logging.debug('Try to get container by the id string: %s',
143 logging.debug('Could not find container by id string: %s',
149 """Check if a container exists with the given name.
151 @param container_id: ID of the container.
153 @return: True if the container with the given ID exists, otherwise
163 for container in sorted(
165 key = container.id
166 logging.info('Destroy container %s.', container.name)
167 container.destroy()
172 """Destroy a possibly-nonexistent, possibly-malformed container.
174 This exists to clean up an unreachable container which may or may not
176 is accordingly scorched-earth and force-destroys the container with all
180 @param name: ID of the container.
186 "Force-destroying container %s if it exists, with timeout %s sec",
196 logging.warning("Force-destruction of container %s timed out.",
215 """Setup test container for the test job to run.
224 to run in container.
226 @param container_id: ID to assign to the test container.
227 @param job_id: Job id for the test job to run in the test container.
229 @param result_path: Directory to be mounted to container to store test
234 container failures.
237 the container. Default is None.
238 @return: A Container object for the test container.
240 @raise ContainerError: If container does not exist, or not running.
254 # container is setup. If scheduler is restarted during that period, the
261 # Create test container from the base container.
262 container = self._factory.create_container(container_id)
265 container.install_ssp(server_package_url)
267 deploy_config_manager = lxc_config.DeployConfigManager(container)
272 container.install_control_file(safe_control)
290 # Update container config to mount directories.
292 container.mount_dir(source, destination, readonly)
295 # TODO(dshi): crbug.com/459344 Skip following action when test container
296 # can be unprivileged container.
298 container.rootfs,
303 container.start(wait_for_network=True, log_dir=result_path)
306 # Update the hostname of the test container to be `dut-name`.
308 # group test results in dashboard. The default container name is set to
310 # id and timestamp. For better result view, the container's hostname is
313 container.set_hostname(constants.CONTAINER_UTSNAME_FORMAT %
316 container.modify_import_order()
318 container.verify_autotest_setup(job_folder)
320 logging.debug('Test container %s is set up.', container.name)
321 return container