craft_providers.lxd.launcher module

LXD Instance Provider.

craft_providers.lxd.launcher.launch(name, *, base_configuration, image_name, image_remote, auto_clean=False, auto_create_project=False, ephemeral=False, map_user_uid=False, uid=None, use_snapshots=False, project='default', remote='local', lxc=<craft_providers.lxd.lxc.LXC object>)[source]

Create, start, and configure instance.

If auto_clean is enabled, automatically delete an existing instance that is deemed to be incompatible, rebuilding it with the specified environment.

Parameters
  • name (str) – Name of instance.

  • base_configuration (Base) – Base configuration to apply to instance.

  • image_name (str) – LXD image to use, e.g. “20.04”.

  • image_remote (str) – LXD image to use, e.g. “ubuntu”.

  • auto_clean (bool) – Automatically clean instance, if incompatible.

  • auto_create_project (bool) – Automatically create LXD project, if needed.

  • ephemeral (bool) – Create ephemeral instance.

  • map_user_uid (bool) – Map host uid/gid to instance’s root uid/gid.

  • uid (Optional[int]) – The uid to be mapped, if map_user_id is enabled.

  • use_snapshots (bool) – Use LXD snapshots for bootstrapping images.

  • project (str) – LXD project to create instance in.

  • remote (str) – LXD remote to create instance on.

  • lxc (LXC) – LXC client.

Return type

LXDInstance

Returns

LXD instance.

Raises