X

News, tips, partners, and perspectives for the Oracle Solaris operating system

Playing around with the Oracle Storage Cloud Service

Glynn Foster
Product Manager

As part of my work to bring Oracle Solaris into the Oracle Cloud Compute Service, I've had the opportunity to spend a little time playing around with the Oracle Storage Cloud Service. Put simply, this service provides secure, scalable object storage similar to other storage services out there such as Amazon S3 or Dropbox.

The documentation is pretty useful. Like most storage services, there's support for a variety of different interfaces - from a REST API, to a Java client library, and a number of 3rd party tools like OpenStack Swift.

In the rest of the blog, I'll demonstrate some of the basic operations you can do - for convience I'll log into a VM running Oracle Solaris in the Oracle Cloud:

$ ssh opc@X.X.X.X
Last login: Tue Mar 22 01:27:35 2016 from 121-73-133-192.
Oracle Corporation SunOS 5.11 11.3 December 2015
opc@fa922d:~$ uname -a
SunOS fa922d 5.11 11.3 i86pc i386 i86pc
opc@fa922d:~$ virtinfo
NAME CLASS
xen current
non-global-zone supported
opc@fa922d:~$ pkg info entire
Name: entire
Summary: entire incorporation including Support Repository Update (Oracle Solaris 11.3.4.5.0).
Description: This package constrains system package versions to the same
build. WARNING: Proper system update and correct package
selection depend on the presence of this incorporation.
Removing this package will result in an unsupported system. For
more information see:
https://support.oracle.com/rs?type=doc&id=2045311.1
Category: Meta Packages/Incorporations
State: Installed
Publisher: solaris
Version: 0.5.11 (Oracle Solaris 11.3.4.5.0)
Build Release: 5.11
Branch: 0.175.3.4.0.5.0
Packaging Date: January 14, 2016 09:32:35 PM
Size: 5.46 kB
FMRI: pkg://solaris/entire@0.5.11,5.11-0.175.3.4.0.5.0:20160114T213235Z

We'll start by using the REST API. To find the service endpoint, we can log into the web portal and look at the REST Endpoint field as shown in the image below:




This gets us something like https://computepm.storage.oraclecloud.com/v1/Storage-computepm (which will include the identity domain that you're assoicated with). Once we have this, we can make a calls to the API based on a variation of this URL. We'll need to authenticate with the service first and get back a token that we'll use in subsequent REST calls. For that we'll need to set two headers: X-Storage-User and X-Storage-Pass, that is a combination of our identity domain, username, and password. In my case my identity domain is compute-pm and username is glynn.foster@oracle.com. Let's start by using curl with the verbose flags and defaulting to HTTP 1.0 (scroll the entries below to see the full content):

