Ejemplo n.º 1
0
async def put_api_networks(
        current_user: CurrentUser = Depends(get_current_user),
        db: Session = Depends(get_db)):
    post_task = PostTask(db=db, user=current_user, model=None)
    task_model = post_task.commit("network", "list", "update")

    return task_model
Ejemplo n.º 2
0
async def put_api_images(current_user: CurrentUser = Depends(get_current_user),
                         db: Session = Depends(get_db)):
    # タスクを追加
    post_task = PostTask(db=db, user=current_user, model=None)
    task_model = post_task.commit("storage", "list", "update")

    return task_model
Ejemplo n.º 3
0
def patch_api_node_role(bg: BackgroundTasks,
                        current_user: CurrentUser = Depends(get_current_user),
                        db: Session = Depends(get_db),
                        model: NodeRolePatch = None):
    post_task = PostTask(db=db, user=current_user, model=model)
    task_model = post_task.commit("node", "role", "change", bg=bg)

    return task_model
Ejemplo n.º 4
0
async def post_api_nodes(current_user: CurrentUser = Depends(get_current_user),
                         db: Session = Depends(get_db),
                         request_model: NodeInsert = None):
    # タスクを追加
    post_task = PostTask(db=db, user=current_user, model=request_model)
    task_model = post_task.commit("node", "base", "add")

    return task_model
Ejemplo n.º 5
0
def delete_api_domains(bg: BackgroundTasks,
                       current_user: CurrentUser = Depends(get_current_user),
                       db: Session = Depends(get_db),
                       request_model: DomainDelete = None):
    # タスクを追加
    post_task = PostTask(db=db, user=current_user, model=request_model)
    task_model = post_task.commit("vm", "base", "delete", bg)

    return task_model
Ejemplo n.º 6
0
def publish_task_to_update_vm_list(
    bg: BackgroundTasks,
    current_user: CurrentUser = Depends(get_current_user),
    db: Session = Depends(get_db)):

    # タスクを追加
    post_task = PostTask(db=db, user=current_user, model=None)
    task_model = post_task.commit("vm", "list", "update", bg)
    return task_model
Ejemplo n.º 7
0
def patch_api_vm_network(bg: BackgroundTasks,
                         current_user: CurrentUser = Depends(get_current_user),
                         db: Session = Depends(get_db),
                         request_model: DomainNetworkChange = None):
    # タスクを追加
    post_task = PostTask(db=db, user=current_user, model=request_model)
    task_model = post_task.commit("vm", "network", "change", bg)

    return task_model
Ejemplo n.º 8
0
def post_api_storage(bg: BackgroundTasks,
                     current_user: CurrentUser = Depends(get_current_user),
                     db: Session = Depends(get_db),
                     request_model: NetworkDelete = None):
    # タスクを追加
    post_task = PostTask(db=db, user=current_user, model=request_model)
    task_model = post_task.commit("network", "base", "delete", bg)

    return task_model
Ejemplo n.º 9
0
async def delete_api_storages(
        current_user: CurrentUser = Depends(get_current_user),
        db: Session = Depends(get_db),
        request_model: StorageDelete = None):
    # タスクを追加
    post_task = PostTask(db=db, user=current_user, model=request_model)
    task_model = post_task.commit("storage", "base", "delete")

    return task_model
Ejemplo n.º 10
0
async def patch_api_domains(
        current_user: CurrentUser = Depends(get_current_user),
        db: Session = Depends(get_db),
        request_model: DomainPatch = None
    ):
    # タスクを追加
    post_task = PostTask(db=db, user=current_user, model=request_model)
    task_model = post_task.commit("vm","base","change")
   
    return task_model
Ejemplo n.º 11
0
def post_api_networks_uuid_ovs(
        bg: BackgroundTasks,
        request_model: NetworkOVSDelete,
        db: Session = Depends(get_db),
        current_user: CurrentUser = Depends(get_current_user),
):
    # タスクを追加
    post_task = PostTask(db=db, user=current_user, model=request_model)
    task_model = post_task.commit("network",
                                  "ovs",
                                  "delete",
                                  bg=bg,
                                  status="wait")

    return task_model
Ejemplo n.º 12
0
def post_api_vms(bg: BackgroundTasks,
                 current_user: CurrentUser = Depends(get_current_user),
                 db: Session = Depends(get_db),
                 request_model: DomainInsert = None):
    # タスクを追加
    post_task = PostTask(db=db, user=current_user, model=request_model)
    task_model = post_task.commit("vm", "base", "add", bg)

    # ストレージ更新タスク
    post_task = PostTask(db=db, user=current_user, model=None)
    task_model = post_task.commit("storage",
                                  "list",
                                  "update",
                                  bg,
                                  status="wait",
                                  dependence_uuid=task_model.uuid)

    return task_model
Ejemplo n.º 13
0
def post_api_networks_uuid_ovs(
        bg: BackgroundTasks,
        current_user: CurrentUser = Depends(get_current_user),
        db: Session = Depends(get_db),
        request_model: NetworkOVSAdd = None,
):
    # タスクを追加
    post_task = PostTask(db=db, user=current_user, model=request_model)
    task_model = post_task.commit("network", "ovs", "add", bg)

    post_task = PostTask(db=db, user=current_user, model=None)
    task_model = post_task.commit("network",
                                  "list",
                                  "update",
                                  bg=bg,
                                  status="wait",
                                  dependence_uuid=task_model.uuid)

    return task_model
Ejemplo n.º 14
0
def post_api_nodes(bg: BackgroundTasks,
                   current_user: CurrentUser = Depends(get_current_user),
                   db: Session = Depends(get_db),
                   request_model: NodeInsert = None):
    # ノード追加タスク
    node_post_task = PostTask(db=db, user=current_user, model=request_model)
    node_post_model = node_post_task.commit("node", "base", "add", bg)

    if request_model.libvirt_role:
        libvirt_role = NodeRolePatch(node_name=request_model.name,
                                     role_name="libvirt")
        libvirt_task = PostTask(db=db, user=current_user, model=libvirt_role)
        libvirt_model = libvirt_task.commit(
            "node",
            "role",
            "change",
            bg=bg,
            status="wait",
            dependence_uuid=node_post_model.uuid)

        # ドメインリスト更新タスク
        post_task = PostTask(db=db, user=current_user, model=None)
        task_model = post_task.commit("vm",
                                      "list",
                                      "update",
                                      bg,
                                      status="wait",
                                      dependence_uuid=libvirt_model.uuid)

        # ネットワーク更新タスク
        post_task = PostTask(db=db, user=current_user, model=None)
        task_model = post_task.commit("network",
                                      "list",
                                      "update",
                                      bg,
                                      status="wait",
                                      dependence_uuid=libvirt_model.uuid)

        # ストレージ更新タスク
        post_task = PostTask(db=db, user=current_user, model=None)
        task_model = post_task.commit("storage",
                                      "list",
                                      "update",
                                      bg,
                                      status="wait",
                                      dependence_uuid=libvirt_model.uuid)

    return node_post_model