Beispiel #1
0
    def POST(self, **params):
        key = params.get("key")
        keyname = params.get("keyname")
        if not params.get("action"):
            raise cherrypy.HTTPError('400 Bad parameters')

        username = cherrypy.request.cookie.get('fedid').value
        novaClient = getNovaInstance()

        # Cannot submit a blank key
        if key == "":
            # You must have a key
            raise cherrypy.HTTPError('400 You cannot submit a blank key, try again.')
        # User has no keypair, import one
        try:
            # User has no keypair, import one
            if keyname == "":
                FEDID = cherrypy.request.cookie.get('fedid').value
                keyname = FEDID
                novaClient.keypairs.create(name = keyname, public_key = key)
            # Editing existing keypair
            else:
                novaClient.keypairs.delete(keyname)
                novaClient.keypairs.create(name = keyname, public_key = key)
        except BadRequest:
            cherrypy.log('- BadRequest when submitting keypair to OpenStack', username, traceback=True)
            raise cherrypy.HTTPError('400 You have tried to submit an invalid key, try again.')
Beispiel #2
0
    def POST(self, **params):
        key = params.get("key")
        keyname = params.get("keyname")
        if not params.get("action"):
            raise cherrypy.HTTPError('400 Bad parameters')

        username = cherrypy.request.cookie.get('fedid').value
        novaClient = getNovaInstance()

        # Cannot submit a blank key
        if key == "":
            # You must have a key
            raise cherrypy.HTTPError(
                '400 You cannot submit a blank key, try again.')

    # User has no keypair, import one
        try:
            # User has no keypair, import one
            if keyname == "":
                FEDID = cherrypy.request.cookie.get('fedid').value
                keyname = FEDID
                novaClient.keypairs.create(name=keyname, public_key=key)
            # Editing existing keypair
            else:
                novaClient.keypairs.delete(keyname)
                novaClient.keypairs.create(name=keyname, public_key=key)
        except BadRequest as e:
            cherrypy.log(
                '- BadRequest when submitting keypair to OpenStack: ' + str(e),
                username)
            raise cherrypy.HTTPError(
                '400 You have tried to submit an invalid key, try again.')
Beispiel #3
0
    def GET(self):
        novaClient = getNovaInstance()
        username = cherrypy.request.cookie.get('fedid').value

        flavorList = []
        pattern = cherrypy.request.config.get("flavorPrefix")

        for flavor in novaClient.flavors.list():
            try:
                # match() only searches at start of the string
                # search() searches throughout entire string
                if re.match(pattern, flavor.name, flags=0):
                    flavorList.append({
                        'id': flavor.id,
                        'name': flavor.name,
                        'cpu': flavor.vcpus,
                        'ram': flavor.ram / 1024,
                        'disk': flavor.disk
                    })
            except AttributeError:
                cherrypy.log(
                    '- AttributeError while appending flavorList: ' +
                    str(flavor), username)
# Sorting flavors in ascending order
# Based on CPU, RAM & disk amounts
        flavorList.sort()

        return {"data": flavorList}
Beispiel #4
0
    def GET(self):
        novaClient = getNovaInstance()
        username = cherrypy.request.cookie.get('fedid').value

        json = []

        for server in novaClient.servers.list(detailed=True):
            # Gets URL with VNC token embedded
            if server.status == "ACTIVE":
                try:
                    vncURL = server.get_vnc_console(
                        console_type="novnc")[u'console'][u'url']
                    vncToken = self.cutString(vncURL, 62, len(vncURL))
                except ClientException:
                    cherrypy.log(
                        ' - Non-Fatal Exception when retrieving VNC details for VM: %s'
                        % (server.name),
                        username,
                        traceback=True)
                    vncURL = ""
                    vncToken = ""
            else:
                vncURL = ""
                vncToken = ""

            # Put VM data into json format for .js file
            json.append({
                'id': server.id,
                'token': vncToken,
                'vncURL': vncURL,
            })
        return {"data": json}
