Volumes - create
Use this command to create a volume.
Format:
admin.volumes.create({<propertyName>:<value>,...})
When creating a volume, you must provide either a volume configuration
or the size attribute, but not both.
The type attribute can have one of the following values:
"vmfs"(default value)"raw""block""block_shared""block_vmfs"
Example:
>>>admin.volumes.create({'name':'test',
'description': 'test_create_volume', 'size': 1000, 'type': 'raw'
"cloud":admin.clouds[0]})"
{
"createdtime": "Thu, 19 Jan 2012 11:42:16 GMT",
"description": "test_create_volume",
"harddiskdrive": None,
"id":
"/admin/resources/volumes/2a2ed959-1167-4d46-a7b1-3946f3c1e9a2",
"isosvolume": "true",
"label": None,
"name": "test",
"size": 1000,
"solidstatedrive": None,
"units": "MB",
"updatedtime": "Thu, 19 Jan 2012 11:42:16 GMT",
"volume_configuration": None
}
>>> admin.volumes.create({'name':'test',
'description': 'test_create_volume', "cloud":admin.clouds[0],
'volume_configuration':admin.clouds[0].volumeconfigurations[0]})
{
"createdtime": "Thu, 19 Jan 2012 14:19:58 GMT",
"description": "test_create_volume",
"harddiskdrive": None,
"id":
"/admin/resources/volumes/5470b407-a92a-426f-a573-7d1d9d03f7f4",
"isosvolume": "true",
"label": None,
"name": "test",
"size": None,
"solidstatedrive": None,
"units": "MB",
"updatedtime": "Thu, 19 Jan 2012 14:19:58 GMT",
"volume_configuration": None
}
When a volume is added to a virtual machine it is not usable until the volume is formatted and the creation of a valid partition is performed. To validate that the volume is attached successfully, use the following command:
fdisk -l
When this command is entered the volume is listed, but is not formatted
and does not contain a valid partition. The following example displays
typical results when the fdisk -l command is entered.
Disk /dev/sda: 12.9 GB, 12884901888 bytes
255 heads, 63 sectors/track, 1566 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00005a0f
Device Boot Start End Blocks Id System
/dev/sda1 * 1 1306 10484736 83 Linux
/dev/sda2 1306 1567 2097152 82 Linux swap / Solaris
Disk /dev/sda: 12.9 GB, 12884901888 bytes
Disk /dev/sdb: 10 MB, 10485760 bytes
1 heads, 20 sectors/track, 1024 cylinders
Units = cylinders of 20 * 512 = 10240 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
Disk /dev/sdb doesn't contain a valid partition table