Managing your cloud resources with OpenStack: Difference between revisions

Added section on how to share images between projects
No edit summary
(Added section on how to share images between projects)
Line 91: Line 91:
You can then [[OpenStack#Downloading an image |download the image]] as described below. It is best to detach the volume from the VM before you create an image from the volume. If the volume is a boot volume you will likely need to delete your VM to detach it, however, make sure you have not checked "Delete Volume on Instance Delete" when creating the VM.
You can then [[OpenStack#Downloading an image |download the image]] as described below. It is best to detach the volume from the VM before you create an image from the volume. If the volume is a boot volume you will likely need to delete your VM to detach it, however, make sure you have not checked "Delete Volume on Instance Delete" when creating the VM.


=Creating an Image from a VM= <!--T:42-->
=Working with images=
==Creating an Image from a VM== <!--T:42-->
Using the [[OpenStack Command Line Clients]] issue the command
Using the [[OpenStack Command Line Clients]] issue the command
{{Command| openstack server image create <server-name>}}
{{Command| openstack server image create <server-name>}}
where <code><server-name></code> should be replaced with the name of your server. This action will only include the VM's root drive (e.g. /dev/vda) in the image. Ephemeral drives and non-boot attached volumes will not be included in the image so additional measures should be taken to preserve this data. In addition, if the VM is writing to disk while the image is being created the file system may be captured in an inconsistent state. We recommend the VM be shut off (not deleted) before an image is created from it.
where <code><server-name></code> should be replaced with the name of your server. This action will only include the VM's root drive (e.g. /dev/vda) in the image. Ephemeral drives and non-boot attached volumes will not be included in the image so additional measures should be taken to preserve this data. In addition, if the VM is writing to disk while the image is being created the file system may be captured in an inconsistent state. We recommend the VM be shut off (not deleted) before an image is created from it.
==Sharing an image with another project==
Sharing an image with another project is a two step process.
# A member of the project owning the image must share it with a second project.
# A member of the second project must accept the newly shared image.
To share an image a member in the project owning the image uses the command below.
<source lang="console">
[name@server]$  glance member-create <IMAGE_ID> <MEMBER_ID>
+------------+-------------+---------+
| Image ID  | Member ID  | Status  |
+------------+-------------+---------+
| <IMAGE_ID> | <MEMBER_ID> | pending |
+------------+-------------+---------+
</source>
where
<code><IMAGE_ID></code> is the ID of image to be shared, and `<MEMBER_ID>` is the ID of project to share with.
To accept the shared image a member in the second project uses the command below.
<source lang="console">
[name@server]$  glance member-update <IMAGE_ID> <MEMBER_ID> <MEMBER_STATUS>
+------------+-------------+----------+
| Image ID  | Member ID  | Status  |
+------------+-------------+----------+
| <IMAGE_ID> | <MEMBER_ID> | accepted |
+------------+-------------+----------+
</source>
where `<IMAGE_ID>` is the image from which to update member, `<MEMBER_ID>` is the project to update, and `<MEMBER_STATUS>` the new status of the image. Valid Values for status are `accepted`, `rejected`, and `pending`. The image will the be available for use and appear in the OpenStack dashboard's list of images in the second project.


=Accessing a VM with Multiple Users= <!--T:28-->
=Accessing a VM with Multiple Users= <!--T:28-->
cc_staff
1,486

edits