softlayerFastUploadVHDtoBS
Object Storage Uploader
Overview
We’ve recently added the option to import customer-supplied Virtual Hard Disks (VHDs) to our object storage offering. This is a great option for our customers who may have special virtual machines that they have spent hours perfecting. Since learning to import these images can pose a slight challenge, especially for those unfamiliar with object storage (OpenStack Swift), I wrote this blog to share scripts that will streamline the process.
Object Storage
SoftLayer’s object storage is an enhanced version of OpenStack Swift. Although we’ve added features to it, the API (on the whole) is still the same. Two requirements of particular importance to storing disk images are limitations and requirements on large files. Swift limits all files to be 5GB or less. To support larger files users need to create a manifest file that combines smaller files into one large file.
For example, to upload a 12GB VHD, the user is expected to segment the file into at least three files and then create a manifest that brings them back together.
Easier Importing
Since many people don’t have the time to learn the inner workings of Swift and would just like to get VHDs running on their servers, I have created a set scripts to simplify the process. They handle the authentication, file segmentation, and dynamic manifest creation for you, so you can get up and running quickly. You can easily access them here .
You can use a Bash script or a Python 3 script. Both do the same thing, but depending on your environment you may prefer one over the other.
But before we jump into the scripts, you’ll need to find your object storage username and password.
To get those, log in to http://control.softlayer.com, go to Storage->Object Storage, select your cluster (I would suggest Dallas 5 for your first tests), and then click “View Credentials” in the top left of the page. You will be presented with a modal window containing your username and API Key (or password) for object storage.
ObjectStorageUploader.sh - Bash Edition
The idea behind this script is to have as little user interaction as possible. By calling the script with the proper parameters, you are able to walk away and let it do its thing.
Simply place the bash script in your directory of VHDs. Call the script by passing in the image you want to upload, the location to upload it (container/filename), and your Swift username and password.
$ ./ObjectStorageUpload.sh myOS.vhd 'myContainer/myOS.vhd' 'SLOS1234-1:SL1234' 'apikey'
It will begin the process of walking through the segments of the file and building up your object in object storage.
ObjectStorageUploader.py - Python 3 Edition
Before we begin, make sure you have installed the latest version of Python 3 located here: https://www.python.org/downloads/
Any Python 3 release will work, but I have been using Python 3.4.0 for my testing.
The idea behind this script is to actually walk you through the process of uploading a file to Swift. Use this script via supplied parameters, in “interactive mode,” or a combination of the two. This is particularly handy for Windows users who are newer to scripting. Simply drop the script in the folder containing your VHDs, run it, and let it guide you through uploading the image to object storage.
To execute the script, place it in the directory where you store your VHDs and double click it. It will then prompt you to select the file you want to upload.
After selecting your file, you will be asked for your Swift username and password. Authentication will be attempted and, if successful, the list of containers in your cluster will be presented.
Select the container you want to upload to and the script will begin uploading the VHD to object storage.
If you prefer the command line arguments approach, you can pass in arguments to this script too. The signature is slightly different since all the opinions are optional.
$ python ObjectStorageUpload.py -f myOS.vhd -t 'myContainer/myOS.vhd' -u 'SLOS1234-1:SL1234' -p 'apikey'
Importing Uploaded VHD as Image Templates
Now that your image is in object storage you can import your VHD into the SoftLayer template, so you can use it to provision a new virtual server!
Go to your image templates page in the portal and click the “Import Image” tab. Select the Swift account, cluster, container, and file that you uploaded. Give your new template a name and some notes. Make sure to fill out the Operating System information properly as this is used when setting up your new server, and finally click “Import.”
Lastly, you will be emailed after the VHD has been processed by our system
softlayerFastUploadVHDtoBS的更多相关文章
随机推荐
- global.asax?app.config?webconfig??
一.Global.asax 1.global.asax是什么? 一个文本文件,至于它包含写什么内容?顾名思义,global 肯定是掌管一个应用程序(application)的全局性的东西,例如应用程序 ...
- ServerSocketChannel实现多Selector高并发server
参考hbase RpcServer,编写了一个简洁版多Selector server,对nio怎么用,Selector如何选择事件会有更深入的认识. client端发送消息:内容长度 + 内容,200 ...
- PHP设计模式笔记三:三种基本设计模式(工厂模式、单例模式、注册树模式) -- Rango韩老师 http://www.imooc.com/learn/236
一.工厂设计模式 index.php $db = IMooc\Factory::createDatabase(); 使用工厂类的静态方法直接创建一个dababase对象,当类名发生修改时,在工厂里修改 ...
- JMeter Building a Database Test Plan
Building a Database Test Plan In this section, you will learn how to create a basic Test Planto test ...
- mysql连接提示1030
今天上午,开发使用工具连上mysql,连接一个库,就提示 mysql 错误 ERROR 1030 Got error 28 from. 查询资料,说可能是磁盘空间不足.果然连上去一看/分区空间只有数十 ...
- 【转】Xcode升到6.4插件失效,与添加插件不小心点击Skip Bundle解决办法
转载自:http://www.jianshu.com/p/d51547d29309 今天升级了xcode到6.4 发现之前装的插件不能使用了.这里有一个解决的方案: 步骤如下: 一.查看Xcode的U ...
- C# 大小写转换
全部大写: string upper = str.ToUpper() 全部小写: string lower = str.ToLower(); str是需要转换的字符.
- update-database时出现Cannot attach the file
在进行Migrations时,如果直接删除了Db文件,在使用update-database时会出现Cannot attach the file发问题 解决方案:
- FpSpread添加标注
先看效果 实现: FarPoint.Web.Spread.StyleInfo Errorcss = new FarPoint.Web.Spread.StyleInfo(); Errorcss.Bord ...
- 流输入练习——寻找Sb.VI codevs 3096
题目描述 Description 已知某开放授权人员名叫Serb,由于经常修改各种数据,因此开发人员们都喊他SB.现在他和许多人一起过飞机安检,排成了一长队列,请问SB.是否在队列中. 输入描述 In ...