Beispiel #5
0
    def POST(self, **params):
        username = cherrypy.request.cookie.get('fedid').value
        if not params.get("id") or not params.get("action"):
            raise cherrypy.HTTPError('400 Bad parameters')

        novaClient = getNovaInstance()

        try:
            bootServer = novaClient.servers.find(id=params.get("id"))
        except NotFound as e:
            cherrypy.log(username + ' - ' + str(e))
            raise cherrypy.HTTPError(
                '500 OpenStack hasn\'t been able to find the VM you want to boot.'
            )

        bootServerState = bootServer.status

        try:
            if bootServerState == "SHUTOFF":
                bootServer.start()
            elif bootServerState == "SUSPENDED":
                bootServer.resume()
            elif bootServerState == "PAUSED":
                bootServer.unpause()
            elif bootServerState == "SHELVED" or bootServerState == "SHELVED_OFFLOADED":
                bootServer.unshelve()
        except ClientException as e:
            cherrypy.log(username + ' - ' + str(e))
            raise cherrypy.HTTPError(
                '500 There was a problem booting the VM, the VM was in the ' +
                bootServerState + ' state.')
Beispiel #6
0
Datei: vm.py Projekt: stfc/cloud
    def POST(self, **params):
        username = cherrypy.request.cookie.get('fedid').value
        if not params.get("id") or not params.get("action"):
            raise cherrypy.HTTPError('400 Bad parameters')

        novaClient = getNovaInstance()

        try:
             bootServer = novaClient.servers.find(id = params.get("id"))
        except NotFound:
             cherrypy.log('- Not Found Error', username, traceback=True)
             raise cherrypy.HTTPError('500 OpenStack hasn\'t been able to find the VM you want to boot.')

        bootServerState = bootServer.status

        try:
            if bootServerState == "SHUTOFF":
                bootServer.start()
            elif bootServerState == "SUSPENDED":
                bootServer.resume()
            elif bootServerState == "PAUSED":
                bootServer.unpause()
            elif bootServerState == "SHELVED" or bootServerState == "SHELVED_OFFLOADED":
                bootServer.unshelve()
        except ClientException:
            cherrypy.log('- Client Exception', username, traceback=True)
            raise cherrypy.HTTPError('500 There was a problem booting the VM, the VM was in the ' + bootServerState + ' state.')
Beispiel #7
0
    def GET(self):
        hostname = cherrypy.request.config.get("headnode")
        username = cherrypy.request.cookie.get('fedid').value
        auth_string = cherrypy.request.cookie.get('session').value

        novaClient = getNovaInstance()

	# Gets data for each image
	# os_distro - name of flavor
	menuchoices = defaultdict(lambda: defaultdict(dict))
	for image in novaClient.images.list():
            try:
                if image.metadata[u'os_distro'] is not None:
                    osDistro = image.metadata[u'os_distro']
	        else:
		    cherrypy.log("has an uninstantiated image flavour: " + str(image), username)
		    continue
    	        if image.metadata[u'os_version'] is not None:
                    osVersion = image.metadata[u'os_version']
                else:
                    cherrypy.log("has an uninstantiated image version: " + str(image), username)
                    continue
	        if image.metadata[u'os_variant'] is not None:
                    osVariant = image.metadata[u'os_variant']
                else:
                    cherrypy.log("has an uninstantiated image variant: " + str(image), username)
                    continue
            except KeyError:
                cherrypy.log("- KeyError when getting image metadata in image:" + str(image), username)

	    aqManaged = "false"
            try:
                if image.metadata[u'aq_managed'] == "true":
                    aqManaged = "true"
            except KeyError:
                cherrypy.log("- KeyError when seeing if an image is Aquilon managed, Image: " + str(image), username)

	    if osVariant not in menuchoices[osDistro][osVersion]:
	        menuchoices[osDistro][osVersion][osVariant] = list()

	    try:
	        description = image.metadata[u'description'] + ". "
            except KeyError:
		description = ""
                cherrypy.log("- KeyError in image:" + str(image), username)

	    menuchoices[osDistro][osVersion][osVariant].append({
		'name' : image.name,
		'id' : image.id,
		'minDisk' : image.minDisk,
		'minRAM' : image.minRam,
		'description' : description,
		'aqManaged' : aqManaged
	    })
        return menuchoices
