예제 #1
0
def set_firewall_profile(vm, profile, nic):
    log.info("Setting VM %s, NIC %s, firewall %s", vm, nic, profile)

    if profile not in [x[0] for x in NetworkInterface.FIREWALL_PROFILES]:
        raise faults.BadRequest("Unsupported firewall profile")
    backend.set_firewall_profile(vm, profile=profile, nic=nic)
    return None
예제 #2
0
def set_firewall_profile(vm, profile, nic):
    log.info("Setting VM %s, NIC %s, firewall %s", vm, nic, profile)

    if profile not in [x[0] for x in NetworkInterface.FIREWALL_PROFILES]:
        raise faults.BadRequest("Unsupported firewall profile")
    backend.set_firewall_profile(vm, profile=profile, nic=nic)
    return None
예제 #3
0
파일: servers.py 프로젝트: grnet/synnefo
def set_firewall_profile(server_id, profile, nic_id, credentials=None,
                         atomic_context=None):
    with commands.ServerCommand("SET_FIREWALL_PROFILE", server_id,
                                credentials, atomic_context) as vm:
        nic = util.get_vm_nic(vm, nic_id)
        log.info("Setting VM %s, NIC %s, firewall %s", vm, nic, profile)

        if profile not in [x[0] for x in NetworkInterface.FIREWALL_PROFILES]:
            raise faults.BadRequest("Unsupported firewall profile")
        backend.set_firewall_profile(vm, profile=profile, nic=nic)
        return vm
예제 #4
0
파일: servers.py 프로젝트: vgerak/synnefo
def set_firewall_profile(server_id,
                         profile,
                         nic_id,
                         credentials=None,
                         atomic_context=None):
    with commands.ServerCommand("SET_FIREWALL_PROFILE", server_id, credentials,
                                atomic_context) as vm:
        nic = util.get_vm_nic(vm, nic_id)
        log.info("Setting VM %s, NIC %s, firewall %s", vm, nic, profile)

        if profile not in [x[0] for x in NetworkInterface.FIREWALL_PROFILES]:
            raise faults.BadRequest("Unsupported firewall profile")
        backend.set_firewall_profile(vm, profile=profile, nic=nic)
        return vm
예제 #5
0
def set_firewall_profile(request, vm, args):
    # Normal Response Code: 200
    # Error Response Codes: computeFault (400, 500),
    #                       serviceUnavailable (503),
    #                       unauthorized (401),
    #                       badRequest (400),
    #                       badMediaType(415),
    #                       itemNotFound (404),
    #                       buildInProgress (409),
    #                       overLimit (413)

    profile = args.get('profile', '')
    log.info("Set VM %s firewall %s", vm, profile)
    if profile not in [x[0] for x in NetworkInterface.FIREWALL_PROFILES]:
        raise faults.BadRequest("Unsupported firewall profile")
    backend.set_firewall_profile(vm, profile)
    return HttpResponse(status=202)
예제 #6
0
def set_firewall_profile(request, vm, args):
    # Normal Response Code: 200
    # Error Response Codes: computeFault (400, 500),
    #                       serviceUnavailable (503),
    #                       unauthorized (401),
    #                       badRequest (400),
    #                       badMediaType(415),
    #                       itemNotFound (404),
    #                       buildInProgress (409),
    #                       overLimit (413)

    profile = args.get('profile', '')
    log.info("Set VM %s firewall %s", vm, profile)
    if profile not in [x[0] for x in NetworkInterface.FIREWALL_PROFILES]:
        raise faults.BadRequest("Unsupported firewall profile")
    backend.set_firewall_profile(vm, profile)
    return HttpResponse(status=202)