code: def create(gandi, name, vm, size, snapshotprofile, datacenter, source,
             background):
      
      try:
          gandi.datacenter.is_opened(datacenter, 'iaas')
      except DatacenterLimited as exc:
          gandi.echo('/!\ Datacenter %s will be closed on %s, '
                     'please consider using another datacenter.' %
                     (datacenter, exc.date))
  
      if vm:
          vm_dc = gandi.iaas.info(vm)
          vm_dc_id = vm_dc['datacenter_id']
          dc_id = int(gandi.datacenter.usable_id(datacenter))
          if vm_dc_id != dc_id:
              gandi.echo('/!\ VM %s datacenter will be used instead of %s.'
                         % (vm, datacenter))
          datacenter = vm_dc_id
  
      output_keys = ['id', 'type', 'step']
      name = name or randomstring('vdi')
  
      disk_type = 'data'
      oper = gandi.disk.create(name, vm, size, snapshotprofile, datacenter,
                               source, disk_type, background)
  
      if background:
          output_generic(gandi, oper, output_keys)
  
      return oper
docs: Create a new disk.