Darko Draskovic 7383186143 Add libvirt funcs to revert to snapshot
Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>
2023-04-11 14:43:11 +02:00
2023-03-15 11:50:39 +01:00
2023-04-10 17:28:10 +02:00
2023-03-31 16:55:32 +02:00
2023-03-15 15:38:31 +01:00
2023-03-31 16:55:32 +02:00
2023-03-31 16:55:32 +02:00
2023-03-14 15:12:23 +01:00
2023-03-28 14:10:01 +02:00

Manager for Cocos AI

Setup

Create img directory in cmd/manager. Create iso directory in cmd/manager. Save alpine-standard-3.17.2-x86_64.iso in cmd/manager/iso directory.

Run

cd to cmd/manager and run

go run main.go

This will start an HTTP server on port 9021, a gRPC server on port 7001 and will establish a connection to libvirtd.

Domain

To create a libvirt domain - basically a QEMU instance or a virtual machine (VM) - run

curl -i -X POST -H "Content-Type: application/json" localhost:9021/domain -d '{"pool":"/home/darko/go/src/github.com/ultravioletrs/manager/cmd/manager/xml/pool.xml", "volume":"/home/darko/go/src/github.com/ultravioletrs/manager/cmd/manager/xml/vol.xml", "domain":"/home/darko/go/src/github.com/ultravioletrs/manager/cmd/manager/xml/dom.xml"}'

If you have already created a domain, you can remove it with

virsh undefine QEmu-alpine-standard-x86_64; \
virsh shutdown QEmu-alpine-standard-x86_64; \
virsh destroy QEmu-alpine-standard-x86_64; \
rm -rf ~/go/src/github.com/ultravioletrs/manager/cmd/manager/img/boot.img; \
virsh pool-destroy --pool virtimages

This will destroy the domain together with volumes and a pool where the volume was logically stored.

Computation

To run a computation, run

curl -X POST \
  http://localhost:9021/run \
  -H 'Content-Type: application/json' \
  -d '{
        "name": "my-run",
        "description": "this is a test run",
        "owner": "John Doe",
        "datasets": ["dataset1", "dataset2"],
        "algorithms": ["algorithm1", "algorithm2"],
        "dataset_providers": ["provider1", "provider2"],
        "algorithm_providers": ["provider3", "provider4"],
        "result_consumers": ["consumer1", "consumer2"],
        "ttl": 3600
    }'

Agent

sudo apt install guestfish

QCOW2_PATH=~/go/src/github.com/ultravioletrs/manager/cmd/manager/img/boot.img
HOST_AGENT_PATH=~/Development/go-playground/hello_world/main
GUEST_AGENT_PATH=/root/agent
sudo virt-copy-in -a $QCOW2_PATH $HOST_AGENT_PATH $GUEST_AGENT_PATH
S
Description
Cocos AI - Confidential Computing System for AI
Readme 14 MiB
Languages
Go 95.4%
Shell 2.2%
Makefile 1.7%
Python 0.4%
Rust 0.3%