IBM SmartCloud Enterprise accounts are enabled in such a way that shared images are only visible from within the same account. Usually, the shared images are images customized by the enterprise to fulfill specific business needs, but there are more and more cases in which a customer has different SmartCloud Enterprise accounts for different purposes (such as development, pre-production, production, testing), and the customer wants to share such private image assets among different accounts to both protect the assets and avoid duplicate work effort. Note, the user is responsible to ensure all actions are legal within the terms and conditions of the software component.
IBM SmartCloud Enterprise 2.0 provides an amazing solution for such requirements. This article provides a step-by-step guide to transferring an image from one account to another. One prerequisite for this task is that the operator has to have the credentials for both accounts.
The business scenario used in this article is as follows:
- An organization has two accounts in SmartCloud Enterprise: One is for testing (accountA in Research Triangle Park, North Carolina data center) and the other is for production (accountB in Boulder, Colorado data center).
- Users prepare and validate an image in the testing account; when done, the image is ready for production deployment.
To save the duplicated effort of preparing an identical image for the production account, the user can adopt the documented steps here to transfer an image from his testing account (accountA) to his production account (accountB).
Descriptions of the resources used in this article are listed in Table 1.
Table 1. Resource references in this article
| Resource type | Information regarding transfer from | Information regarding transfer to |
|---|---|---|
| Data Center | RTP data center | Boulder data center |
| Account | AccountA | AccountB |
| Login Id | idA@cn.ibm.com | idB@cn.ibm.com |
| Instance Name | instanceA (be captured) | instanceB (be provisioned based on transferred image) |
| Image Name | to_be_transferred_image (captured from instanceA) | transferred_image (same copy of to_be_transferred_image) |
| Instance name of storage server | storage_server_accountA (Redhat 6, 170.224.165.60) | storage_server_accountB (Redhat 6, 170.225.100.188) |
| Key name of storage server | key_accountA | key_accountB |
| Persistent storage name | storageA (ext3) | storageB (ext3) |
Task 1: Set up the SmartCloud command line tool environment
In addition to the user interface, a command line tool is provided to access the SmartCloud service. Currently, some features are only available through a command line tool, such as image copy-to and import, which are the necessary steps to transfer images.
The SmartCloud command line tool runs on JRE (Java™ Runtime Environment), so make sure you have JRE in place before issuing any SmartCloud command. The steps assume all SmartCloud commands are issued from a single machine (Windows® XP machine in these steps).
Step 1: Set up the JDK runtime
Download JDK 1.6 (Java Development Kit) from http://java.com/en/download/index.jsp; make sure you set the JAVA_HOME variable accordingly.
After installation, run java -version to check that it
installed successfully. If you find a class not found exception, it could be caused by having the wrong JRE installed.
Step 2: Set up the SmartCloud command line tool
To utilize SmartCloud commands, you have to download the latest SmartCloud command line tool by accessing the SmartCloud Enterprise Support tab. You must be logged in to IBM SmartCloud Enterprise to download the command line tool. Figure 1 shows the Command Line Tool Reference link.
Figure 1. SmartCloud Enterprise Support tab
The command line tool is maintained by the IBM asset management system. You are directed to an asset management page after you click Command Line Tool Reference.
Figure 2 shows the Command Line Tool asset page. Click Download this Asset to download the SmartCloud command line tool.
Figure 2. Download link for the Command Line Tool
You should see a DeveloperCloud_CMD_Tool.zip file after extracting Command Line Tool Reference and Binaries.zip file; this is where the SmartCloud command line files are. You should further extract the DeveloperCloud_CMD_Tool.zip into a path that doesn't contain any spaces, for example, C:\DeveloperCloud_CMD_Tool.
The GA_CommandLine.pdf file is a help document containing the commands mentioned in this article. The pdf file is in the Command Line Tool Reference and Binaries.zip file.
To facilitate and secure operations on SmartCloud through the SmartCloud command line tool, you should create a password protection file for each login credential (Listings 1 and 2). The path, C:\DeveloperCloud_CMD_Tool\keys is used in this example. Please note, we created the directory "keys" ourselves in advance.
Listing 1. Create protection file for idA
C:\DeveloperCloud_CMD_Tool>ic-create-password -u idA@cn.ibm.com -password password -w unlock -g ./keys/idA.ext Executing action: CreatePassword ... Password File created successfully! Path : C:\DeveloperCloud_CMD_Tool\.\keys\idA.ext File Name :idA.ext Please do not edit this file! The request has been submitted successfully. Executing CreatePassword finished |
Listing 2. Create protection file for idB
C:\DeveloperCloud_CMD_Tool>ic-create-password -u idB@cn.ibm.com -password password -w unlock -g ./keys/idB.ext Executing action: CreatePassword ... Password File created successfully! Path : C:\DeveloperCloud_CMD_Tool\.\keys\idB.ext File Name :idB.ext Please do not edit this file! The request has been submitted successfully. Executing CreatePassword finished |
If you run into any problem when executing this SmartCloud command, check the log under C:\DeveloperCloud_CMD_Tool\logs.
Task 2: Copy image from accountA
Currently, SmartCloud copies images into a persistent storage; such storage should have a non-attached status when copying the image. Let's create a fresh storage before issuing a copy-to command.
Step 1: Create a persistent storage to store copied image
You can create persistent storage either through the SmartCloud Enterprise user interface or the command line tool. These steps use the user interface.
Login to SmartCloud Enterprise with the ID idA@cn.ibm.com from the user interface and navigate to Control panel > Storage > Add storage. Figure 3 shows what to enter in the fields of the Add Storage window.
Figure 3. Add Storage window
Note, we're using the Linux® system to transfer images, so ext3 is selected. You have to evaluate the size of your transferred image in advance to help determine what size you should take at this step. Make sure the data center is the same one where your image is located.
As you can see in Figure 4, the newly created storage, storageA is in Non-Attached status which means you can use this storage to keep your copied image.
Figure 4. Created storage
Step 2: Capture image and enable "copy allowed"
Let's assume you already captured an image (named "to_be_transferred_image") with idA@cn.ibm.com in RTP data center. By default, such a captured image is private and cannot be copied. To enable the image copy feature on a private image, you have to set copy allowed to Yes within the SmartCloud Enterprise asset management system. The following steps show you how.
- Click View asset catalog to view image information.
Figure 5. View asset catalog
- Select your captured image and click the name.
Figure 6. View image asset
- Click the edit icon shown in Figure 7.
Figure 7. View image information
- Click More on the Edit page as shown in Figure 8.
Figure 8. Edit image information
- Select Y for Copy Allowed and click the Update
button.
Figure 9. Set copy allowed to "yes"
Step 3: Test command line tool by describing captured image
Before you copy the image, test to see if the SmartCloud command line tool is running correctly when it connects to the SmartCloud service.
In this step, run ic-describe-image to see if image information can be returned.
- Get the parameter values ready for the command. The important parameter is
image id. You can get the image ID from the SmartCloud user interface as shown in Figure 10:
Figure 10. Get image ID from the SmartCloud Enterprise Images tab
- Issue the
describecommand (Listing 3).
Listing 3. The describe captured image commandC:\DeveloperCloud_CMD_Tool>ic-describe-image -u idA@cn.ibm.com -w unlock -g ./keys/idA.ext -k 20043123
The command line tool should run with no exception thrown, and the image information should display after running the command.
Step 4: Run the copy-to command
To copy the image, you have to know the storage id of storageA. You can get the ID from the Storage tab in the SmartCloud Enterprise user interface.
Figure 11. Get the storage id of storageA
Now you have both image id and storage id, it's time to run the copy-to command (Listing 4). Make sure the storageA status is
Non-Attached before issuing the command.
Listing 4. Run the copy-to command
C:\DeveloperCloud_CMD_Tool>ic-copy-to -u idA@cn.ibm.com -w unlock -g ./keys/idA.ext -v 25893 -I 20043123 Executing action: CopyTo ... The request has been submitted successfully. ID: 25893 Name: storageA Owner: liuyank@cn.ibm.com Size: 512 Gib Format : ext3 State: COPYING Location: 41 Storage Area Id: Storage Area Name: ..... Platform Version: 2 Executing CopyTo finished |
You can frequently run the ic-describe-image command to check
the status (Listing 5). The copy-to command should be
finished successfully if the state is listed as AVAILABLE;
COPYING means it is still copying. For a 60GB image, it can take 40 minutes.
Listing 5. Describe image to check copying status
C:\DeveloperCloud_CMD_Tool>ic-describe-image -u idA@cn.ibm.com -w unlock -g ./keys/idA.ext -k 20043123 Executing action: DescribeImage ... ID: 20043123 Name: to_be_transferred_image Visibility: PRIVATE State: COPYING Owner: idA@cn.ibm.com Platform: Red Hat Enterprise Linux/5.7 Location: 41 |
You can also check the status by issuing ic-describe-volume, which is used to describe storage.
Task 3: Transfer image files from accountA to accountB
To transfer images between different accounts, you have to set up two virtual machines.
Step 1: Create source instance: storage_server_accountA
This server acts as the copy source and the following operations in this step are against the RTP data center.
- Login with idA@cn.ibm.com, which is under accountA. Create a key named
key_accountA. Download this key from SmartCloud Enterprise to a local machine. - Create a RedHat 6 instance (
storage_server_accountA) with persistent storage attached (created in Copy image from accountA) andkey_accountAassociated. Figures 12 and 13 provide the details.
Figure 12. Create storage_server_accountA
Figure 13. Attach storageA
-
Note, set the mount point as /mnt when attaching the storage to
storage_server_accountA. After the image copies, you can see there is a directory called image under /mnt. Check the /mnt directory after the storage instance is provisioned. Login tostorage_server_accountAthrough an SSH tool such as xshell. Check files under /mnt to see if the image directory has been created by the copying command.
Figure 14. Verify image directory is created
Step 2: Create target instance: storage_server_accountB
This server is to receive the transferred image and the following operations are against the Boulder data center in this step.
- Through the SmartCloud Enterprise user interface, login with idB@cn.ibm.com which is under accountB.
- Create a persistent storage named storage with the ext3 format and 512GB.
Figure 15. Create storageB
- Create a new key named
key_accountBand download the key to a local machine. - Create a RedHat 6 instance (
storage_server_accountB) with storageB attached andkey_accountBset.
Figure 16. Create storage_server_accountB
- The mount point is /mnt when attaching storage into this instance.
Figure 17. Attach storageB
Step 3: Copy image files from accountA to accountB
There are several ways (NFS, SFTP, SCP) to copy image files from accountA to accountB. This article provides two ways to transfer an image: SCP and NFS.
Transfer image files through SCP
- As idcuser, ssh to storage_server_accountA. In this example, xshell is used to do that.
- Issue vi to create a new key file for this purpose.
Figure 18. Create new key file for SCP purpose
- Copy content from key_accountB (which was downloaded in the previous steps) to this
new file. Note, you can open key_accountB with Windows note editor if you're running
xshell from a Windows system, and then paste it into the vi new file.
Figure 19. Content of the key_accountB
- As idcuser, login to storage_server_accountB and check files under /mnt. As you can see, there is no image directory at this moment.
Figure 20. Verify no image directory on storage_server_accountB
- As idcuser, login to storage_server_accountA, issue the
scpcommand as root. This command will copy the image folder from storage_server_accountA to storage_server_accountB with key file of storage_server_accountB set.
Figure 21 depicts the detailed steps of copying image files from accountA(storage_server_accountA) to accountB(storage_server_accountB).
Figure 21. Execute SCP command to copy image files
The 100% in Figure 22 indicates that the copy is completed.
Figure 22. Transfer is complete
Transfer image through NFS service
- As idcuser, login to storage_server_accountA.
- Set up the NFS service on storage_server_accountA. Add
/mnt/image *(rw,no_root_squash)into /ext/exports when vi /etc/exports (Listing 6).
Listing 6. Get the NFS service up[idcuser@vhost1335 ~]$ sudo bash [root@vhost1335 idcuser]# vi /etc/exports [root@vhost1335 idcuser]# /sbin/service iptables stop iptables: Flushing firewall rules: [ OK ] iptables: Setting chains to policy ACCEPT: filter [ OK ] iptables: Unloading modules: [ OK ] [root@vhost1335 idcuser]# /sbin/service nfs start Starting NFS services: [ OK ] Starting NFS quotas: [ OK ] Starting NFS daemon: [ OK ] Starting NFS mountd: [ OK ] [root@vhost1335 idcuser]#
Note, in this example, the firewall is stopped. To be safe, open the ports required by NFS services rather than stopping the firewall. - As idcuser, login to storage_server_accountB, run the
mountandcopycommands on this server by running the commands shown in Listing 7. These commands move the image files from storage_server_accountA to storage_server_accountB.
Listing 7. Mount image directory[idcuser@ vhost1208 ~]$ sudo bash [root@vhost1208 idcuser]# mkdir /mnt/tmp [root@vhost1208 idcuser]# mkdir /mnt/image [root@vhost1208 idcuser]# /sbin/service iptables stop iptables: Flushing firewall rules: [ OK ] iptables: Setting chains to policy ACCEPT: filter [ OK ] iptables: Unloading modules: [ OK ] [root@vhost1208 idcuser]# mount -t nfs 170.224.165.60:/mnt/image /mnt/tmp [root@vhost1208 idcuser]# cp -r /mnt/tmp/* /mnt/image [root@vhost1208 idcuser]#umount /mnt/tmp
Verify image transfer is completed by listing /mnt/image on storage_server_accountB.
Figure 23. Verify image files are copied
Task 4: Import image into accountB
Though you copied image files into storage_server_accountB, it's still not yet an image asset of accountB. To make it an image asset of accountB, you have to perform image import operations.
Step 1: Delete instance storage_server_accountB to detach persistent storage
The import image command only works well when the storage has been detached, so we have you to delete the storage_server_accountB to detach persistent storage. In this example, delete it using the SmartCloud Enterprise user interface.
Step 2: Import image with idB@cn.ibm.com which belongs to accountB
Before you import the image, you have to know the storage id of storageB, which is used to keep copied image files. Figure 24 shows you how to access the id of storageB.
Figure 24. Get storage id of storageB
You're ready to run the import command. You can get a new
image id for the imported image at this step (Listing 8). This image id is uesd to
check importing status later on storage_server_accountB. Also, here you provide a new name (transferred_image) for the imported image.
Listing 8. Execute image import command
C:\DeveloperCloud_CMD_Tool>ic-import-image -u idB@cn.ibm.com -w unlock -g ./keys/idB.ext -n "tranferred_image" -v 25970 Executing action: ImportImage ... The request has been submitted successfully. Image ID: 20043226 Name: tranferred_image Description: A generic bundle/subcomponent to price imported images that did not originate from SmartCloud Location: 82 Owner: idB@cn.ibm.com State: IMPORTING Visibility: PRIVATE .... Executing ImportImage finished |
Again, you can frequently run the describe command to check the
status of importing. The import is finished successfully when the state is AVAILABLE; it is not finished if the state is IMPORTING. For a 60GB image, it can take about 30 minutes.
Listing 9. Check status of image importing
C:\DeveloperCloud_CMD_Tool>ic-describe-image -u idB@cn.ibm.com -w unlock -g ./keys/idB.ext -k 20043226 Executing action: DescribeImage ... ID: 20043226 Name: tranferred_image Visibility: PRIVATE State: IMPORTING Owner: idB@cn.ibm.com Platform: Location: 82 Architecture: Documentation: Manifest: Description: A generic bundle/subcomponent to price imported images that did not originate from SmartCloud ....... |
You can also check status by logging in (as idB@cn.ibm.com) to the SmartCloud Enterprise user interface as shown in Figure 25.
Figure 25. Check status of image importing
Step 3: Verification on accountB
The direct way to verify the imported image is to provision a new instance based on the previous imported image.
Find the imported image from the user interface with accountB id (idB@cn.ibm.com), select it, and click Create instance.
Figure 26. Select imported image to provision
Provision the instance as you usually do. After provisioning, check to see if you can login to a new instance then see if services on that instance can run well.
In this article, we've provided the detailed steps necessary to perform image transfer between accounts, even those accounts located at different IBM data centers. With this feature provided by IBM SmartCloud Enterprise 2.0, you have better choices to protect your assets. However, SmartCloud Enterprise only supports this type of image transfer one image at a time. Keep watching. As soon as we've developed an enhanced solution to transfer images in batch, we'll let you know.
Learn
-
For more on how to perform tasks in the SmartCloud Enterprise, visit these resources:
- Up and download files from a Windows instance.
- Install IIS web server on Windows 2008 R2.
- Create an IBM Cloud instance with the Linux command line.
- Create an IBM Cloud instance with the Windows command line.
- Extend your corporate network with the IBM Cloud.
- High availability apps in the IBM Cloud.
- Parameterize cloud images for custom instances on the fly.
- Windows-targeted approaches to IBM Cloud provisioning.
- Deploy products using rapid deployment service.
- Integrate your authentication policy using a proxy.
- Configure the Linux Logical Volume Manager.
- Deploy a complex topology using a deployment utility tool.
- Provision and configure an instance that spans a public and private VLAN.
- Secure IBM Cloud access for Android devices.
- Recover data in IBM SmartCloud Enterprise.
- Secure virtual machine instances in the cloud.
-
In the developerWorks cloud developer resources, discover and share knowledge and experience of application and services developers building their projects for cloud deployment.
- Find out how to access IBM SmartCloud Enterprise.
Get products and technologies
-
See the product images available for IBM SmartCloud Enterprise.
Discuss
-
Join a cloud computing group on developerWorks.
-
Read all the great cloud blogs on developerWorks.
-
Join the developerWorks community, a professional network and unified set of community tools for connecting, sharing, and collaborating.
Chun Feng Wu is an IBM Certified Solution Advisor and an IBM Certified Solution Architect for cloud computing. He worked on the IBM public cloud, SmartCloud Enterprise and now works on IBM managed cloud, SmartCloud Enterprise Plus.
Yi Shuai Wang is an Advisory Architect at IBM and lead developer for the development of the business support services of IBM SmartCloud Enterprise.







