Skip to content
Snippets Groups Projects

Added image sharing

Merged Jaromír Hradil requested to merge feature/Add-image-sharing into master
1 file
+ 54
0
Compare changes
  • Side-by-side
  • Inline
+ 54
0
@@ -101,6 +101,60 @@ os_distro=ubuntu # example
5. OpenStack will resize instance after start. Image shouldn't contain any empty partitions or free space
## Image sharing between projects
Image sharing allows you to share your image between different projects and then it is possible to launch instances from that image in those projects with other collaborators etc. As mentioned in section about CLI, you will need to use your OpenStack credentials from ```openrc``` or ```cloud.yaml``` file.
Then to share an image you need to know it's ID, which you can find with command:
```
openstack image show <name_of_image>
```
where ```name_of_image``` is name of image you want to share.
After that you will also have to know ID of project you want to share your image with. If you do not know ID of that project you can use following command, which can help you find it:
```
openstack project list | grep <name_of_other_project>
```
where ```<name_of_project>``` is name of other project. It's ID will show up in first column.
Now all with necessary IDs you can now share your image. First you need to set an attribute of image to `shared` by following command:
```
openstack image set --shared <image_ID>
```
And now you can share it with your project by typing this command:
```
openstack image add project <image_ID> <ID_of_other_project>
```
where ```ID_of_other_project``` is ID of project you want to share image with.
Now you can check if user of other project accepted your image by command:
```
openstack image member list <image_ID>
```
If the other user did not accepted your image yet, status column will contain value: ```pending```.
**Accepting shared image**
To accept shared image you need to know ```<image_ID>``` of image that other person wants to share with you. To accept shared image to your project
you need to use following command:
```
openstack image set --accept <image_ID>
```
You can then verify that by listing your images:
```
openstack image list | grep <image_ID>
```
**Unshare shared image**
As owner of the shared image, you can check all projects that have access to the shared image by following command:
```
openstack image member list <image_ID>
```
When you find ```<ID_project_to_unshare>``` of project, you can cancel access of that project to shared image by command:
```
openstack image remove project <image ID> <ID_project_to_unshare>
```
## Add SWAP file to instance
By default VMs after creation do not have SWAP partition. If you need to add a SWAP file to your system you can download and run [script](https://gitlab.ics.muni.cz/cloud/cloud-tools/blob/master/swap.sh) that create SWAP file on your VM.
Loading