Exemplo n.º 1
0
def attach(request, volume_id):    
    instances = api.server_list(request)
    attach_form, handled = AttachForm.maybe_handle(request, 
                                      initial={'volume_id': volume_id,
                                               'instances': instances})

    if handled:
        return handled

    return shortcuts.render(request,
                            'nova/volumes/attach.html', {
                                'attach_form': attach_form,
                                'volume_id': volume_id})
Exemplo n.º 2
0
def attach(request, volume_id):
    insts = api.server_list(request)
    instances = [(inst.id, '%s (Instance %s)' % \
                    (inst.name, inst.id)) for inst in insts]
    instances.insert(0, ('', _("Select an instance")))

    attach_form, handled = AttachForm.maybe_handle(
            request, initial={'instance_list': instances})

    if handled:
        return handled

    return shortcuts.render(request,
                            'nova/volumes/attach.html', {
                                'attach_form': attach_form,
                                'volume_id': volume_id})
Exemplo n.º 3
0
def attach(request, volume_id):
    insts = api.server_list(request)
    instances = [(inst.id, '%s (Instance %s)' % \
                    (inst.name, inst.id)) for inst in insts]
    instances.insert(0, ('', _("Select an instance")))

    attach_form, handled = AttachForm.maybe_handle(
        request, initial={'instance_list': instances})

    if handled:
        return handled

    return shortcuts.render(request, 'nova/volumes/attach.html', {
        'attach_form': attach_form,
        'volume_id': volume_id
    })
Exemplo n.º 4
0
def attach(request, volume_id):

    def instances():
        insts = api.server_list(request)
        return [(inst.id, '%s (Instance %s)' % (inst.name, inst.id))
                for inst in insts]

    attach_form, handled = AttachForm.maybe_handle(
            request, initial={'instance_list': instances()})

    if handled:
        return handled

    return shortcuts.render(request,
                            'nova/volumes/attach.html', {
                                'attach_form': attach_form,
                                'create_form': create_form,
                                'volume_id': volume_id})