Example #1
0
def main(j, args, params, tags, tasklet):
    params.result = page = args.page

    gid = int(args.getTag("gid"))
    scl = j.clients.osis.getNamespace("system")
    settings = ""
    grid_settings = scl.grid.searchOne({"id": gid}).get("settings", {})
    if grid_settings:
        settings = yaml.safe_dump(grid_settings, default_flow_style=False)

    popup = Popup(
        id="settings",
        header="Change grid settings",
        submit_url="/restmachine/cloudbroker/grid/changeSettings",
    )
    popup.addTextArea(
        "Change the data to update grid settings",
        "settings",
        required=True,
        value=settings,
        rows=10,
    )
    popup.addHiddenField("id", gid)
    popup.write_html(page)
    return params
Example #2
0
def main(j, args, params, tags, tasklet):
    params.result = page = args.page
    gid = int(args.getTag("gid"))
    actors = j.apps.cloudbroker.iaas.cb.actors.cloudapi

    images = actors.images.list(accountId=None, cloudspaceId=None)
    dropimages = list()

    def imageSorter(image):
        return image["type"] + image["name"]

    for image in sorted(images, key=imageSorter):
        dropimages.append(("%(type)s: %(name)s" % image, image["id"]))

    popup = Popup(
        id="createsystemspace",
        header="Create system space on the grid",
        submit_url="/restmachine/cloudbroker/grid/createSystemSpace",
    )
    popup.addText("Resource Name", "name", required=True)
    popup.addDropdown("Choose Image", "imageId", dropimages)
    popup.addNumber("Boot Disk Size in GiB", "bootsize")
    popup.addNumber("Choose data Disk Size in GiB", "dataDiskSize")
    popup.addNumber("Number of VCPUS", "vcpus")
    popup.addNumber("Amount of memory in MiB", "memory")
    popup.addTextArea("User data for cloud-init",
                      "userdata",
                      required=False,
                      rows=5)
    popup.addHiddenField("id", gid)
    popup.write_html(page)

    return params
Example #3
0
def main(j, args, params, tags, tasklet):
    params.result = page = args.page
    gid = args.getTag("gid")
    options = OrderedDict(
        {
            "CPU Nodes": "cpunode",
            "Storage Nodes": "storagenode",
            "CPU and Storage Nodes": "both",
        }
    )

    popup = Popup(
        id="execute_script",
        header="Execute Script",
        submit_url="/restmachine/cloudbroker/grid/executeMaintenanceScript",
    )
    popup.addDropdown(
        "Select which type of nodes you want to execute this one",
        "nodestype",
        options.iteritems(),
    )
    popup.addTextArea("Script", "script", placeholder="Enter script here", rows=10)
    popup.addHiddenField("gid", gid)
    popup.write_html(page)
    params.result = page
    return params
Example #4
0
def main(j, args, params, tags, tasklet):
    params.result = page = args.page
    gid = int(args.getTag('gid'))
    actors = j.apps.cloudbroker.iaas.cb.actors.cloudapi

    images = actors.images.list(accountId=None, cloudspaceId=None)
    dropimages = list()

    def imageSorter(image):
        return image['type'] + image['name']

    for image in sorted(images, key=imageSorter):
        dropimages.append(("%(type)s: %(name)s" % image, image['id']))

    popup = Popup(id='createsystemspace', header='Create system space on the grid',
                  submit_url='/restmachine/cloudbroker/grid/createSystemSpace')
    popup.addText('Resource Name', 'name', required=True)
    popup.addDropdown('Choose Image', 'imageId', dropimages)
    popup.addNumber('Boot Disk Size in GiB', 'bootsize')
    popup.addNumber('Choose data Disk Size in GiB', 'dataDiskSize')
    popup.addNumber('Number of VCPUS', 'vcpus')
    popup.addNumber('Amount of memory in MiB', 'memory')
    popup.addTextArea('User data for cloud-init', 'userdata', required=False, rows=5)
    popup.addHiddenField('id', gid)
    popup.write_html(page)

    return params
Example #5
0
def main(j, args, params, tags, tasklet):
    params.result = page = args.page

    gid = int(args.getTag('gid'))
    scl = j.clients.osis.getNamespace('system')
    settings = ''
    grid_settings = scl.grid.searchOne({'id': gid}).get('settings', {})
    if grid_settings:
       settings = yaml.safe_dump(grid_settings, default_flow_style=False)

    popup = Popup(id='settings', header='Change grid settings',
                  submit_url='/restmachine/cloudbroker/grid/changeSettings')
    popup.addTextArea('Change the data to update grid settings', 'settings', required=True, value=settings, rows=10)
    popup.addHiddenField('id', gid)
    popup.write_html(page)
    return params
