이 콘텐츠는 선택한 언어로 제공되지 않습니다.
Chapter 3. Object Storage and Containers
OpenStack Object Storage (openstack-swift) stores its objects (data) in containers, which are similar to directories in a file system although they cannot be nested. Containers provide an easy way for users to store any kind of unstructured data; for example, objects might include photos, text files, or images. Stored objects are neither encrypted nor compressed.
3.1. Object Storage Service Administration 링크 복사링크가 클립보드에 복사되었습니다!
The following procedures explain how to further customize the Object Storage service to suit your needs.
3.1.1. Set Object Storage as a Back End for the Image Service 링크 복사링크가 클립보드에 복사되었습니다!
The OpenStack Image service, by default, saves images and instance snapshots to the local filesystem in /var/lib/glance/images/. Alternatively, you can configure the Image service to save images and snapshots to the Object Storage service (when available).
To do so, perform the following procedure:
Log into the node running the Image service (the controller node also running Identity) as root and source your OpenStack credentials (this is typically a file named
openrc).source ~/openrc
# source ~/openrcCopy to Clipboard Copied! Toggle word wrap Toggle overflow Verify that the Image service is part of the tenant
servicewith roleadmin.keystone user-role-list --user glance --tenant service
# keystone user-role-list --user glance --tenant serviceCopy to Clipboard Copied! Toggle word wrap Toggle overflow One of the roles returned should be
admin.Open the
/etc/glance/glance.conffile and comment out the following lines:##### DEFAULT OPTIONS ##### #default_store = file #filesystem_store_datadir = /var/lib/glance/images/
##### DEFAULT OPTIONS ##### #default_store = file #filesystem_store_datadir = /var/lib/glance/images/Copy to Clipboard Copied! Toggle word wrap Toggle overflow In the same file, add the following lines to the
DEFAULT OPTIONSsection.default_store = swift swift_store_auth_address = http://KEYSTONEIP:35357/v2.0/ swift_store_user = service:glance swift_store_key = ADMINPW swift_store_create_container_on_put = True
default_store = swift swift_store_auth_address = http://KEYSTONEIP:35357/v2.0/ swift_store_user = service:glance swift_store_key = ADMINPW swift_store_create_container_on_put = TrueCopy to Clipboard Copied! Toggle word wrap Toggle overflow Where:
-
KEYSTONEIPis the IP address of the Identity service, and -
ADMINPWis the value of admin password attribute in the/etc/glance/glance-api.conffile.
-
Apply the changes by restarting the Image service:
systemctl restart openstack-glance-api systemctl restart openstack-glance-registry
# systemctl restart openstack-glance-api # systemctl restart openstack-glance-registryCopy to Clipboard Copied! Toggle word wrap Toggle overflow
From this point onwards, images uploaded to the Image service (whether through the Dashboard or glance) should now be saved to an Object Storage container named glance. This container exists in the service account.
To verify whether newly-created images are saved to the Image service, run:
ls /var/lib/glance/images
# ls /var/lib/glance/images
Once the Dashboard or the glance image-list reports the image is active, you can verify whether it is in Object Storage by running the following command:
swift --os-auth-url http://KEYSTONEIP:5000/v2.0 --os-tenant-name service --os-username glance --os-password ADMINPW list glance
# swift --os-auth-url http://KEYSTONEIP:5000/v2.0 --os-tenant-name service --os-username glance --os-password ADMINPW list glance
3.2. Basic Container Management 링크 복사링크가 클립보드에 복사되었습니다!
To help with organization, pseudo-folders are logical devices that can contain objects (and can be nested). For example, you might create an Images folder in which to store pictures and a Media folder in which to store videos.
You can create one or more containers in each project, and one or more objects or pseudo-folders in each container.
3.2.1. Create a Container 링크 복사링크가 클립보드에 복사되었습니다!
- In the dashboard, select Project > Object Store > Containers.
- Click Create Container.
Specify the Container Name, and select one of the following in the Container Access field.
Expand Type Description PrivateLimits access to a user in the current project.
PublicPermits API access to anyone with the public URL. However, in the dashboard, project users cannot see public containers and data from other projects.
- Click Create Container.
3.2.2. Create Pseudo Folder for Container 링크 복사링크가 클립보드에 복사되었습니다!
- In the dashboard, select Project > Object Store > Containers.
- Click the name of the container to which you want to add the pseudo-folder.
- Click Create Pseudo-folder.
- Specify the name in the Pseudo-folder Name field, and click Create.
3.2.3. Delete a Container 링크 복사링크가 클립보드에 복사되었습니다!
- In the dashboard, select Project > Object Store > Containers.
- Browse for the container in the Containers section, and ensure all objects have been deleted (see Section 3.2.6, “Delete an Object”).
- Select Delete Container in the container’s arrow menu.
- Click Delete Container to confirm the container’s removal.
3.2.4. Upload an Object 링크 복사링크가 클립보드에 복사되었습니다!
If you do not upload an actual file, the object is still created (as placeholder) and can later be used to upload the file.
- In the dashboard, select Project > Object Store > Containers.
- Click the name of the container in which the uploaded object will be placed; if a pseudo-folder already exists in the container, you can click its name.
- Browse for your file, and click Upload Object.
Specify a name in the Object Name field:
- Pseudo-folders can be specified in the name using a / character (for example, Images/myImage.jpg). If the specified folder does not already exist, it is created when the object is uploaded.
- A name that is not unique to the location (that is, the object already exists) overwrites the object’s contents.
- Click Upload Object.
3.2.5. Copy an Object 링크 복사링크가 클립보드에 복사되었습니다!
- In the dashboard, select Project > Object Store > Containers.
- Click the name of the object’s container or folder (to display the object).
- Click Upload Object.
- Browse for the file to be copied, and select Copy in its arrow menu.
Specify the following:
Expand Field Description Destination container
Target container for the new object.
Path
Pseudo-folder in the destination container; if the folder does not already exist, it is created.
Destination object name
New object’s name. If you use a name that is not unique to the location (that is, the object already exists), it overwrites the object’s previous contents.
- Click Copy Object.
3.2.6. Delete an Object 링크 복사링크가 클립보드에 복사되었습니다!
- In the dashboard, select Project > Object Store > Containers.
- Browse for the object, and select Delete Object in its arrow menu.
- Click Delete Object to confirm the object’s removal.