def AddServer(self):
        #from CvlAddVm import AddVm
        #process = AddVm(self.path, self.userId, self.serverName, self.nectarId)
        #if process.run() == False:
        #    logging.error("Failed to add VM " + self.serverName)
        #    return False
        #return True

        logging.debug('AddServer: ' + str((self.userId, self.serverName, self.nectarId,)))

        try:
            vm_name = self.serverName

            vm_info = utils.get_vm_info(vm_name)
            logging.debug('vm_info: ' + str(vm_info))

            vm_ip       = vm_info['ip']
            vm_ram      = vm_info['ram']
            vm_disk     = vm_info['disk']
            vm_id       = vm_info['id']
            vm_vcpus    = vm_info['vcpus']

            vm_db = cvlsql.sql_add_vm(0, vm_name, vm_id, vm_ip, vm_ram, vm_vcpus, vm_disk, self.projectGroup, self.nectarId)

            logging.debug('Added vm to database: ' + str(vm_db))

            user_db    = Cvl_users.select(Cvl_users.q.id==self.userId).getOne()
            user_vm_db = Cvl_cvl_vm_user.select(Cvl_cvl_vm_user.q.id==self.userId).getOne()

            logging.debug('username: '******'creating user account <%s> on vm %s' % (user_db.username, vm_ip,))

            cvlfabric.env.hosts = [vm_ip]
            cvlfabric.execute(cvlfabric.new_user, username=user_db.username, password=user_vm_db.vmPassword, public_key=user_vm_db.publicKey)
            cvlsql.add_user_to_vm(user_db, vm_db)

            return True
        except:
            logging.debug('error adding unmanaged VM to system: ' + traceback.format_exc())
            return False
from utils import nova_client, get_vm_info
from cvlsql import Cvl_cvl_vm

nc = nova_client()

db_vms   = list(Cvl_cvl_vm.select())
nova_vms = nc.servers.list()

db_ips   = [x.vmIp for x in db_vms]
nova_ips = [get_vm_info(x.name)['ip'] for x in nova_vms]

# VMs with the same name?

duplicate_db_names   = [x.vmServerName for x in db_vms    if len([y for y in db_vms   if y.vmServerName == x]) > 1]
duplicate_nova_names = [x.name         for x in nova_vms  if len([y for y in nova_vms if y.name         == x]) > 1]

if len(duplicate_db_names) > 0:
    print 'Multiple VMs exist in the database with the following names:', duplicate_db_names
if len(duplicate_nova_names) > 0:
    print 'Multiple VMs exist in Nectar with the following names:', duplicate_nova_names

# Unmanaged VMs?
unmanaged_vms = [x for x in nova_vms if get_vm_info(x.name)['ip'] not in db_ips]

if len(unmanaged_vms) > 0:
    print 'VMs in Nectar tenancy %s that are not managed by by the User Management system:' % (nc.project_id,)
    for x in unmanaged_vms:
        print get_vm_info(x.name)['ip'], x.name
    print

# Orphaned VM records?