Example #6
0
def main(j, args, params, tags, tasklet):
    params.result = page = args.page
    cloudspaceId = int(args.getTag("cloudspaceId"))
    scl = j.clients.osis.getNamespace("cloudbroker")
    actors = j.apps.cloudbroker.iaas.cb.actors.cloudapi

    cloudspace = scl.cloudspace.get(cloudspaceId)
    stacks = scl.stack.search({"gid": cloudspace.gid, "status": "ENABLED"})[1:]

    images = actors.images.list(
        accountId=cloudspace.accountId, cloudspaceId=cloudspace.id
    )
    dropimages = list()
    dropstacks = list()
    dropstacks.append(("Auto", 0))

    def imageSorter(image):
        return image["type"] + image["name"]

    def sortName(item):
        return item["name"]

    for image in sorted(images, key=imageSorter):
        dropimages.append(("%(type)s: %(name)s" % image, image["id"]))

    for stack in sorted(stacks, key=sortName):
        dropstacks.append((stack["name"], stack["id"]))

    popup = Popup(
        id="createmachine",
        header="Create Machine On CPU Node",
        submit_url="/restmachine/cloudbroker/machine/createOnStack",
    )
    popup.addText("Machine Name", "name", required=True)
    popup.addText("Machine Description", "description", required=True)
    popup.addDropdown("Choose CPU Node", "stackid", dropstacks)
    popup.addDropdown("Choose Image", "imageId", dropimages)
    popup.addNumber("Disk Size in GiB", "disksize")
    popup.addNumber("Number of VCPUS", "vcpus")
    popup.addNumber("Amount of memory in MiB", "memory")
    popup.addTextArea("User data for cloud-init", "userdata", required=False, rows=5)
    popup.addHiddenField("cloudspaceId", cloudspaceId)
    popup.write_html(page)

    return params
Example #7
0
def main(j, args, params, tags, tasklet):
    params.result = page = args.page
    cloudspaceId = int(args.getTag('cloudspaceId'))
    scl = j.clients.osis.getNamespace('cloudbroker')
    actors = j.apps.cloudbroker.iaas.cb.actors.cloudapi

    cloudspace = scl.cloudspace.get(cloudspaceId)
    stacks = scl.stack.search({'gid': cloudspace.gid, 'status': 'ENABLED'})[1:]

    images = actors.images.list(accountId=cloudspace.accountId, cloudspaceId=cloudspace.id)
    dropimages = list()
    dropstacks = list()
    dropstacks.append(('Auto', 0))
    def imageSorter(image):
        return image['type'] + image['name']

    def sortName(item):
        return item['name']

    for image in sorted(images, key=imageSorter):
        dropimages.append(("%(type)s: %(name)s" % image, image['id']))

    for stack in sorted(stacks, key=sortName):
        dropstacks.append((stack['name'], stack['id']))

    popup = Popup(id='createmachine', header='Create Machine On CPU Node',
                  submit_url='/restmachine/cloudbroker/machine/createOnStack')
    popup.addText('Machine Name', 'name', required=True)
    popup.addText('Machine Description', 'description', required=True)
    popup.addDropdown('Choose CPU Node', 'stackid', dropstacks)
    popup.addDropdown('Choose Image', 'imageId', dropimages)
    popup.addNumber('Disk Size in GiB', 'disksize')
    popup.addNumber('Number of VCPUS', 'vcpus')
    popup.addNumber('Amount of memory in MiB', 'memory')
    popup.addTextArea('User data for cloud-init', 'userdata', required=False, rows=5)
    popup.addHiddenField('cloudspaceId', cloudspaceId)
    popup.write_html(page)

    return params
Example #8
0
def main(j, args, params, tags, tasklet):
    params.result = page = args.page
    gid = args.getTag('gid')
    options = OrderedDict({
        'CPU Nodes': 'cpunode',
        'Storage Nodes': 'storagenode',
        'CPU and Storage Nodes': 'both'
    })

    popup = Popup(
        id='execute_script',
        header='Execute Script',
        submit_url='/restmachine/cloudbroker/grid/executeMaintenanceScript')
    popup.addDropdown(
        'Select which type of nodes you want to execute this one', 'nodestype',
        options.iteritems())
    popup.addTextArea('Script',
                      'script',
                      placeholder='Enter script here',
                      rows=10)
    popup.addHiddenField('gid', gid)
    popup.write_html(page)
    params.result = page
    return params