Beispiel #8
0
Datei: vm.py Projekt: stfc/cloud
    def DELETE(self, id=None):
        username = cherrypy.request.cookie.get('fedid').value
        if id == None:
            raise cherrypy.HTTPError('400 Bad parameters')

        novaClient = getNovaInstance()
        try:
            novaClient.servers.delete(id)
        except ClientException as e:
            cherrypy.log('- ', username, traceback=True)
            raise cherrypy.HTTPError('500 There has been an unforeseen error in deleting the VM, try again later.')
Beispiel #9
0
    def PUT(self):
        json = cherrypy.request.json
        username = cherrypy.request.cookie.get('fedid').value
        novaClient = getNovaInstance()

        try:
            vm = novaClient.servers.find(id=json['id']);
            vm.update(json['name']);
            cherrypy.log("- Renamed VM (" + json['id'] + ") '" + json['prevname'] + "' to '" + json['name'] + "'", username)
        except (ClientException, KeyError) as e:
            cherrypy.log('- ', username, traceback=True)
            raise cherrypy.HTTPError('500 There has been a problem with renaming the VM, try again later.')
Beispiel #10
0
    def DELETE(self, id=None):
        username = cherrypy.request.cookie.get('fedid').value
        if id == None:
            raise cherrypy.HTTPError('400 Bad parameters')

        novaClient = getNovaInstance()
        try:
            novaClient.servers.delete(id)
        except ClientException as e:
            cherrypy.log('- ' + str(e), username)
            raise cherrypy.HTTPError(
                '500 There has been an unforeseen error in deleting the VM, try again later.'
            )
Beispiel #11
0
Datei: vm.py Projekt: stfc/cloud
    def PUT(self):
        username = cherrypy.request.cookie.get('fedid').value
        json = cherrypy.request.json

        if not json.get("template_id") or not json.get("name"):
            raise cherrypy.HTTPError('400 Bad parameters')

        novaClient = getNovaInstance()
        vmNetwork = cherrypy.request.config.get("vmNetworkLabel")

        # Making sure user has a keypair
        try:
            keyname = novaClient.keypairs.list()[0].name
        except IndexError:
            keyname = ""


        # Creating VM
        try:
            create_args = {
                'name'              : json['name'],
                'image'             : json['template_id'],
                'flavor'            : json['flavorID'],
                'key_name'          : keyname,
                'nics'              : [{"net-id": vmNetwork}],
                'security_groups'   : [cherrypy.request.config.get("securityGroupName")],
                'availability_zone' : cherrypy.request.config.get("availabilityZoneName"),
                'min_count'         : json['count']
            }

            # Aquilon
            meta = {}

            if ('archetype' in json) and (json['archetype'] is not None) and (json['archetype'] != ''):
                meta['AQ_ARCHETYPE'] = json['archetype']
                meta['AQ_PERSONALITY'] = json['personality']

            if ('sandbox' in json) and (json['sandbox'] is not None) and (json['sandbox'] != ''):
                meta['AQ_SANDBOX'] = json['sandbox']

            if (meta):
                create_args['meta'] = meta


            novaClient.servers.create(**create_args)

        except (ClientException, KeyError) as e:
            cherrypy.log('- ', username, traceback=True)
            raise cherrypy.HTTPError('500 There has been a problem with creating the VM, try again later.')
Beispiel #12
0
    def ssh(self):
        CLOUDPLATFORM = cherrypy.request.config.get("cloudPlatform")

        username = cherrypy.request.cookie.get('fedid').value
        novaClient = getNovaInstance()

        # Checking if user has a keypair and dealing if this isn't the case
        try:
            key = novaClient.keypairs.list()[0].public_key
            keyname = novaClient.keypairs.list()[0].name
        except IndexError:
            key = ""
            keyname = ""
        except AttributeError:
            key = ""
            keyname = ""
            cherrypy.log('- AttributeError when getting user\'s keypair:', username)
            raise cherrypy.HTTPError('500 There\'s been a problem with getting your keypair data')

        return { 'key' : key , 'keyname' : keyname, "cloudPlatform" : CLOUDPLATFORM }