opc@fa922d:~$ curl -v -O -H "X-Storage-User: Storage-computepm:glynn.foster@oracle.com" -H "X-Storage-Pass: XXXXXXXX" https://computepm.storage.oraclecloud.com/auth/v1.0
* Trying 129.152.32.56...
* Failed to set TCP_KEEPALIVE on fd 4
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* Connected to computepm.storage.oraclecloud.com (129.152.32.56) port 443 (#0)
* successfully set certificate verify locations:
* CAfile: none
CApath: /etc/openssl/certs
* TLSv1.2, TLS handshake, Client hello (1):
} [174 bytes data]
* TLSv1.2, TLS handshake, Server hello (2):
{ [85 bytes data]
* TLSv1.2, TLS handshake, CERT (11):
{ [2861 bytes data]
* TLSv1.2, TLS handshake, Server finished (14):
{ [4 bytes data]
* TLSv1.2, TLS handshake, Client key exchange (16):
} [262 bytes data]
* TLSv1.2, TLS change cipher, Client hello (1):
} [1 bytes data]
* TLSv1.2, TLS handshake, Finished (20):
} [16 bytes data]
* TLSv1.2, TLS change cipher, Client hello (1):
{ [1 bytes data]
* TLSv1.2, TLS handshake, Finished (20):
{ [16 bytes data]
* SSL connection using TLSv1.2 / AES128-SHA
* Server certificate:
* subject: C=US; ST=California; L=Redwood Shores; O=Oracle Corporation; CN=*.storage.oraclecloud.com
* start date: 2015-08-07 00:00:00 GMT
* expire date: 2016-10-05 23:59:59 GMT
* subjectAltName: computepm.storage.oraclecloud.com matched
* issuer: C=US; O=VeriSign, Inc.; OU=VeriSign Trust Network; OU=Terms of use at https://www.verisign.com/rpa (c)10; CN=VeriSign Class 3 Secure Server CA - G3
* SSL certificate verify ok.
> GET /auth/v1.0 HTTP/1.1
> User-Agent: curl/7.40.0
> Host: computepm.storage.oraclecloud.com
> Accept: */*
> X-Storage-User: Storage-computepm:glynn.foster@oracle.com
> X-Storage-Pass: XXXXXXXX
>
< HTTP/1.1 200 OK
< Date: Tue, 22 Mar 2016 02:31:44 GMT
< X-Auth-Token: AUTH_tk04c63cb4928e2aacb26f4506d6c9a331
< X-Storage-Token: AUTH_tk04c63cb4928e2aacb26f4506d6c9a331
< X-Storage-Url: https://us6.storage.oraclecloud.com/v1/Storage-computepm
< Content-Length: 0
< Server: Oracle-Storage-Cloud-Service
<
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
* Connection #0 to host computepm.storage.oraclecloud.com left intact

We can see that we've successfully completed the authentication and the service has passed by a token indicated by the X-Auth-Token response header.

Within the storage service, we have a heirarchy of containers and objects. Containers is a user created resource and can hold any number of objects. An object is created typically when a file is uploaded to the service. Containers cannot be nested, but meta-data can be attached to both containers and objects to make searching and managing easier. To list the containers associated with my identity domain we call another API as follows:

opc@fa922d:~$ curl -0 -X GET -H "X-Auth-Token: AUTH_tk04c63cb4928e2aacb26f4506d6c9a331" https://computepm.storage.oraclecloud.com/v1/Storage-computepm
compute_images
compute_images_segments
incoming

We can list objects in the container by specifying the container we would like to query:

opc@fa922d:~$ curl -0 -X GET -H "X-Auth-Token: AUTH_tk04c63cb4928e2aacb26f4506d6c9a331" https://computepm.storagcloud.com/v1/Storage-computepm/compute_images
EBS1224-hadoop-seeded.img.tar.gz
Fedora-Cloud-Base-22-20150521.x86_64.tar.gz
JEOS_OL_6.6_10GB_RE-1.0.002-20141105-033705.tar.gz-1.2.400-20151103-170503.tar.gz
OVM_EL6U7_x86_64_EBSO_12.2.4_DB_PROD.tar.gz
...
s11_3_4_5_0-System.img.tar.gz

Let's try and download this Oracle Solaris image as follows:

opc@fa922d:~$ curl -O -X GET -H "X-Auth-Token: AUTH_tk04c63cb4928e2aacb26f4506d6c9a331" https://computepm.storage.oraclecloud.com/v1/Storage-computepm/compute_images/s11_3_4_5_0-System.img.tar.gz > s11_3_4_5_0-System.img.tar.gz
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1395M 100 1395M 0 0 88146 0 4:36:43 4:36:43 --:--:-- 203k

Let's create a new container:

opc@fa922d:~$ curl -0 -X PUT -H "X-Auth-Token: AUTH_tk04c63cb4928e2aacb26f4506d6c9a331" https://computepm.storage.oraclecloud.com/v1/Storage-computepm/new-container
opc@fa922d:~$ curl -0 -X GET -H "X-Auth-Token: AUTH_tk04c63cb4928e2aacb26f4506d6c9a331" https://computepm.storage.oraclecloud.com/v1/Storage-computepm
compute_images
compute_images_segments
incoming
new-container

Let's push a new file into this container and verify it's there:

opc@fa922d:~$ curl -O -X PUT -H "X-Auth-Token: AUTH_tk04c63cb4928e2aacb26f4506d6c9a331" https://computepm.storage.oraclecloud.com/v1/Storage-computepm/new-container/new-file
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1626 0 0 100 1626 0 3504 --:--:-- --:--:-- --:--:-- 8424
opc@fa922d:~$ curl -0 -X GET -H "X-Auth-Token: AUTH_tk04c63cb4928e2aacb26f4506d6c9a331" https://computepm.storage.oraclecloud.com/v1/Storage-computepm/new-container
new-file

So rather than a raw set of HTTP requests, let's use something a little nicer. The Oracle Storage Cloud Service is compatible with the OpenStack Swift service, and so we can use the Python based swift client. We'll first need to install it into our VM:

opc@fa922d:~$ su -
Password:
Oracle Corporation SunOS 5.11 11.3 December 2015
root@fa922d:~# pkg install swiftclient
Packages to install: 84
Create boot environment: No
Create backup boot environment: No
DOWNLOAD PKGS FILES XFER (MB) SPEED
Completed 84/84 9622/9622 39.2/39.2 943k/s
PHASE ITEMS
Installing new actions 11229/11229
Updating package state database Done
Updating package cache 0/0
Updating image state Done
Creating fast lookup database Done
Updating package cache 1/1
root@fa922d:~# exit
opc@fa922d:~# which swift
/usr/bin/swift

To use the client, we'll need to set some environmental variables. Rather than setting the OS_* variables, we'll have to use the legacy ST_* ones for the 1.0 versioned API as follows:

opc@fa922d:~$ export ST_AUTH=https://computepm.storage.oraclecloud.com/auth/v1.0
opc@fa922d:~$ export ST_USER=Storage-computepm:glynn.foster@oracle.com
opc@fa922d:~$ export ST_KEY=XXXXXXXX

Now let's list the containers:

opc@fa922d:~$ swift list
compute_images
compute_images_segments
incoming
new-container

And list the objects of new-container:

opc@fa922d:~$ swift list new-container
new-file

We can get information about our file:

opc@fa922d:~$ swift stat new-container new-file
Account: Storage-computepm
Container: new-container
Object: new-file
Content Type: application/octet-stream;charset=UTF-8
Content Length: 1626
Last Modified: Tue, 22 Mar 2016 03:07:45 GMT
ETag: c3eaad86f6572bf9e52a9b0c16aa905c
Accept-Ranges: bytes
Server: Oracle-Storage-Cloud-Service
Connection: keep-alive
X-Timestamp: 1458616064.51712
X-Trans-Id: tx1f7a06307a7744909fe6a-0056f0b9b1ga
X-Last-Modified-Timestamp: 1458616064.51712

We can download a file as follows:

opc@fa922d:~$ swift download new-container new-file
new-file [auth 0.118s, headers 0.181s, total 0.181s, 0.026 MB/s]

Or upload a file into our container:

opc@fa922d:~$ swift upload new-container another-new-file
another-new-file
opc@fa922d:~$ swift list new-container
another-new-file
new-file

And finally, delete our container:

opc@fa922d:~$ swift delete new-container
another-new-file
new-file
opc@fa922d:~$ swift list
compute_images
compute_images_segments
incoming

Be the first to comment

Comments ( 0 )
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.Captcha