Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
98 changes: 98 additions & 0 deletions docs/openstack/share_image.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
# Share an Image in Openstack

You can share an image from your project with a collaborator in a different project in OpenStack cloud so you can both launch instances using the same image. As the owner of the image, you can revoke the sharing privilege at any time. You can also use these methods to share an image with yourself in other projects, just think of yourself as the collaborator.
Comment thread
wwarriner marked this conversation as resolved.
Outdated

Comment thread
wwarriner marked this conversation as resolved.
**Prerequisites:**
Comment thread
wwarriner marked this conversation as resolved.
Outdated

- You will need to set up the OpenStack CLI to work with the project where the image to be shared is located.
Comment thread
wwarriner marked this conversation as resolved.
Outdated

```shell
python3 -m venv openstackclient-env
source openstackclient-env/bin/activate
pip install --upgrade pip
pip install python-openstackclient
```

- Source the openrc file from your openstack project. You can download it from your openstack project's dashboard by clicking on the project name in the top right. Click on the Openstack RC file from the drop down to download it.

```shell
# Source your openrc file
source <PATH_TO_YOUR_OPENRC_FILE>
```

- Find the ID of the target project you want to share the image with
Comment thread
wwarriner marked this conversation as resolved.
Outdated

```shell
# This runs on the receiver
openstack project list
```

This information can also be found via the OpenStack UI
Comment thread
wwarriner marked this conversation as resolved.
Outdated

## Share an Image With Another Project

1. Find the image ID you want to share
Comment thread
wwarriner marked this conversation as resolved.
Outdated

```shell
openstack image list
```

1. Set the image visibility to shared

```shell
openstack image set --shared <IMAGE_NAME_OR_ID>
```

1. Share the image with the target project

```shell
openstack image add project <IMAGE_NAME_OR_ID> <TARGET_PROJECT_ID>
```

## Accept a Shared Image

- Source the Target Project's Credentials: The user in the target project needs to source the appropriate OpenStack credentials for their project.
Comment thread
wwarriner marked this conversation as resolved.
Outdated
- Accept the Shared Image: The target project user then accepts the shared image using its ID:
Comment thread
wwarriner marked this conversation as resolved.
Outdated

```sh
# Run this on receiver's end
openstack image set --accept <IMAGE_NAME_OR_ID>
```

Upon acceptance, the image will appear in the target project's image list.

## Unshare an Image (Optional)

If you would like to remove a project from having access to the image, you can do the following
Comment thread
wwarriner marked this conversation as resolved.
Outdated

- An image's owner can see which projects have access to the image:
Comment thread
wwarriner marked this conversation as resolved.
Outdated

```shell
openstack image member list <IMAGE_NAME_OR_ID>
```

- The owner can unshare an image like this:
Comment thread
wwarriner marked this conversation as resolved.
Outdated

```shell
openstack image remove project <IMAGE_NAME_OR_ID> <TARGET_PROJECT_ID>
```

## Share an Image With the Community (Optional)

You can also share an image with a community of users.

- To share an image with the community you need to set the visibility like this

```shell
openstack image set --visibility community <IMAGE_NAME_OR_ID>
```

Community images do not appear in the default image lists.

- To list an image shared to the community

```shell
openstack image list --community
```

If you need to withdraw a community image, you can change its visibility back to "private" or delete it.
1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ nav:
- Openstack:
- VM Migration: openstack/vm_migration.md
- VM Service Setup: service/service_setup.md
- Share Openstack Image: openstack/share_image.md

validation:
nav:
Expand Down