Beispiel #13
0
    def GET(self):
        hostname = cherrypy.request.config.get("headnode")
        username = cherrypy.request.cookie.get('fedid').value
        auth_string = cherrypy.request.cookie.get('session').value

        novaClient = getNovaInstance()
        glanceClient = getGlanceInstance()

        # Gets data for each image
        # os_distro - name of flavor
        menuchoices = defaultdict(lambda: defaultdict(dict))
        for image in glanceClient.images.list(detailed = True):
            cherrypy.log('- Loading %s' %(image.name), username)

            cherrypy.log(' - %s' %(image), username)
            if image.get('status') == 'active':
                osDistro  = os_metadata_item(image, username, 'os_distro')
                osVersion = os_metadata_item(image, username, 'os_version')
                osVariant = os_metadata_item(image, username, 'os_variant')
                aqManaged = os_metadata_item(image, username, 'aq_managed')
                description = os_metadata_item(image, username, 'description')

                if osDistro is None or osVersion is None or osVariant is None:
                    cherrypy.log('- Image %s will not be visible' %(image.name), username)
                    continue
                else:

                    if osVariant not in menuchoices[osDistro][osVersion]:
                        menuchoices[osDistro][osVersion][osVariant] = list()

                    menuchoices[osDistro][osVersion][osVariant].append({
                        'name' : image.name,
                        'id' : image.id,
                        'minDisk' : image.min_disk,
                        'minRAM' : image.min_ram,
                        'description' : description,
                        'aqManaged' : aqManaged
                    })
            

        return menuchoices
Beispiel #14
0
    def PUT(self):
        username = cherrypy.request.cookie.get('fedid').value
        json = cherrypy.request.json

        if not json.get("template_id") or not json.get("name"):
            raise cherrypy.HTTPError('400 Bad parameters')

        novaClient = getNovaInstance()
        vmNetwork = novaClient.networks.find(
            label=cherrypy.request.config.get("vmNetworkLabel"))

        # Making sure user has a keypair
        try:
            keyname = novaClient.keypairs.list()[0].name
        except IndexError:
            raise cherrypy.HTTPError(
                '400 You haven\'t got a keypair, you must have a keypair to create a VM.'
            )

# Creating VM
        try:
            novaClient.servers.create(
                name=json['name'],
                image=json['template_id'],
                flavor=json['flavorID'],
                key_name=keyname,
                nics=[{
                    "net-id": vmNetwork.id
                }],
                security_groups=[
                    cherrypy.request.config.get("securityGroupName")
                ],
                availability_zone=cherrypy.request.config.get(
                    "availabilityZoneName"),
                min_count=json['count'])
        except (ClientException, KeyError) as e:
            cherrypy.log('- ' + str(e), username)
            raise cherrypy.HTTPError(
                '500 There has been a problem with creating the VM, try again later.'
            )
Beispiel #15
0
    def GET(self, action):
        novaClient = getNovaInstance()
        username = cherrypy.request.cookie.get('fedid').value

        json = []
        flavorInfo = {}

        for flavor in novaClient.flavors.list(detailed=True):
            flavorInfo[flavor.name] = [flavor.vcpus, flavor.ram]

        for server in novaClient.servers.list(detailed=True):
            # Print to command line - Testing what does what
            print server.name + " - " + server.status

            serverStatus = server.status

            # Converts date/time into format for .js file
            stime = datetime.strptime(server.created, '%Y-%m-%dT%H:%M:%SZ')
            stime = mktime(stime.timetuple())

            # Gets flavor ID --> flavor name
            try:
                flavorName = str(
                    novaClient.flavors.find(id=server.flavor[u'id']))
                flavorName = self.cutString(flavorName, 9, -1)
            except KeyError:  # KeyError for getting server.flavor[u'id']
                cherrypy.log(
                    '- KeyError when getting flavorName for VM: ' +
                    str(server.name), username)
                flavorName = ""

            # Gets image ID --> image name
            try:
                imageName = str(novaClient.images.find(id=server.image[u'id']))
                imageName = self.cutString(imageName, 8, -1)
            except KeyError:
                cherrypy.log(
                    '- KeyError when getting imageName for VM: ' +
                    str(server.name), username)
                imageName = ""

            hostname = ""
            try:
                serverIP = str(novaClient.servers.ips(server))
                if serverIP != "{}":
                    serverNetwork = self.getServerNetworkLabel(serverIP)
                    hostname = novaClient.servers.ips(
                        server)[serverNetwork][0][u'addr']
            except (ClientException, KeyError) as e:
                cherrypy.log(username + ' - ' + str(e))

    # Gets URL with VNC token embedded
            if serverStatus == "ACTIVE" and action != "1":
                try:
                    vncURL = server.get_vnc_console(
                        console_type="novnc")[u'console'][u'url']
                    vncToken = self.cutString(vncURL, 62, len(vncURL))
                except ClientException as e:
                    cherrypy.log(username + ' - ' + str(e))
                    vncURL = ""
                    vncToken = ""
            else:
                vncURL = ""
                vncToken = ""

            # Put VM data into json format for .js file
            json.append({
                'id': server.id,
                'name': server.name,
                'hostname': hostname,
                'user': "",
                'group': "",
                'state': serverStatus,
                'stime': stime,
                'etime': "",
                'flavor': flavorName,
                'cpu': flavorInfo[flavorName][0],
                'memory': flavorInfo[flavorName][1],
                'type': imageName,
                'token': vncToken,
                'vncURL': vncURL,
                'candelete': True,
                'keypair': server.key_name
            })
        return {"data": json}
