Gandi Wiki


Questions

Migrate your disk

Thanks to Boris, for this tutorial taken from his documentation.

The new storage infrastructure has a new way to manage swap. It automatically adjusts this partition on the virtual server. Your system disk therefore does not have any partition, it is thus possible to resize it!

The installation of Debian 6 (squeeze) on a disk created before April 2011 does not have any swap (the distribution was prepared for the new infrastructure, but the disks created before that date are located on the old storage infrastructure.

The best way to proceed with this change for the time being is to use |Gandi's XML-RPC API.

Here is s little python script that will create a new disk from the existing disk.

#!/usr/bin/env python
import xmlrpclib
apikey = <votreClefAPI>
hosting_api = xmlrpclib.ServerProxy('https://rpc.gandi.net/xmlrpc/2.0/')
VMs = hosting_api.vm.list(apikey)
for i in range(len(VMs)):
if VMs[i]['hostname'] == <HostNameDeLaVM> :
    if VMs[i]['state'] == 'halted' :
        print "Copying..."
        src_disk_id = VMs[i]['disks_id'][<IndexDuDisque>] # mettre 0 si le disque est unique ou si c'est le premier.
        # Autrement, l'id du disque est affiché dans l'url de sa page, sur le site de Gandi.
        disk_spec = {'datacenter_id' : <1 pour Paris, 2 pour Baltimore>, 'name' : <NomSouhaitéDuDisque>}
        hosting_api.disk.create_from(apikey, disk_spec, src_disk_id)

For more information, please see the hosting API documentation at: http://doc.rpc.gandi.net/hosting/reference.html#datacenter

Questions

No question on this page and its children.

RSS feed for questions matching this filter (Help)

Last modified: 18 May 2011 at 17:22 by Emerick M. (Gandi)