code: def vhost_add(cls, resource, params):
          
          try:
              oper = cls.call(
                  'hosting.rproxy.vhost.create', cls.usable_id(resource), params)
              cls.echo('Adding your virtual host (%s) into %s' %
                       (params['vhost'], resource))
              cls.display_progress(oper)
              cls.echo('Your virtual host habe been added')
              return oper
          except Exception as err:
              if err.code == 580142:
                  dc = cls.info(resource)
                  dns_entry = cls.call('hosting.rproxy.vhost.get_dns_entries',
                                       {'datacenter': dc['datacenter']['id'],
                                        'vhost': params['vhost']})
                  txt_record = "%s 3600 IN TXT \"%s=%s\"" % (dns_entry['key'],
                                                             dns_entry['key'],
                                                             dns_entry['txt'])
  
                  cname_record = "%s 3600 IN CNAME %s" % (dns_entry['key'],
                                                          dns_entry['cname'])
  
                  cls.echo('The domain don\'t use Gandi DNS or you have not'
                           ' sufficient right to alter the zone file. '
                           'Edit your zone file adding this TXT and CNAME '
                           'record and try again :')
                  cls.echo(txt_record)
                  cls.echo(cname_record)
                  cls.echo('\nOr add a file containing %s at :\n'
                           'http://%s/%s.txt\n' % (dns_entry['txt'],
                                                   dns_entry['domain'],
                                                   dns_entry['txt']))
  
              else:
                  cls.echo(err)
docs: Add a vhost into a webaccelerator