Beispiel #16
0
    def GET(self):
        novaClient = getNovaInstance()
        username = cherrypy.request.cookie.get('fedid').value
        projectID = cherrypy.request.cookie.get('projectID').value

        # Getting project limits from Nova
        try:
            projectLimits = novaClient.limits.get().absolute
        except ClientException as e:
            cherrypy.log('- Error during API call of quota values', username, traceback=True)
            raise cherrypy.HTTPError('500 OpenStack cannot get the quota values.')

        # Converting Nova limits to a dictionary
        l = list(projectLimits)
        limits = dict(map(lambda x: (x.name, x.value), l))

        try:
            quotaData = {
                'groupquotamem' : limits['maxTotalRAMSize']/1024,
                'groupquotacpu' : limits['maxTotalCores'],
                'groupquotavm' : limits['maxTotalInstances'],

                'groupusedmem' : limits['totalRAMUsed']/1024,
                'groupusedcpu' : limits['totalCoresUsed'],
                'groupusedvm'  : limits['totalInstancesUsed'],
            }
        except KeyError:
            cherrypy.log('- KeyError getting quota values for project ID:', projectID, username)
            raise cherrypy.HTTPError('500 There has been an error getting quota data from OpenStack.')

        quotaDataKeys = []

        # Available quota figures, only used when there are limits on quotas

        if quotaData['groupquotamem'] > -1:
            quotaData['availablequotamem'] = quotaData['groupquotamem'] - quotaData['groupusedmem']

        if quotaData['groupquotacpu'] > -1:
            quotaData['availablequotacpu'] = quotaData['groupquotacpu'] - quotaData['groupusedcpu']

        if quotaData['groupquotavm'] > -1:
            quotaData['availablequotavm'] = quotaData['groupquotavm'] - quotaData['groupusedvm']

        # Available flavor limits, used when no quota or smaller than quota
        quotaDataKeys.append('biggestRAMAmount')
        quotaDataKeys.append('biggestCPUAmount')
        quotaDataKeys.append('biggestDiskAmount')

        ramList = []
        cpuList = []
        diskList = []
        # Searching each flavor to put each attribute into an indivdual list
        # Biggest value found a few lines below - this is used for sliders when creating a VM

        for flavor in novaClient.flavors.list():
            ramList.append(flavor.ram)
            cpuList.append(flavor.vcpus)
            diskList.append(flavor.disk)

        biggestAmountList = []
        # Puts each list into biggestAmountList to find max. value of each inner list
        self.listLengthCheck(ramList, biggestAmountList)
        self.listLengthCheck(cpuList, biggestAmountList)
        self.listLengthCheck(diskList, biggestAmountList)

        if len(quotaDataKeys) > 0:
            for i in range (0, len(quotaDataKeys)):
                try:
                    quotaData[quotaDataKeys[i]]= max(biggestAmountList[i])
                except AttributeError:
                    cherrypy.log('- Error when finding max. values of a resource.', username)
                    raise cherrypy.HTTPError('500 There\'s been an error when manipulating quota data.')
        return quotaData
