-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
many features and improvements (#22)
* many features and improvements 1. support ceph rbd 2. support ovn 3. support cloud-init 4. merge eru agent 5. many other improvements and bugfix * fix lint and ut issues * fix review issues * don't return when check imageHub failed * remove fmt.Printf
- Loading branch information
Showing
412 changed files
with
57,890 additions
and
12,303 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,5 +3,6 @@ cscope.* | |
vendor/ | ||
dist/ | ||
yavirt | ||
|
||
.vscode | ||
.idea/ | ||
.vscode | ||
/tmp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,30 @@ | ||
FROM projecteru2/footstone:yavirt-prebuild-go1.20 AS BUILD | ||
FROM ubuntu:jammy AS BUILD | ||
|
||
# make binary | ||
# RUN git clone https://github.com/projecteru2/yavirt.git /go/src/github.com/projecteru2/yavirt | ||
COPY . /go/src/github.com/projecteru2/yavirt | ||
WORKDIR /go/src/github.com/projecteru2/yavirt | ||
ARG KEEP_SYMBOL | ||
RUN make deps && make && ./bin/yavirtd --version | ||
RUN sed -i 's@//.*archive.ubuntu.com@//mirrors.ustc.edu.cn@g' /etc/apt/sources.list | ||
RUN apt update | ||
RUN apt install -y golang-1.20 build-essential libvirt-dev make genisoimage libguestfs-dev libcephfs-dev librbd-dev librados-dev | ||
RUN apt install -y git | ||
# RUN snap install go --classic | ||
ENV PATH="$PATH:/usr/lib/go-1.20/bin/" | ||
|
||
FROM alpine:latest | ||
RUN go version | ||
RUN make deps CN=1 | ||
RUN make && ./bin/yavirtd --version | ||
|
||
FROM ubuntu:jammy | ||
|
||
RUN mkdir /etc/yavirt/ && \ | ||
sed -i 's@//.*archive.ubuntu.com@//mirrors.ustc.edu.cn@g' /etc/apt/sources.list && \ | ||
apt update && \ | ||
apt install -y libvirt-dev libguestfs-dev genisoimage libcephfs-dev librbd-dev librados-dev | ||
|
||
RUN mkdir /etc/yavirt/ | ||
LABEL ERU=1 | ||
COPY --from=BUILD /go/src/github.com/projecteru2/yavirt/bin/yavirtd /usr/bin/yavirtd | ||
COPY --from=BUILD /go/src/github.com/projecteru2/yavirt/bin/yavirtctl /usr/bin/yavirtctl | ||
COPY --from=BUILD /go/src/github.com/projecteru2/yavirt/internal/virt/template/disk.xml /etc/yavirt/disk.xml | ||
COPY --from=BUILD /go/src/github.com/projecteru2/yavirt/internal/virt/template/guest.xml /etc/yavirt/guest.xml | ||
COPY --from=BUILD /go/src/github.com/projecteru2/yavirt/internal/virt/domain/templates/disk.xml /etc/yavirt/disk.xml | ||
COPY --from=BUILD /go/src/github.com/projecteru2/yavirt/internal/virt/domain/templates/guest.xml /etc/yavirt/guest.xml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,20 @@ | ||
ifeq ($(CN), 1) | ||
ENV := GOPROXY=https://goproxy.cn,direct | ||
endif | ||
|
||
NS := github.com/projecteru2/yavirt | ||
BUILD := go build -race | ||
TEST := go test -count=1 -race -cover | ||
TEST := go test -count=1 -race -cover -gcflags=all=-l | ||
|
||
LDFLAGS += -X "$(NS)/internal/ver.Git=$(shell git rev-parse HEAD)" | ||
LDFLAGS += -X "$(NS)/internal/ver.Compile=$(shell go version)" | ||
LDFLAGS += -X "$(NS)/internal/ver.Date=$(shell date +'%F %T %z')" | ||
REVISION := $(shell git rev-parse HEAD || unknown) | ||
BUILTAT := $(shell date +%Y-%m-%dT%H:%M:%S) | ||
VERSION := $(shell git describe --tags $(shell git rev-list --tags --max-count=1)) | ||
|
||
PKGS := $$(go list ./... | grep -v -P '$(NS)/third_party|vendor/') | ||
LDFLAGS += -X "$(NS)/internal/ver.REVISION=$(REVISION)" | ||
LDFLAGS += -X "$(NS)/internal/ver.BUILTAT=$(BUILTAT)" | ||
LDFLAGS += -X "$(NS)/internal/ver.VERSION=$(VERSION)" | ||
|
||
PKGS := $$(go list ./... | grep -v -P '$(NS)/third_party|vendor/|mocks|ovn') | ||
|
||
.PHONY: all test build setup | ||
|
||
|
@@ -20,12 +28,15 @@ build-srv: | |
build-ctl: | ||
$(BUILD) -ldflags '$(LDFLAGS)' -o bin/yavirtctl cmd/cmd.go | ||
|
||
setup: | ||
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest | ||
go install github.com/vektra/mockery/v2@latest | ||
setup: setup-lint | ||
$(ENV) go install github.com/vektra/mockery/v2@latest | ||
|
||
setup-lint: | ||
$(ENV) go install github.com/golangci/golangci-lint/cmd/[email protected] | ||
|
||
lint: format | ||
golangci-lint run --skip-dirs-use-default --skip-dirs=thirdparty | ||
golangci-lint --version | ||
golangci-lint run | ||
|
||
format: vet | ||
gofmt -s -w $$(find . -iname '*.go' | grep -v -P '\./third_party|\./vendor/') | ||
|
@@ -34,7 +45,8 @@ vet: | |
go vet $(PKGS) | ||
|
||
deps: | ||
go mod tidy | ||
$(ENV) go mod tidy | ||
$(ENV) go mod vendor | ||
|
||
mock: deps | ||
mockery --dir pkg/libvirt --output pkg/libvirt/mocks --all | ||
|
@@ -43,10 +55,12 @@ mock: deps | |
mockery --dir pkg/utils --output pkg/utils/mocks --name Locker | ||
mockery --dir internal/virt/agent --output internal/virt/agent/mocks --all | ||
mockery --dir internal/virt/domain --output internal/virt/domain/mocks --name Domain | ||
mockery --dir internal/virt/guest/manager --output internal/virt/guest/manager/mocks --name Manageable | ||
mockery --dir internal/virt/guest --output internal/virt/guest/mocks --name Bot | ||
mockery --dir internal/virt/guestfs --output internal/virt/guestfs/mocks --name Guestfs | ||
mockery --dir internal/virt/volume --output internal/virt/volume/mocks --name Bot | ||
mockery --dir internal/volume --output internal/volume/mocks --name Volume | ||
mockery --dir internal/volume/base --output internal/volume/base/mocks --name SnapshotAPI | ||
mockery --dir internal/eru/store --output internal/eru/store/mocks --name Store | ||
mockery --dir internal/service --output internal/service/mocks --name Service | ||
|
||
clean: | ||
rm -fr bin/* | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.