Beispiel #17
0
    def GET(self):
        novaClient = getNovaInstance()
        username = cherrypy.request.cookie.get('fedid').value
        projectID = cherrypy.request.cookie.get('projectID').value

        # Getting project limits from Nova
        try:
            projectLimits = novaClient.limits.get().absolute
        except ClientException as e:
            cherrypy.log('- Error during API call of quota values: ' + str(e),
                         username)
            raise cherrypy.HTTPError(
                '500 OpenStack cannot get the quota values.')

        # Converting Nova limits to a dictionary
        l = list(projectLimits)
        limits = dict(map(lambda x: (x.name, x.value), l))

        try:
            quotaData = {
                'groupquotamem': limits['maxTotalRAMSize'] / 1024,
                'groupquotacpu': limits['maxTotalCores'],
                'groupquotavm': limits['maxTotalInstances'],
                'groupusedmem': limits['totalRAMUsed'] / 1024,
                'groupusedcpu': limits['totalCoresUsed'],
                'groupusedvm': limits['totalInstancesUsed'],
            }
        except KeyError:
            cherrypy.log('- KeyError getting quota values for project ID:',
                         projectID, username)
            raise cherrypy.HTTPError(
                '500 There has been an error getting quota data from OpenStack.'
            )

        quotaDataKeys = []
        # Available quota figures only used when there are limits on quotas
        if quotaData['groupquotamem'] > -1:
            quotaData['availablequotamem'] = quotaData[
                'groupquotamem'] - quotaData['groupusedmem']
        else:
            quotaDataKeys.append('biggestRAMAmount')
        if quotaData['groupquotacpu'] > -1:
            quotaData['availablequotacpu'] = quotaData[
                'groupquotacpu'] - quotaData['groupusedcpu']
        else:
            quotaDataKeys.append('biggestCPUAmount')
        if quotaData['groupquotavm'] > -1:
            quotaData['availablequotavm'] = quotaData[
                'groupquotavm'] - quotaData['groupusedvm']

        # Always appended as there's no disk quota - biggest disk size will always be required
        quotaDataKeys.append('biggestDiskAmount')

        ramList = []
        cpuList = []
        diskList = []
        # Searching each flavor to put each attribute into an indivdual list
        # Biggest value found a few lines below - this is used for sliders when creating a VM
        for flavor in novaClient.flavors.list():
            if quotaData['groupquotamem'] == -1:
                ramList.append(flavor.ram)
            if quotaData['groupquotacpu'] == -1:
                cpuList.append(flavor.vcpus)
            diskList.append(flavor.disk)

        biggestAmountList = []
        # Puts each list into biggestAmountList to find max. value of each inner list
        self.listLengthCheck(ramList, biggestAmountList)
        self.listLengthCheck(cpuList, biggestAmountList)
        self.listLengthCheck(diskList, biggestAmountList)

        if len(quotaDataKeys) > 0:
            for i in range(0, len(quotaDataKeys)):
                try:
                    quotaData[quotaDataKeys[i]] = max(biggestAmountList[i])
                except AttributeError:
                    cherrypy.log(
                        '- Error when finding max. values of a resource.',
                        username)
                    raise cherrypy.HTTPError(
                        '500 There\'s been an error when manipulating quota data.'
                    )
        return quotaData
Beispiel #18
0
Datei: vm.py Projekt: stfc/cloud
    def GET(self, action):
        novaClient = getNovaInstance()
        glanceClient = getGlanceInstance()
        username = cherrypy.request.cookie.get('fedid').value

        instanceList = []
        flavorList = {}
        imageList = {}

        # Flavor List
        for flavor in novaClient.flavors.list(detailed = True):
            flavorList[flavor.id] = {'name':str(flavor.name), 'vcpus':flavor.vcpus, 'ram':flavor.ram}

        # Image List
        for image in glanceClient.images.list(detailed = True):
            try:
                 imageList[image.id] = {
                     'name' : str(image.name),
                     'aq'   : image.metadata[u'aq_managed']
                 }
            except:
                 imageList[image.id] = {
                     'name': str(image.name),
                     'aq'  : u'false'
                 }

        for server in novaClient.servers.list(detailed = True):
            cherrypy.log('- %s - %s'%(server.name, server.status), username)

            serverStatus = server.status

            # Converts date/time into format for .js file
            stime = datetime.strptime(server.created, '%Y-%m-%dT%H:%M:%SZ')
            stime = mktime(stime.timetuple())


            # Flavor
            flavorName = ""
            flavorCPU = ""
            flavorMemory = ""
            try:
                flavorName = flavorList[server.flavor['id']]['name']
                flavorCPU = flavorList[server.flavor['id']]['vcpus']
                flavorMemory = flavorList[server.flavor['id']]['ram']
            except Exception as ex:
                cherrypy.log('- Non-Fatal Exception when getting flavor info for VM: %s' %(server.name), username, traceback=True)

            # Image Name
            imageName = ""
            try:
                imageName = imageList[server.image['id']]['name']
            except Exception as ex:
                imageName = ''
                cherrypy.log('- Non-Fatal Exception when getting image name for VM: %s' %(server.name), username, traceback=True)

            # Hostname/IP
            hostname = ""
            try:
                serverIP = str(server.networks)
                if serverIP != "{}":
                    serverNetwork = self.getServerNetworkLabel(serverIP)
                    hostname = server.networks[serverNetwork][0]
            except (ClientException, KeyError) as ex:
                cherrypy.log('- Non-Fatal Exception when getting hostname/ip for VM: %s' %(server.name), username, traceback=True)

            # Aquilon Metadata
            aq_branch = ""
            aq_archetype = ""
            aq_personality = ""
            try:
                if (imageList[server.image['id']]['aq'] != u'false'):
                    aq_missing = '<i style="opacity:.65" title="Aquilon profile/metadata may be missing or restricted">Missing '

                    try:
                        # Get aquilon profile
                        profile_url = cherrypy.request.config.get('aqProfiles')
                        url = profile_url + server.metadata[u'HOSTNAMES'] + '.json'
                        response = urllib.urlopen(url)
                        profile = json.loads(response.read())

                        # Domain/Sandbox
                        try:
                            profile_author = ""
                            if (profile['metadata']['template']['branch']['type'] == "sandbox"):
                                profle_author = profile['metadata']['template']['branch']['author'] + '/'

                            profile_branch = profile['metadata']['template']['branch']['name']
                            aq_branch = profile_author + profile_branch

                        except Exception as ex:
                            cherrypy.log('- Non-Fatal Exception when getting aquilon domain/sandbox for VM: %s' %(server.name), username, traceback=True)
                            aq_branch = aq_missing + "Domain/Sandbox</i>"


                        # Archetype
                        try:
                            aq_archetype = profile['system']['archetype']['name']
                        except:
                            cherrypy.log('- Non-Fatal Exception when getting aquilon archetype for VM: %s' %(server.name), username, traceback=True)
                            aq_archetype = aq_missing + "Archetype</i>"


                        # Personality
                        try:
                            aq_personality = profile['system']['personality']['name']
                        except:
                            cherrypy.log('- Non-Fatal Exception when getting aquilon personality for VM: %s' %(server.name), username, traceback=True)
                            aq_personality = aq_missing + "Personality</i>"


                    except Exception as ex:
                        cherrypy.log('- Non-Fatal Exception when getting aquilon profile for VM: %s' %(server.name), username, traceback=True)
                        aq_branch = aq_missing + "Profile</i>"
                        aq_archetype = aq_missing + "Profile</i>"
                        aq_personality = aq_missing + "Profile</i>"

            except Exception as ex:
                cherrypy.log('- Non-Fatal Exception when getting aquilon metadata for VM: %s' %(server.name), username, traceback=True)

            # Put VM data into json format for .js file
            instanceList.append({
                'id'          : server.id,
                'name'        : server.name,
                'hostname'    : hostname,
                'user'        : "",
                'group'       : "",
                'state'       : serverStatus,
                'stime'       : stime,
                'etime'       : "",
                'flavor'      : flavorName,
                'cpu'         : flavorCPU,
                'memory'      : flavorMemory,
                'type'        : imageName,
                'candelete'   : True,
                'keypair'     : server.key_name,
                'branch'      : aq_branch,
                'archetype'   : aq_archetype,
                'personality' : aq_personality,
            })
            cherrypy.log('- %s - Loaded' %(server.name), username)
        cherrypy.log(str(instanceList))
        return {"data":instanceList}