mirror of
https://hubproxy.babadafafafafa.cn/https://github.com/yunionio/cloudpods.git
synced 2026-09-20 16:13:56 +08:00
Compare commits
435 Commits
v3.10.7
...
release/3.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
334fee5006 | ||
|
|
960528ae22 | ||
|
|
c9494e0aaf | ||
|
|
0e78b8a53d | ||
|
|
7de2696457 | ||
|
|
86d4079205 | ||
|
|
e65439b5a0 | ||
|
|
2ea865df3d | ||
|
|
cd3d699c46 | ||
|
|
5ff875cfa5 | ||
|
|
ffd35fb870 | ||
|
|
c934445ac8 | ||
|
|
ecaedce272 | ||
|
|
c4ac131176 | ||
|
|
5ecdd7e404 | ||
|
|
b0ad2ddd19 | ||
|
|
636e287145 | ||
|
|
c7e032e96f | ||
|
|
3db68b9c5c | ||
|
|
cb7ee805c8 | ||
|
|
56ecdaf1d2 | ||
|
|
3955a6ca98 | ||
|
|
9fc987e7ac | ||
|
|
454d18be9b | ||
|
|
af6f84c887 | ||
|
|
3299b8d758 | ||
|
|
7f72f23fab | ||
|
|
5d342b8a9c | ||
|
|
4b7bd6a6aa | ||
|
|
2b7f5fcb77 | ||
|
|
9ed8ac48b9 | ||
|
|
929fbdd897 | ||
|
|
09bb2ba976 | ||
|
|
a9df7ce31f | ||
|
|
c3183c4401 | ||
|
|
711786736f | ||
|
|
3e5e510605 | ||
|
|
d1a50169b7 | ||
|
|
c151761076 | ||
|
|
a7c05d1a14 | ||
|
|
11e479757d | ||
|
|
485d636c1d | ||
|
|
4dba5726b6 | ||
|
|
9d58922492 | ||
|
|
5067703dd3 | ||
|
|
94fbb84cd6 | ||
|
|
f5f857e1f4 | ||
|
|
3bf0765018 | ||
|
|
32c8b2b03e | ||
|
|
87c66d2a68 | ||
|
|
75e57a903a | ||
|
|
99a0bcff31 | ||
|
|
b0d387e685 | ||
|
|
5ac581e750 | ||
|
|
cde63b6b0d | ||
|
|
47ad66df21 | ||
|
|
e1779242b5 | ||
|
|
f9d304a639 | ||
|
|
d61e94e5f0 | ||
|
|
e6fdd807c9 | ||
|
|
426c4882b0 | ||
|
|
718e036aba | ||
|
|
941bec7c39 | ||
|
|
b658742969 | ||
|
|
1d248b054c | ||
|
|
458ce7e4e0 | ||
|
|
790caabb8b | ||
|
|
b7b874a747 | ||
|
|
957d69b1e2 | ||
|
|
be5a09a67b | ||
|
|
05645aaadc | ||
|
|
4a9a768360 | ||
|
|
8319a8f402 | ||
|
|
d839581c8d | ||
|
|
35d11d2f8b | ||
|
|
f6ccb188e7 | ||
|
|
383c1c71fc | ||
|
|
c7b709ce82 | ||
|
|
d28ec77c04 | ||
|
|
7860619585 | ||
|
|
a89a474bed | ||
|
|
0e0f31d55a | ||
|
|
bfe7b47317 | ||
|
|
5dda4971be | ||
|
|
c586ce431b | ||
|
|
6c9a728e6b | ||
|
|
b1298e1175 | ||
|
|
074cd00323 | ||
|
|
e91c7d3b74 | ||
|
|
a733ef75ca | ||
|
|
acd4e95ff1 | ||
|
|
a046a3b12d | ||
|
|
a00e268b6b | ||
|
|
59502b785c | ||
|
|
0f16659b23 | ||
|
|
83e8bb7344 | ||
|
|
726251391e | ||
|
|
098a26160b | ||
|
|
b73b93c2b4 | ||
|
|
9e05db4846 | ||
|
|
73111caf58 | ||
|
|
329390f07a | ||
|
|
cf21ef26e0 | ||
|
|
a0b56c038a | ||
|
|
7a34293068 | ||
|
|
0d2e7c3157 | ||
|
|
0c632a36fd | ||
|
|
0acb44d73b | ||
|
|
b61df821fa | ||
|
|
a8e18cec36 | ||
|
|
8e2ea908c5 | ||
|
|
fbaa21c67c | ||
|
|
6b4a524704 | ||
|
|
98e3d7fde9 | ||
|
|
469736380c | ||
|
|
78123575cc | ||
|
|
7da17468e1 | ||
|
|
7d55ca585a | ||
|
|
7a1b98b6f1 | ||
|
|
911317dd01 | ||
|
|
d0a800208a | ||
|
|
7e4b352fb8 | ||
|
|
6b9ef0c926 | ||
|
|
8646181751 | ||
|
|
b195999e17 | ||
|
|
69efb3a7b2 | ||
|
|
ca7149dd7f | ||
|
|
e9871f4e9d | ||
|
|
4f55172d6a | ||
|
|
065138b504 | ||
|
|
a84da849a6 | ||
|
|
ed67fcc159 | ||
|
|
c8c5bf9e84 | ||
|
|
2dfc84fbdf | ||
|
|
97ecac0230 | ||
|
|
baef6e919c | ||
|
|
65e12adada | ||
|
|
a5e4e5aa65 | ||
|
|
5c3d901547 | ||
|
|
73f86fc44a | ||
|
|
e18ee04afb | ||
|
|
8c61d0090b | ||
|
|
27943ed5e5 | ||
|
|
6259f71228 | ||
|
|
3188808dec | ||
|
|
9f74455d88 | ||
|
|
3a05432746 | ||
|
|
b9c26518a5 | ||
|
|
08cad45aea | ||
|
|
467c755036 | ||
|
|
0d0680b0ea | ||
|
|
c893c71e8a | ||
|
|
d4016f744f | ||
|
|
c19d970b33 | ||
|
|
61637e7000 | ||
|
|
8af82884bc | ||
|
|
b2cfdd4166 | ||
|
|
0f6b24a88b | ||
|
|
e4df4f2605 | ||
|
|
27d7b39f8a | ||
|
|
6a887329a1 | ||
|
|
4dfcc5f7ac | ||
|
|
edb7dc288f | ||
|
|
6a9a551169 | ||
|
|
4762650665 | ||
|
|
1d4e6511eb | ||
|
|
fe50664353 | ||
|
|
0fe7bbec46 | ||
|
|
ec863b29aa | ||
|
|
e920b6bcdf | ||
|
|
52aac7072f | ||
|
|
9727232aab | ||
|
|
906635d954 | ||
|
|
12c3369a56 | ||
|
|
d7bd82d534 | ||
|
|
fedc88762b | ||
|
|
d493013428 | ||
|
|
f960354c76 | ||
|
|
aee1d8be2a | ||
|
|
9fa7b7ffd2 | ||
|
|
37eb481e3e | ||
|
|
6402b79c65 | ||
|
|
a43fe54154 | ||
|
|
0a11bdf8fb | ||
|
|
96526ad6a0 | ||
|
|
9220554156 | ||
|
|
bb071ea46d | ||
|
|
48506a293b | ||
|
|
f1a163702d | ||
|
|
5044c06e59 | ||
|
|
7ca2f7b3ce | ||
|
|
78c7cb32ad | ||
|
|
876eda36ea | ||
|
|
01bd3b3c56 | ||
|
|
5772b2a3fa | ||
|
|
94fd886cda | ||
|
|
3a5b215731 | ||
|
|
36f873ef4b | ||
|
|
78daf104b0 | ||
|
|
ee02051ce0 | ||
|
|
66bd2a10f9 | ||
|
|
f8df78755c | ||
|
|
1b237ce01c | ||
|
|
5d010d9097 | ||
|
|
5c3b8805f1 | ||
|
|
4fab709e03 | ||
|
|
0fb3bcccf4 | ||
|
|
df3be7a101 | ||
|
|
96d67a6833 | ||
|
|
154433943c | ||
|
|
a4567fb721 | ||
|
|
8436e27831 | ||
|
|
24c2c0846e | ||
|
|
771304a2f4 | ||
|
|
5969e2b20c | ||
|
|
c9ce8f9930 | ||
|
|
f0e3fcf3a2 | ||
|
|
6e93cf13fe | ||
|
|
509f838827 | ||
|
|
a81f05cedc | ||
|
|
bf22a4fa22 | ||
|
|
a2cd574870 | ||
|
|
61103acb4a | ||
|
|
76a5e1c6da | ||
|
|
229544d14e | ||
|
|
dabb647d94 | ||
|
|
1fbadd5bcb | ||
|
|
0633063fc0 | ||
|
|
b1fe1f6ff0 | ||
|
|
20937a79e3 | ||
|
|
15d8af61d6 | ||
|
|
06f54776de | ||
|
|
7c1eee7f9f | ||
|
|
9bdc4617e5 | ||
|
|
4fcdf8476f | ||
|
|
2a04dea345 | ||
|
|
c06c3b4a1b | ||
|
|
40e44b1828 | ||
|
|
74eba501d4 | ||
|
|
abc4558b24 | ||
|
|
cf5208c9c5 | ||
|
|
1e88f4cd24 | ||
|
|
8f1f82e05c | ||
|
|
0051cc6aae | ||
|
|
bb25345eaf | ||
|
|
309af994d8 | ||
|
|
220a908707 | ||
|
|
26dbb92fda | ||
|
|
112f4ebfc3 | ||
|
|
0bb4fb9944 | ||
|
|
e9a29645eb | ||
|
|
3253857e94 | ||
|
|
0ba359589a | ||
|
|
051025e944 | ||
|
|
8462776b4d | ||
|
|
c0efb08381 | ||
|
|
79a5e8063c | ||
|
|
90265c3191 | ||
|
|
95d93f80de | ||
|
|
8e836e5baf | ||
|
|
319ac1b782 | ||
|
|
fa1c6de647 | ||
|
|
fe7412761a | ||
|
|
5d895393d2 | ||
|
|
e0d967b85d | ||
|
|
a75e24d2f2 | ||
|
|
9fcde5f2cc | ||
|
|
2c0e7fd689 | ||
|
|
e15d5332ba | ||
|
|
d2b21b9374 | ||
|
|
5f4e8d2d3d | ||
|
|
f1448fda84 | ||
|
|
f9631dceba | ||
|
|
c8f025f9c1 | ||
|
|
6da2cbcb2b | ||
|
|
2615b0282a | ||
|
|
de266f79b9 | ||
|
|
8f3eb73ffd | ||
|
|
3accf7f3ae | ||
|
|
95f577c4c1 | ||
|
|
dc916a3282 | ||
|
|
fbb82f84c7 | ||
|
|
877bd56198 | ||
|
|
648c5eb21c | ||
|
|
b155224e3a | ||
|
|
6f0372f8e8 | ||
|
|
331b87df8b | ||
|
|
0b496af99b | ||
|
|
61d5207105 | ||
|
|
7c9a8e80a7 | ||
|
|
f4a0da91a6 | ||
|
|
24d75f3736 | ||
|
|
873518d98a | ||
|
|
323a9890f8 | ||
|
|
c1202e6b4c | ||
|
|
86209f23a1 | ||
|
|
4a68beb063 | ||
|
|
e03f259dd6 | ||
|
|
5649535c8d | ||
|
|
ca75c9804a | ||
|
|
3c63350d7c | ||
|
|
15816b90f5 | ||
|
|
93372985e3 | ||
|
|
7467605d48 | ||
|
|
de0061a848 | ||
|
|
de0230dc1d | ||
|
|
e9d111f073 | ||
|
|
f6c23817a6 | ||
|
|
8e6d5a16e3 | ||
|
|
5babce8322 | ||
|
|
0e43e81dfc | ||
|
|
08e594819d | ||
|
|
948dd7f779 | ||
|
|
f7ea547bc7 | ||
|
|
a780425627 | ||
|
|
5a20a7baa8 | ||
|
|
5339c8363b | ||
|
|
6a34dd7216 | ||
|
|
3b0324bc1f | ||
|
|
0202907b2e | ||
|
|
13152e9595 | ||
|
|
c800e3ed13 | ||
|
|
06bcfe340f | ||
|
|
4efa4a6724 | ||
|
|
703ddee2ed | ||
|
|
cefd594d5f | ||
|
|
33ec145d2a | ||
|
|
bef55edf9e | ||
|
|
e8879cc7f6 | ||
|
|
9ee9bb5274 | ||
|
|
fff4824984 | ||
|
|
60d6f3da06 | ||
|
|
8784bebbde | ||
|
|
d177d68359 | ||
|
|
2a64576b87 | ||
|
|
97826501d5 | ||
|
|
ce403d1503 | ||
|
|
43cfc6e87a | ||
|
|
7f856291c9 | ||
|
|
6a3fc188b5 | ||
|
|
90f73232f6 | ||
|
|
d0fe863aae | ||
|
|
177148af92 | ||
|
|
0e81616ba3 | ||
|
|
3c8f464e55 | ||
|
|
ab9a6e523e | ||
|
|
439a2dc978 | ||
|
|
9374824060 | ||
|
|
1365fc6011 | ||
|
|
00004fb627 | ||
|
|
fe35f15395 | ||
|
|
0cd4376ef4 | ||
|
|
575bdd4b34 | ||
|
|
dbe610dd99 | ||
|
|
987a7fb476 | ||
|
|
eff7457860 | ||
|
|
35462d4b15 | ||
|
|
6309663621 | ||
|
|
a210ed0d26 | ||
|
|
a4379cc29c | ||
|
|
ea9ce74767 | ||
|
|
91ca77a8a1 | ||
|
|
336b8548ab | ||
|
|
8200da5b2d | ||
|
|
0b6805d68e | ||
|
|
f3894e3bf8 | ||
|
|
83034ad10c | ||
|
|
faef1cd360 | ||
|
|
09d0edc0b1 | ||
|
|
99dbaddb28 | ||
|
|
567d1653d0 | ||
|
|
48d62f88d3 | ||
|
|
7969a10eaa | ||
|
|
a5fbdde0d6 | ||
|
|
5ce9b93ceb | ||
|
|
4ea36162fe | ||
|
|
b67d8fa8f3 | ||
|
|
f796b9567a | ||
|
|
03344ff697 | ||
|
|
6da80c333e | ||
|
|
dca1c97972 | ||
|
|
47c94d2e21 | ||
|
|
2eff999f16 | ||
|
|
103f1cde8d | ||
|
|
58ac69e8ab | ||
|
|
71755ff812 | ||
|
|
9839864808 | ||
|
|
f8082b2f5b | ||
|
|
4a15393d39 | ||
|
|
5a26d1bb70 | ||
|
|
d1333c61b6 | ||
|
|
014af79b79 | ||
|
|
a79cfcf9f9 | ||
|
|
60c960ed16 | ||
|
|
3c32a19364 | ||
|
|
892e5daf3b | ||
|
|
1dca2ff06d | ||
|
|
fc3403c82f | ||
|
|
46223df7f0 | ||
|
|
ed3d4a13dc | ||
|
|
cd3d7aa248 | ||
|
|
a6ce80f4ae | ||
|
|
756a30dc6e | ||
|
|
281716df7a | ||
|
|
e4a9734643 | ||
|
|
9e9c9dd2a2 | ||
|
|
bce2d0a81f | ||
|
|
1f9e8729ec | ||
|
|
c909d86eab | ||
|
|
6b60b28fa6 | ||
|
|
9d150a81b9 | ||
|
|
b06051d6ca | ||
|
|
abeffed6f1 | ||
|
|
ea9daa7246 | ||
|
|
b58bc3e8cd | ||
|
|
0082c1d6f2 | ||
|
|
0242872a28 | ||
|
|
01aef4908b | ||
|
|
eb4f7988f1 | ||
|
|
d862223feb | ||
|
|
8b89af2645 | ||
|
|
88e13652e7 | ||
|
|
081401967a | ||
|
|
7efd8804c4 | ||
|
|
e873c9c110 | ||
|
|
2d5d96f035 | ||
|
|
450e73b3cf | ||
|
|
6d926f2f28 | ||
|
|
d6bd2a60a9 | ||
|
|
518bd88463 | ||
|
|
0a6796c325 | ||
|
|
fcc80ec7b6 | ||
|
|
c5225d2faa | ||
|
|
b9cec7e12b | ||
|
|
cfe9a91d83 |
38
.github/workflows/ci-pr-build-test.yml
vendored
Normal file
38
.github/workflows/ci-pr-build-test.yml
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
name: Building and test for PR
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types: [opened, synchronize, reopened]
|
||||
|
||||
jobs:
|
||||
build_and_test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@v4
|
||||
with:
|
||||
go-version: '1.18'
|
||||
|
||||
- name: Install check tools
|
||||
shell: bash
|
||||
run: |
|
||||
set -o xtrace
|
||||
git clone --branch yun --depth 4 https://github.com/yousong/tools && cd tools
|
||||
go build ./cmd/goimports && sudo cp goimports /usr/bin/ && cd .. && rm -rf tools
|
||||
git clone --depth 4 https://github.com/yousong/y18n && cd y18n
|
||||
go build . && sudo cp y18n /usr/bin && cd .. && rm -rf y18n
|
||||
|
||||
|
||||
- name: Test and build
|
||||
shell: bash
|
||||
run: |
|
||||
set -o xtrace
|
||||
export GO111MODULE=on
|
||||
make -j3 check
|
||||
make test
|
||||
targets="$(find cmd -mindepth 1 -maxdepth 1 -type d | grep -v cmd/host-image)"
|
||||
echo $targets | tr ' ' '\n'
|
||||
make $targets
|
||||
ls -lh _output/bin
|
||||
6
Makefile
6
Makefile
@@ -287,7 +287,9 @@ GOPROXY ?= direct
|
||||
|
||||
mod:
|
||||
GOPROXY=$(GOPROXY) GONOSUMDB=yunion.io/x go get -d yunion.io/x/cloudmux@$(RELEASE_BRANCH)
|
||||
GOPROXY=$(GOPROXY) GONOSUMDB=yunion.io/x go get -d $(patsubst %,%@master,$(shell GO111MODULE=on go mod edit -print | sed -n -e 's|.*\(yunion.io/x/[a-z].*\) v.*|\1|p' | grep -v '/cloudmux$$'))
|
||||
GOPROXY=$(GOPROXY) GONOSUMDB=yunion.io/x go get -d yunion.io/x/sqlchemy@v1.1.2
|
||||
GOPROXY=$(GOPROXY) GONOSUMDB=yunion.io/x go get -d yunion.io/x/pkg@v1.10.1
|
||||
GOPROXY=$(GOPROXY) GONOSUMDB=yunion.io/x go get -d $(patsubst %,%@master,$(shell GO111MODULE=on go mod edit -print | sed -n -e 's|.*\(yunion.io/x/[a-z].*\) v.*|\1|p' | egrep -v '/cloudmux$$|/sqlchemy$$|/pkg$$'))
|
||||
GOPROXY=$(GOPROXY) GONOSUMDB=yunion.io/x go mod tidy
|
||||
GOPROXY=$(GOPROXY) GONOSUMDB=yunion.io/x go mod vendor -v
|
||||
|
||||
@@ -349,7 +351,7 @@ image:
|
||||
.PHONY: image
|
||||
|
||||
image-telegraf-raid-plugin:
|
||||
VERSION=release-1.6.4 ARCH=all make image telegraf-raid-plugin
|
||||
VERSION=release-1.6.5 ARCH=all make image telegraf-raid-plugin
|
||||
|
||||
%:
|
||||
@:
|
||||
|
||||
@@ -1,8 +1,13 @@
|
||||
export PATH=/opt/yunion/bin:$PATH
|
||||
|
||||
if [ -f /etc/profile.d/bash_completion.sh ]; then
|
||||
source /etc/profile.d/bash_completion.sh
|
||||
fi
|
||||
|
||||
test -f /etc/yunion/rcadmin && source /etc/yunion/rcadmin
|
||||
|
||||
source <(climc --completion bash)
|
||||
source <(kubectl completion bash)
|
||||
|
||||
echo "Welcome to Cloud Shell :-) You may execute climc and other command tools in this shell."
|
||||
echo "Please exec 'climc' to get started"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
FROM registry.cn-beijing.aliyuncs.com/yunionio/ansibleserver-base:v1.1.1
|
||||
|
||||
# install playbook and telegraf install pkg
|
||||
COPY --from=registry.cn-beijing.aliyuncs.com/yunionio/file-repo:v0.4.0 /opt/yunion/playbook /opt/yunion/playbook
|
||||
COPY --from=registry.cn-beijing.aliyuncs.com/yunionio/file-repo:v0.4.0 /opt/yunion/ansible-install-pkg /opt/yunion/ansible-install-pkg
|
||||
COPY --from=registry.cn-beijing.aliyuncs.com/yunionio/file-repo:v0.5.2 /opt/yunion/playbook /opt/yunion/playbook
|
||||
COPY --from=registry.cn-beijing.aliyuncs.com/yunionio/file-repo:v0.5.2 /opt/yunion/ansible-install-pkg /opt/yunion/ansible-install-pkg
|
||||
|
||||
ADD ./_output/alpine-build/bin/ansibleserver /opt/yunion/bin/ansibleserver
|
||||
|
||||
@@ -9,12 +9,20 @@ RUN sed -i 's!https://dl-cdn.alpinelinux.org/!https://mirrors.ustc.edu.cn/!g' /e
|
||||
# openssh-client, for ansible ssh connection
|
||||
# git, ca-certificates, for fetching ansible roles
|
||||
RUN set -x \
|
||||
&& apk update \
|
||||
&& apk add openssh-client \
|
||||
&& apk add sshpass \
|
||||
&& apk add ansible \
|
||||
&& apk add py3-pip \
|
||||
&& apk add tzdata git ca-certificates \
|
||||
&& rm -rf /var/cache/apk/*
|
||||
&& apk update \
|
||||
&& apk add openssh-client \
|
||||
&& apk add sshpass \
|
||||
&& apk add py3-pip \
|
||||
&& apk add tzdata git ca-certificates
|
||||
|
||||
RUN pip3 install pywinrm
|
||||
RUN apk add --no-cache openssh openssl curl rsync pv mariadb-client
|
||||
RUN apk add --no-cache --virtual .build-dependencies \
|
||||
libffi-dev openssl-dev python3-dev build-base py-setuptools rust cargo mariadb-dev
|
||||
|
||||
# ansible should be installed
|
||||
# after setuptools and wheel
|
||||
RUN pip3 install -U pip setuptools wheel \
|
||||
&& pip3 install paramiko mysqlclient pywinrm \
|
||||
&& pip3 install 'ansible<=9.0.0' \
|
||||
&& apk del --no-network .build-dependencies \
|
||||
&& rm -rf /root/.cache /root/.cargo /var/cache/apk/*
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
FROM registry.cn-beijing.aliyuncs.com/yunionio/baremetal-base:v0.3.9-20230812.0
|
||||
FROM registry.cn-beijing.aliyuncs.com/yunionio/baremetal-base:v0.3.9-20231219.0
|
||||
|
||||
MAINTAINER "Zexi Li <lizexi@yunionyun.com>"
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#FROM --platform=linux/amd64 registry.cn-beijing.aliyuncs.com/yunionio/centos-build:1.1-4 as build
|
||||
#RUN yum install -y https://iso.yunion.cn/vm-images/baremetal-pxerom-1.1.0-21092209.x86_64.rpm
|
||||
#RUN yum install -y http://192.168.23.50:8083/baremetal-pxerom-1.1.0-21092209.x86_64.rpm
|
||||
FROM registry.cn-beijing.aliyuncs.com/yunionio/yunionos:v0.1.8-20230812.0 as yunionos
|
||||
FROM registry.cn-beijing.aliyuncs.com/yunionio/yunionos:v3.10.8-20231215.0 as yunionos
|
||||
|
||||
FROM centos:8 as grub-stage
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
FROM registry.cn-beijing.aliyuncs.com/yunionio/file-repo:v0.4.0 as file-repo
|
||||
|
||||
FROM registry.cn-beijing.aliyuncs.com/yunionio/onecloud-base:v0.2
|
||||
|
||||
MAINTAINER "Rain Zheng <zhengyu@yunion.com>"
|
||||
@@ -11,12 +13,13 @@ RUN set -x \
|
||||
|
||||
# install default playbook and install pkg
|
||||
Run mkdir -p /opt/yunion/ansible-install-pkg
|
||||
Run wget https://yunioniso.oss-cn-beijing.aliyuncs.com/rpms/telegraf/telegraf-1.19.2-yn~be742cbf-0.x86_64.rpm -P /opt/yunion/ansible-install-pkg
|
||||
Run wget https://yunioniso.oss-cn-beijing.aliyuncs.com/rpms/telegraf/telegraf-1.19.2-yn~be742cbf-0.aarch64.rpm -P /opt/yunion/ansible-install-pkg
|
||||
Run wget https://yunioniso.oss-cn-beijing.aliyuncs.com/rpms/telegraf/telegraf_1.19.2-yn~be742cbf-0_arm64.deb -P /opt/yunion/ansible-install-pkg
|
||||
Run wget https://yunioniso.oss-cn-beijing.aliyuncs.com/rpms/telegraf/telegraf_1.19.2-yn~be742cbf-0_amd64.deb -P /opt/yunion/ansible-install-pkg
|
||||
Run wget https://yunioniso.oss-cn-beijing.aliyuncs.com/rpms/telegraf/telegraf-1.19.2-yn~be742cbf_windows_amd64.zip -P /opt/yunion/ansible-install-pkg
|
||||
Run wget https://yunioniso.oss-cn-beijing.aliyuncs.com/rpms/telegraf/telegraf-1.19.2-yn~be742cbf_windows_i386.zip -P /opt/yunion/ansible-install-pkg
|
||||
|
||||
COPY --from=file-repo /opt/yunion/ansible-install-pkg/telegraf-1.19.2-yn~be742cbf-0.x86_64.rpm /opt/yunion/ansible-install-pkg
|
||||
COPY --from=file-repo /opt/yunion/ansible-install-pkg/telegraf-1.19.2-yn~be742cbf-0.aarch64.rpm /opt/yunion/ansible-install-pkg
|
||||
COPY --from=file-repo /opt/yunion/ansible-install-pkg/telegraf_1.19.2-yn~be742cbf-0_arm64.deb /opt/yunion/ansible-install-pkg
|
||||
COPY --from=file-repo /opt/yunion/ansible-install-pkg/telegraf_1.19.2-yn~be742cbf-0_amd64.deb /opt/yunion/ansible-install-pkg
|
||||
COPY --from=file-repo /opt/yunion/ansible-install-pkg/telegraf-1.19.2-yn~be742cbf_windows_amd64.zip /opt/yunion/ansible-install-pkg
|
||||
COPY --from=file-repo /opt/yunion/ansible-install-pkg/telegraf-1.19.2-yn~be742cbf_windows_i386.zip /opt/yunion/ansible-install-pkg
|
||||
|
||||
Run mkdir -p /opt/yunion/playbook
|
||||
Run mkdir /opt/yunion/playbook/monitor-agent
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
FROM registry.cn-beijing.aliyuncs.com/yunionio/host-deployer-base:1.4.2
|
||||
FROM registry.cn-beijing.aliyuncs.com/yunionio/host-deployer-base:1.4.4
|
||||
|
||||
MAINTAINER "Yaoqi Wan wanyaoqi@yunionyun.com"
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ onecloud-base:
|
||||
onecloud-base-3-15-4:
|
||||
$(DOCKER_BUILDX)/onecloud-base:$(ONECLOUD_BASE_VERSION_3-15-4) -f ./Dockerfile.onecloud-base-3-15-4 .
|
||||
|
||||
ANSIBLESERVER_BASE = v1.1.1
|
||||
ANSIBLESERVER_BASE = v1.1.2
|
||||
|
||||
ansibleserver-base:
|
||||
$(DOCKER_BUILDX)/ansibleserver-base:$(ANSIBLESERVER_BASE) -f ./Dockerfile.ansibleserver-base .
|
||||
@@ -30,7 +30,7 @@ WEBCONSOLE_BASE_VERSION = 20230731.2
|
||||
webconsole-base:
|
||||
$(DOCKER_BUILDX)/webconsole-base:$(WEBCONSOLE_BASE_VERSION) -f ./Dockerfile.webconsole-base .
|
||||
|
||||
BAREMETAL_BASE_VERSION = v0.3.9-20230812.0
|
||||
BAREMETAL_BASE_VERSION = v0.3.9-20231219.1
|
||||
|
||||
baremetal-base:
|
||||
$(DOCKER_BUILDX)/baremetal-base:$(BAREMETAL_BASE_VERSION) -f ./Dockerfile.baremetal-base .
|
||||
@@ -44,7 +44,7 @@ GLANCE_BASE_VERSION = v0.0.1
|
||||
glance-base:
|
||||
$(DOCKER_BUILDX)/glance-base:$(GLANCE_BASE_VERSION) -f ./Dockerfile.glance-base .
|
||||
|
||||
FILE_REPO_VERSION = v0.3.3
|
||||
FILE_REPO_VERSION = v0.5.2
|
||||
|
||||
file-repo:
|
||||
$(DOCKER_BUILDX)/file-repo:$(FILE_REPO_VERSION) -f ./Dockerfile.file-repo .
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
触发时间: {{.start_time}}
|
||||
报警级别: {{.level}}
|
||||
触发条件: {{.description | unescaped}}
|
||||
资源数量:{{len .matches}}
|
||||
报警数量:{{len .matches}}
|
||||
资源名称:{{.resource_name}}
|
||||
|
||||
详情地址: {{.web_url}}
|
||||
@@ -108,6 +108,7 @@
|
||||
<td>名称</td>
|
||||
<td>IP</td>
|
||||
<td>平台</td>
|
||||
<td>指标</td>
|
||||
<td>触发值</td>
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -124,7 +125,8 @@
|
||||
<td>
|
||||
{{ index .tags "brand" }}
|
||||
</td>
|
||||
<td>{{$Matche.value_str}}</td>
|
||||
<td>{{ $Matche.metric }}</td>
|
||||
<td>{{ $Matche.value_str }}</td>
|
||||
</tr>
|
||||
{{end}}
|
||||
</tbody>
|
||||
|
||||
@@ -3,7 +3,7 @@ AlertName: {{.name}}
|
||||
Time: {{.start_time}}
|
||||
Level: {{.level}}
|
||||
TriggerCondition: {{.description | unescaped}}
|
||||
ResourceCount: {{len .matches}}
|
||||
AlertCount: {{len .matches}}
|
||||
ResourceName: {{.resource_name}}
|
||||
|
||||
WebUrl: {{.web_url}}
|
||||
|
||||
@@ -108,6 +108,7 @@
|
||||
<td>Name</td>
|
||||
<td>IP</td>
|
||||
<td>Brand</td>
|
||||
<td>Metric</td>
|
||||
<td>Trigger value</td>
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -124,7 +125,8 @@
|
||||
<td>
|
||||
{{ index .tags "brand" }}
|
||||
</td>
|
||||
<td>{{$Matche.value_str}}</td>
|
||||
<td>{{ $Matche.metric }}</td>
|
||||
<td>{{ $Matche.value_str }}</td>
|
||||
</tr>
|
||||
{{end}}
|
||||
</tbody>
|
||||
|
||||
@@ -49,4 +49,10 @@ func init() {
|
||||
ibCmd.Create(&compute.InstanceBackupManagerCreateFromPackageOptions{})
|
||||
ibCmd.Perform("syncstatus", &compute.DiskBackupSyncstatusOptions{})
|
||||
ibCmd.Perform("set-class-metadata", &options.ResourceMetadataOptions{})
|
||||
|
||||
hbsCmd := shell.NewJointCmd(&modules.HostBackupstorages)
|
||||
hbsCmd.List(&compute.HostBackupStorageListOptions{})
|
||||
hbsCmd.Show(&compute.HostBackupStorageJoinOptions{})
|
||||
hbsCmd.Attach(&compute.HostBackupStorageJoinOptions{})
|
||||
hbsCmd.Detach(&compute.HostBackupStorageJoinOptions{})
|
||||
}
|
||||
|
||||
50
cmd/climc/shell/compute/baremetal_profiles.go
Normal file
50
cmd/climc/shell/compute/baremetal_profiles.go
Normal file
@@ -0,0 +1,50 @@
|
||||
// Copyright 2019 Yunion
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package compute
|
||||
|
||||
import (
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/pkg/errors"
|
||||
"yunion.io/x/pkg/util/printutils"
|
||||
|
||||
"yunion.io/x/onecloud/cmd/climc/shell"
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
baremetalmodules "yunion.io/x/onecloud/pkg/mcclient/modules/compute/baremetal"
|
||||
baremetaloptions "yunion.io/x/onecloud/pkg/mcclient/options/compute/baremetal"
|
||||
)
|
||||
|
||||
func init() {
|
||||
cmd := shell.NewResourceCmd(&baremetalmodules.BaremetalProfiles)
|
||||
cmd.List(new(baremetaloptions.BaremetalProfileListOptions))
|
||||
cmd.Show(new(baremetaloptions.BaremetalProfileIdOptions))
|
||||
cmd.Delete(new(baremetaloptions.BaremetalProfileIdOptions))
|
||||
|
||||
type BaremetalProfileMatchOpts struct {
|
||||
OEMNAME string
|
||||
MODEL string
|
||||
}
|
||||
R(&BaremetalProfileMatchOpts{}, "baremetal-profile-match", "find match baremetal profile by oemname and model", func(s *mcclient.ClientSession, args *BaremetalProfileMatchOpts) error {
|
||||
specs, err := baremetalmodules.BaremetalProfiles.GetMatchProfiles(s, args.OEMNAME, args.MODEL)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "GetMatchProfiles")
|
||||
}
|
||||
listResults := printutils.ListResult{}
|
||||
for _, spec := range specs {
|
||||
listResults.Data = append(listResults.Data, jsonutils.Marshal(spec))
|
||||
}
|
||||
printList(&listResults, nil)
|
||||
return nil
|
||||
})
|
||||
}
|
||||
@@ -174,6 +174,7 @@ func init() {
|
||||
AutoSnapshot string `help:"enable/disable auto snapshot of disk" choices:"enable|disable"`
|
||||
DiskType string `help:"Disk type" choices:"data|volume"`
|
||||
IsSsd *bool `help:"mark disk as ssd" negative:"no-is-ssd"`
|
||||
AutoReset *bool `help:"Enable auto reset disk after geust shutdown"`
|
||||
}
|
||||
R(&DiskUpdateOptions{}, "disk-update", "Update property of a virtual disk", func(s *mcclient.ClientSession, args *DiskUpdateOptions) error {
|
||||
params := jsonutils.NewDict()
|
||||
@@ -207,6 +208,10 @@ func init() {
|
||||
params.Add(jsonutils.JSONFalse, "is_ssd")
|
||||
}
|
||||
}
|
||||
if args.AutoReset != nil {
|
||||
params.Add(jsonutils.NewBool(*args.AutoReset), "auto_reset")
|
||||
}
|
||||
|
||||
if params.Size() == 0 {
|
||||
return InvalidUpdateError()
|
||||
}
|
||||
|
||||
@@ -54,6 +54,7 @@ func init() {
|
||||
cmd.Perform("probe-isolated-devices", &options.BaseIdOptions{})
|
||||
cmd.Perform("class-metadata", &options.ResourceMetadataOptions{})
|
||||
cmd.Perform("set-class-metadata", &options.ResourceMetadataOptions{})
|
||||
cmd.Perform("set-commit-bound", &compute.HostSetCommitBoundOptions{})
|
||||
|
||||
cmd.BatchPerform("enable", &options.BaseIdsOptions{})
|
||||
cmd.BatchPerform("disable", &options.BaseIdsOptions{})
|
||||
@@ -173,17 +174,16 @@ func init() {
|
||||
})
|
||||
|
||||
type HostUpdateOptions struct {
|
||||
ID string `help:"ID or Name of Host"`
|
||||
Name string `help:"New name of the host"`
|
||||
Desc string `help:"New Description of the host"`
|
||||
CpuCommitBound float64 `help:"CPU overcommit upper bound at this host"`
|
||||
MemoryCommitBound float64 `help:"Memory overcommit upper bound at this host"`
|
||||
MemoryReserved string `help:"Memory reserved"`
|
||||
CpuReserved int64 `help:"CPU reserved"`
|
||||
HostType string `help:"Change host type, CAUTION!!!!" choices:"hypervisor|kubelet|esxi|baremetal"`
|
||||
ID string `help:"ID or Name of Host"`
|
||||
Name string `help:"New name of the host"`
|
||||
Desc string `help:"New Description of the host"`
|
||||
MemoryReserved string `help:"Memory reserved"`
|
||||
CpuReserved int64 `help:"CPU reserved"`
|
||||
HostType string `help:"Change host type, CAUTION!!!!" choices:"hypervisor|kubelet|esxi|baremetal"`
|
||||
// AccessIp string `help:"Change access ip, CAUTION!!!!"`
|
||||
AccessMac string `help:"Change baremetal access MAC, CAUTION!!!!"`
|
||||
Uuid string `help:"Change baremetal UUID, CAUTION!!!!"`
|
||||
AccessMac string `help:"Change baremetal access MAC, CAUTION!!!!"`
|
||||
Uuid string `help:"Change baremetal UUID, CAUTION!!!!"`
|
||||
EnableNumaAllocate string `help:"Host enable numa allocate" choices:"True|False"`
|
||||
|
||||
IpmiUsername string `help:"IPMI user"`
|
||||
IpmiPassword string `help:"IPMI password"`
|
||||
@@ -201,12 +201,6 @@ func init() {
|
||||
if len(args.Desc) > 0 {
|
||||
params.Add(jsonutils.NewString(args.Desc), "description")
|
||||
}
|
||||
if args.CpuCommitBound > 0.0 {
|
||||
params.Add(jsonutils.NewFloat64(args.CpuCommitBound), "cpu_cmtbound")
|
||||
}
|
||||
if args.MemoryCommitBound > 0.0 {
|
||||
params.Add(jsonutils.NewFloat64(args.MemoryCommitBound), "mem_cmtbound")
|
||||
}
|
||||
if len(args.MemoryReserved) > 0 {
|
||||
params.Add(jsonutils.NewString(args.MemoryReserved), "mem_reserved")
|
||||
}
|
||||
@@ -234,6 +228,13 @@ func init() {
|
||||
if len(args.Sn) > 0 {
|
||||
params.Add(jsonutils.NewString(args.Sn), "sn")
|
||||
}
|
||||
if len(args.EnableNumaAllocate) > 0 {
|
||||
enableNumaAllocate := false
|
||||
if args.EnableNumaAllocate == "True" {
|
||||
enableNumaAllocate = true
|
||||
}
|
||||
params.Add(jsonutils.NewBool(enableNumaAllocate), "enable_numa_allocate")
|
||||
}
|
||||
if params.Size() == 0 {
|
||||
return fmt.Errorf("Not data to update")
|
||||
}
|
||||
@@ -593,7 +594,7 @@ func init() {
|
||||
i, e := modules.Hosts.PerformAction(s, args.ID, "login-info", nil)
|
||||
privateKey := ""
|
||||
if e != nil {
|
||||
if httputils.ErrorCode(e) == 404 || e.Error() == "ciphertext too short" {
|
||||
if httputils.ErrorCode(e) == 404 || strings.Contains(e.Error(), "ciphertext too short") {
|
||||
var err error
|
||||
privateKey, err = modules.Sshkeypairs.FetchPrivateKeyBySession(context.Background(), s)
|
||||
if err != nil {
|
||||
|
||||
@@ -59,6 +59,17 @@ func init() {
|
||||
printBatchResults(ret, modules.InstanceSnapshots.GetColumns(s))
|
||||
return nil
|
||||
})
|
||||
type InstanceSnapshotPurgeOptions struct {
|
||||
ID string `help:"Delete snapshot id"`
|
||||
}
|
||||
R(&InstanceSnapshotPurgeOptions{}, "instance-snapshot-purge", "Purge snapshots", func(s *mcclient.ClientSession, args *InstanceSnapshotPurgeOptions) error {
|
||||
result, err := modules.InstanceSnapshots.PerformAction(s, args.ID, "purge", nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(result)
|
||||
return nil
|
||||
})
|
||||
|
||||
type InstanceSnapshotShowOptions struct {
|
||||
ID string `help:"ID or Name of snapshot"`
|
||||
|
||||
@@ -15,8 +15,13 @@
|
||||
package compute
|
||||
|
||||
import (
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/pkg/util/printutils"
|
||||
|
||||
"yunion.io/x/onecloud/cmd/climc/shell"
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
modules "yunion.io/x/onecloud/pkg/mcclient/modules/compute"
|
||||
baseoptions "yunion.io/x/onecloud/pkg/mcclient/options"
|
||||
options "yunion.io/x/onecloud/pkg/mcclient/options/compute"
|
||||
)
|
||||
|
||||
@@ -26,4 +31,68 @@ func init() {
|
||||
cmd.Create(new(options.IsolatedDeviceModelCreateOptions))
|
||||
cmd.Update(new(options.IsolatedDeviceModelUpdateOptions))
|
||||
cmd.Delete(new(options.IsolatedDeviceIdsOptions))
|
||||
|
||||
type HostIsolatedDeviceModelListOptions struct {
|
||||
baseoptions.BaseListOptions
|
||||
Host string `help:"ID or Name of Host"`
|
||||
IsolatedDeviceModel string `help:"ID or Name of Isolated device model"`
|
||||
}
|
||||
R(&HostIsolatedDeviceModelListOptions{}, "host-isolated-device-model-list",
|
||||
"List host Isolated device model pairs", func(s *mcclient.ClientSession, args *HostIsolatedDeviceModelListOptions) error {
|
||||
var params *jsonutils.JSONDict
|
||||
{
|
||||
var err error
|
||||
params, err = args.BaseListOptions.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
}
|
||||
}
|
||||
var result *printutils.ListResult
|
||||
var err error
|
||||
if len(args.Host) > 0 {
|
||||
result, err = modules.HostIsolatedDeviceModels.ListDescendent(s, args.Host, params)
|
||||
} else if len(args.IsolatedDeviceModel) > 0 {
|
||||
result, err = modules.HostIsolatedDeviceModels.ListDescendent2(s, args.IsolatedDeviceModel, params)
|
||||
} else {
|
||||
result, err = modules.HostIsolatedDeviceModels.List(s, params)
|
||||
}
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printList(result, modules.HostIsolatedDeviceModels.GetColumns(s))
|
||||
return nil
|
||||
})
|
||||
|
||||
type HostIsolatedDeviceModelDetailOptions struct {
|
||||
HOST string `help:"ID or Name of Host"`
|
||||
IsolatedDeviceModel string `help:"ID or Name of Isolated device model"`
|
||||
}
|
||||
R(&HostIsolatedDeviceModelDetailOptions{}, "host-isolated-device-model-show", "Show host isolated-device-model details", func(s *mcclient.ClientSession, args *HostIsolatedDeviceModelDetailOptions) error {
|
||||
result, err := modules.HostIsolatedDeviceModels.Get(s, args.HOST, args.IsolatedDeviceModel, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(result)
|
||||
return nil
|
||||
})
|
||||
|
||||
R(&HostIsolatedDeviceModelDetailOptions{}, "host-isolated-device-model-detach", "Detach a isolated-device-model from a host", func(s *mcclient.ClientSession, args *HostIsolatedDeviceModelDetailOptions) error {
|
||||
result, err := modules.HostIsolatedDeviceModels.Detach(s, args.HOST, args.IsolatedDeviceModel, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(result)
|
||||
return nil
|
||||
})
|
||||
|
||||
R(&HostIsolatedDeviceModelDetailOptions{}, "host-isolated-device-model-attach", "Attach a isolated-device-model to a host", func(s *mcclient.ClientSession, args *HostIsolatedDeviceModelDetailOptions) error {
|
||||
params := jsonutils.NewDict()
|
||||
result, err := modules.HostIsolatedDeviceModels.Attach(s, args.HOST, args.IsolatedDeviceModel, params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(result)
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
@@ -43,6 +43,7 @@ func init() {
|
||||
cmd.Get("change-owner-candidate-domains", &compute_options.NetworkIdOptions{})
|
||||
cmd.Perform("set-class-metadata", &options.ResourceMetadataOptions{})
|
||||
cmd.Perform("switch-wire", &compute_options.NetworkSwitchWireOptions{})
|
||||
cmd.Get("available-addresses", &compute_options.NetworkIdOptions{})
|
||||
|
||||
type NetworkShareOptions struct {
|
||||
ID string `help:"ID or Name of the zone to show"`
|
||||
|
||||
@@ -122,7 +122,12 @@ func init() {
|
||||
cmd.Perform("reset-nic-traffic-limit", &options.ServerNicTrafficLimitOptions{})
|
||||
cmd.Perform("set-nic-traffic-limit", &options.ServerNicTrafficLimitOptions{})
|
||||
cmd.Perform("add-sub-ips", &options.ServerAddSubIpsOptions{})
|
||||
|
||||
cmd.BatchPerform("set-os-info", &options.ServerSetOSInfoOptions{})
|
||||
cmd.BatchPerform("start-rescue", &options.ServerStartOptions{})
|
||||
cmd.BatchPerform("stop-rescue", &options.ServerStartOptions{})
|
||||
cmd.BatchPerform("sync-os-info", &options.ServerIdsOptions{})
|
||||
cmd.BatchPerform("set-root-disk-matcher", &options.ServerSetRootDiskMatcher{})
|
||||
cmd.Perform("disable-auto-merge-snapshot", &options.ServerDisableAutoMergeSnapshot{})
|
||||
cmd.Get("vnc", new(options.ServerVncOptions))
|
||||
cmd.Get("desc", new(options.ServerIdOptions))
|
||||
cmd.Get("status", new(options.ServerIdOptions))
|
||||
|
||||
@@ -102,7 +102,7 @@ func init() {
|
||||
oldKeys = string(output)
|
||||
}
|
||||
pubKeys := &deployapi.SSHKeys{AdminPublicKey: pubKey}
|
||||
newKeys := fsdriver.MergeAuthorizedKeys(oldKeys, pubKeys)
|
||||
newKeys := fsdriver.MergeAuthorizedKeys(oldKeys, pubKeys, true)
|
||||
if output, err := procutils.NewCommand(
|
||||
"sh", "-c", fmt.Sprintf("echo '%s' > %s", newKeys, authFile)).Output(); err != nil {
|
||||
return errors.Wrapf(err, "write public keys: %s", output)
|
||||
|
||||
@@ -45,6 +45,7 @@ func init() {
|
||||
cmd.Perform("force-detach-host", &compute.StorageForceDetachHost{})
|
||||
cmd.Perform("public", &options.BasePublicOptions{})
|
||||
cmd.Perform("private", &options.BaseIdOptions{})
|
||||
cmd.Perform("set-commit-bound", &compute.StorageSetCommitBoundOptions{})
|
||||
|
||||
type StorageCephRunOptions struct {
|
||||
ID string `help:"ID or name of ceph storage"`
|
||||
@@ -58,9 +59,10 @@ func init() {
|
||||
info := struct {
|
||||
StorageType string `json:"storage_type"`
|
||||
StorageConf struct {
|
||||
Key string `json:"key"`
|
||||
MonHost string `json:"mon_host"`
|
||||
Pool string `json:"pool"`
|
||||
Key string `json:"key"`
|
||||
MonHost string `json:"mon_host"`
|
||||
Pool string `json:"pool"`
|
||||
EnableMessengerV2 bool `json:"enable_messenger_v2"`
|
||||
}
|
||||
}{}
|
||||
err = result.Unmarshal(&info)
|
||||
@@ -74,6 +76,7 @@ func init() {
|
||||
info.StorageConf.MonHost,
|
||||
info.StorageConf.Key,
|
||||
info.StorageConf.Pool,
|
||||
info.StorageConf.EnableMessengerV2,
|
||||
)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "cephutils.NewClient")
|
||||
|
||||
@@ -32,6 +32,11 @@ import (
|
||||
|
||||
func init() {
|
||||
handleResult := func(s *mcclient.ClientSession, opt o.WebConsoleOptions, obj jsonutils.JSONObject) error {
|
||||
if obj.Contains("access_url") {
|
||||
accessUrl, _ := obj.GetString("access_url")
|
||||
fmt.Println("AccessURL:", accessUrl)
|
||||
return nil
|
||||
}
|
||||
if opt.WebconsoleUrl == "" {
|
||||
resp, err := identity.ServicesV3.GetSpecific(s, "common", "config", nil)
|
||||
if err != nil {
|
||||
|
||||
@@ -229,7 +229,7 @@ type IPropertyOpt interface {
|
||||
Property() string
|
||||
}
|
||||
|
||||
func (cmd ResourceCmd) GetProperty(args IPropertyOpt) {
|
||||
func (cmd ResourceCmd) GetPropertyWithShowFunc(args IPropertyOpt, showFunc func(jsonutils.JSONObject) error) {
|
||||
man := cmd.manager
|
||||
callback := func(s *mcclient.ClientSession, args IPropertyOpt) error {
|
||||
params, err := args.Params()
|
||||
@@ -240,6 +240,17 @@ func (cmd ResourceCmd) GetProperty(args IPropertyOpt) {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = showFunc(ret)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
cmd.RunWithDesc(args.Property(), fmt.Sprintf("Get property of a %s", man.GetKeyword()), args, callback)
|
||||
}
|
||||
|
||||
func (cmd ResourceCmd) GetProperty(args IPropertyOpt) {
|
||||
cmd.GetPropertyWithShowFunc(args, func(ret jsonutils.JSONObject) error {
|
||||
if _, ok := ret.(*jsonutils.JSONArray); ok {
|
||||
data, _ := ret.GetArray()
|
||||
PrintList(&printutils.ListResult{
|
||||
@@ -249,8 +260,7 @@ func (cmd ResourceCmd) GetProperty(args IPropertyOpt) {
|
||||
PrintObject(ret)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
cmd.RunWithDesc(args.Property(), fmt.Sprintf("Get property of a %s", man.GetKeyword()), args, callback)
|
||||
})
|
||||
}
|
||||
|
||||
func (cmd ResourceCmd) Show(args IShowOpt) {
|
||||
@@ -657,15 +667,15 @@ func (cmd JointCmd) List(args IJointListOpt) {
|
||||
cmd.RunWithDesc("list", fmt.Sprintf("list %s %s pairs", man.MasterManager().KeyString(), man.SlaveManager().KeyString()), args, callback)
|
||||
}
|
||||
|
||||
type IJointShowOpt interface {
|
||||
type IJointOpt interface {
|
||||
IOpt
|
||||
GetMasterId() string
|
||||
GetSlaveId() string
|
||||
}
|
||||
|
||||
func (cmd JointCmd) Show(args IJointShowOpt) {
|
||||
func (cmd JointCmd) Show(args IJointOpt) {
|
||||
man := cmd.manager.(modulebase.JointManager)
|
||||
callback := func(s *mcclient.ClientSession, args IJointShowOpt) error {
|
||||
callback := func(s *mcclient.ClientSession, args IJointOpt) error {
|
||||
params, err := args.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -679,3 +689,54 @@ func (cmd JointCmd) Show(args IJointShowOpt) {
|
||||
}
|
||||
cmd.Run("show", args, callback)
|
||||
}
|
||||
|
||||
func (cmd JointCmd) Attach(args IJointOpt) {
|
||||
man := cmd.manager.(modulebase.JointManager)
|
||||
callback := func(s *mcclient.ClientSession, args IJointOpt) error {
|
||||
params, err := args.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
result, err := man.Attach(s, args.GetMasterId(), args.GetSlaveId(), params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
PrintObject(result)
|
||||
return nil
|
||||
}
|
||||
cmd.Run("attach", args, callback)
|
||||
}
|
||||
|
||||
func (cmd JointCmd) Detach(args IJointOpt) {
|
||||
man := cmd.manager.(modulebase.JointManager)
|
||||
callback := func(s *mcclient.ClientSession, args IJointOpt) error {
|
||||
params, err := args.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
result, err := man.Detach(s, args.GetMasterId(), args.GetSlaveId(), params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
PrintObject(result)
|
||||
return nil
|
||||
}
|
||||
cmd.Run("detach", args, callback)
|
||||
}
|
||||
|
||||
func (cmd JointCmd) Update(args IJointOpt) {
|
||||
man := cmd.manager.(modulebase.JointManager)
|
||||
callback := func(s *mcclient.ClientSession, args IJointOpt) error {
|
||||
params, err := args.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
result, err := man.Update(s, args.GetMasterId(), args.GetSlaveId(), nil, params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
PrintObject(result)
|
||||
return nil
|
||||
}
|
||||
cmd.Run("update", args, callback)
|
||||
}
|
||||
|
||||
@@ -19,12 +19,45 @@ import (
|
||||
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/pkg/errors"
|
||||
"yunion.io/x/pkg/utils"
|
||||
"yunion.io/x/pkg/util/sets"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules/yunionconf"
|
||||
)
|
||||
|
||||
type GlobalSettingsValue struct {
|
||||
SetupKeys []string `json:"setupKeys"`
|
||||
SetupKeysVersion string `json:"setupKeysVersion"`
|
||||
SetupOneStackInitialized bool `json:"setupOneStackInitialized"`
|
||||
ProductVersion string `json:"productVersion"`
|
||||
UserDefinedKeys map[string]bool `json:"userDefinedKeys"`
|
||||
}
|
||||
|
||||
func NewGlobalSettingsValue(setupKeys []string, setupOneStack bool) *GlobalSettingsValue {
|
||||
settings := &GlobalSettingsValue{
|
||||
SetupOneStackInitialized: setupOneStack,
|
||||
UserDefinedKeys: make(map[string]bool),
|
||||
}
|
||||
for _, key := range setupKeys {
|
||||
settings.Switch(key, true)
|
||||
}
|
||||
return settings
|
||||
}
|
||||
|
||||
func (g *GlobalSettingsValue) Switch(featureKey string, on bool) {
|
||||
if g.UserDefinedKeys == nil {
|
||||
g.UserDefinedKeys = map[string]bool{}
|
||||
}
|
||||
g.UserDefinedKeys[featureKey] = on
|
||||
ss := sets.NewString(g.SetupKeys...)
|
||||
if on {
|
||||
ss.Insert(featureKey)
|
||||
} else {
|
||||
ss.Delete(featureKey)
|
||||
}
|
||||
g.SetupKeys = ss.List()
|
||||
}
|
||||
|
||||
func init() {
|
||||
var features = []string{
|
||||
"onestack",
|
||||
@@ -93,10 +126,7 @@ func init() {
|
||||
input := map[string]interface{}{
|
||||
"name": GlobalSettings,
|
||||
"service_id": YunionAgent,
|
||||
"value": map[string]interface{}{
|
||||
"setupKeys": []string{name},
|
||||
"setupOneStackInitialized": true,
|
||||
},
|
||||
"value": NewGlobalSettingsValue([]string{name}, true),
|
||||
}
|
||||
params := jsonutils.Marshal(input)
|
||||
if _, err := yunionconf.Parameters.Create(s, params); err != nil {
|
||||
@@ -118,33 +148,20 @@ func init() {
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "get value")
|
||||
}
|
||||
setupKeys := []string{}
|
||||
if value.Contains("setupKeys") {
|
||||
if err := value.Unmarshal(&setupKeys, "setupKeys"); err != nil {
|
||||
return errors.Wrap(err, "unmarshal setupKeys")
|
||||
}
|
||||
curConf := new(GlobalSettingsValue)
|
||||
if err := value.Unmarshal(curConf); err != nil {
|
||||
return errors.Wrapf(err, "unmarshal to GlobalSettingsValue: %s", value)
|
||||
}
|
||||
if !enable {
|
||||
if utils.IsInStringArray(name, setupKeys) {
|
||||
newKeys := []string{}
|
||||
for _, key := range setupKeys {
|
||||
if key != name {
|
||||
newKeys = append(newKeys, key)
|
||||
}
|
||||
}
|
||||
setupKeys = newKeys
|
||||
}
|
||||
} else if enable {
|
||||
if !utils.IsInStringArray(name, setupKeys) {
|
||||
setupKeys = append(setupKeys, name)
|
||||
}
|
||||
curConf.Switch(name, false)
|
||||
} else {
|
||||
curConf.Switch(name, true)
|
||||
}
|
||||
value.(*jsonutils.JSONDict).Set("setupKeys", jsonutils.Marshal(setupKeys))
|
||||
id, err := ss.GetString("id")
|
||||
if err != nil {
|
||||
return errors.Errorf("get id from %s", ss)
|
||||
}
|
||||
ss.(*jsonutils.JSONDict).Set("value", value)
|
||||
ss.(*jsonutils.JSONDict).Set("value", jsonutils.Marshal(curConf))
|
||||
obj, err := yunionconf.Parameters.Update(s, id, ss)
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "update %s(%s)", GlobalSettings, id)
|
||||
|
||||
@@ -96,6 +96,7 @@ func init() {
|
||||
apis.SERVICE_TYPE_OFFLINE_CLOUDMETA,
|
||||
apis.SERVICE_TYPE_CLOUDMETA,
|
||||
apis.SERVICE_TYPE_INFLUXDB,
|
||||
apis.SERVICE_TYPE_VICTORIA_METRICS,
|
||||
apis.SERVICE_TYPE_ETCD,
|
||||
"torrent-tracker",
|
||||
}) {
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
package monitor
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
|
||||
"yunion.io/x/pkg/errors"
|
||||
@@ -46,11 +45,7 @@ func init() {
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "DoTestRun")
|
||||
}
|
||||
jsonBytes, err := json.MarshalIndent(ret, "", " ")
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "MarshalIndent")
|
||||
}
|
||||
fmt.Printf("%s\n", jsonBytes)
|
||||
fmt.Printf("%s\n", ret.PrettyString())
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
@@ -36,9 +36,7 @@ func initAlertNotification() {
|
||||
return err
|
||||
}
|
||||
var result *printutils.ListResult
|
||||
if len(args.Alert) > 0 {
|
||||
result, err = monitor.Alertnotification.ListDescendent(s, args.Alert, params)
|
||||
} else if len(args.Notification) > 0 {
|
||||
if len(args.Notification) > 0 {
|
||||
result, err = monitor.Alertnotification.ListDescendent2(s, args.Notification, params)
|
||||
} else {
|
||||
result, err = monitor.Alertnotification.List(s, params)
|
||||
|
||||
@@ -15,10 +15,136 @@
|
||||
package monitor
|
||||
|
||||
import (
|
||||
"yunion.io/x/jsonutils"
|
||||
|
||||
monitorapi "yunion.io/x/onecloud/pkg/apis/monitor"
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
modules "yunion.io/x/onecloud/pkg/mcclient/modules/monitor"
|
||||
options "yunion.io/x/onecloud/pkg/mcclient/options/monitor"
|
||||
)
|
||||
|
||||
type CommonAlertTerm struct {
|
||||
Database string
|
||||
Measurement string
|
||||
Operator string // and / or
|
||||
Field []string
|
||||
FieldFunc string
|
||||
|
||||
Reduce string
|
||||
Comparator string
|
||||
Threshold float64
|
||||
Filters []monitorapi.MetricQueryTag
|
||||
FieldOpt string
|
||||
Name string
|
||||
ConditionType string
|
||||
From string
|
||||
Interval string
|
||||
GroupBy string
|
||||
Level string
|
||||
}
|
||||
|
||||
func newCommonAlertQuery(tem *CommonAlertTerm) *monitorapi.CommonAlertQuery {
|
||||
mq := monitorapi.MetricQuery{
|
||||
Alias: "",
|
||||
Tz: "",
|
||||
Database: tem.Database,
|
||||
Measurement: tem.Measurement,
|
||||
Tags: make([]monitorapi.MetricQueryTag, 0),
|
||||
GroupBy: make([]monitorapi.MetricQueryPart, 0),
|
||||
Selects: nil,
|
||||
Interval: "",
|
||||
Policy: "",
|
||||
ResultFormat: "",
|
||||
}
|
||||
|
||||
for _, field := range tem.Field {
|
||||
sel := monitorapi.MetricQueryPart{
|
||||
Type: "field",
|
||||
Params: []string{field},
|
||||
}
|
||||
selectPart := []monitorapi.MetricQueryPart{sel}
|
||||
if len(tem.FieldFunc) != 0 {
|
||||
selectPart = append(selectPart, monitorapi.MetricQueryPart{
|
||||
Type: tem.FieldFunc,
|
||||
Params: []string{},
|
||||
})
|
||||
} else {
|
||||
selectPart = append(selectPart, monitorapi.MetricQueryPart{
|
||||
Type: "mean",
|
||||
Params: []string{},
|
||||
})
|
||||
}
|
||||
mq.Selects = append(mq.Selects, selectPart)
|
||||
}
|
||||
if len(tem.Filters) != 0 {
|
||||
for _, filter := range tem.Filters {
|
||||
mq.Tags = append(mq.Tags, filter)
|
||||
}
|
||||
}
|
||||
|
||||
alertQ := new(monitorapi.AlertQuery)
|
||||
alertQ.Model = mq
|
||||
alertQ.From = "60m"
|
||||
|
||||
commonAlert := monitorapi.CommonAlertQuery{
|
||||
AlertQuery: alertQ,
|
||||
Reduce: tem.Reduce,
|
||||
Comparator: tem.Comparator,
|
||||
Threshold: tem.Threshold,
|
||||
Operator: tem.Operator,
|
||||
}
|
||||
if tem.FieldOpt != "" {
|
||||
commonAlert.FieldOpt = monitorapi.CommonAlertFieldOpt_Division
|
||||
}
|
||||
if len(tem.ConditionType) != 0 {
|
||||
commonAlert.ConditionType = tem.ConditionType
|
||||
}
|
||||
if len(tem.GroupBy) != 0 {
|
||||
commonAlert.Model.GroupBy = append(commonAlert.Model.GroupBy, monitorapi.MetricQueryPart{
|
||||
Type: "field",
|
||||
Params: []string{tem.GroupBy},
|
||||
})
|
||||
}
|
||||
return &commonAlert
|
||||
}
|
||||
|
||||
var (
|
||||
cpuTem = &CommonAlertTerm{
|
||||
Operator: "or",
|
||||
Database: "telegraf",
|
||||
Measurement: "vm_cpu",
|
||||
Field: []string{"usage_active"},
|
||||
Comparator: ">=",
|
||||
Reduce: "avg",
|
||||
Threshold: 50,
|
||||
Name: "lzx-test.cpu.usage_active",
|
||||
Filters: []monitorapi.MetricQueryTag{
|
||||
{
|
||||
Key: "id",
|
||||
Operator: "=",
|
||||
Value: "a0eee5dd-3cfe-4ab1-8c79-aee1a8cf4dab",
|
||||
},
|
||||
},
|
||||
}
|
||||
memTem = &CommonAlertTerm{
|
||||
Operator: "or",
|
||||
Database: "telegraf",
|
||||
Measurement: "vm_mem",
|
||||
Field: []string{"used_percent"},
|
||||
Comparator: ">=",
|
||||
Reduce: "avg",
|
||||
Threshold: 3,
|
||||
Name: "lzx-test.mem.avaiable",
|
||||
Filters: []monitorapi.MetricQueryTag{
|
||||
{
|
||||
Key: "id",
|
||||
Operator: "=",
|
||||
Value: "a0eee5dd-3cfe-4ab1-8c79-aee1a8cf4dab",
|
||||
},
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
func init() {
|
||||
cmd := NewResourceCmd(modules.CommonAlerts)
|
||||
cmd.Create(new(options.CommonAlertCreateOptions))
|
||||
@@ -28,4 +154,34 @@ func init() {
|
||||
cmd.Perform("disable", &options.CommonAlertShowOptions{})
|
||||
cmd.BatchDelete(new(options.CommonAlertDeleteOptions))
|
||||
cmd.Perform("config", &options.CommonAlertUpdateOptions{})
|
||||
|
||||
type TestOpt struct {
|
||||
NAME string
|
||||
RobotIds []string
|
||||
Users []string
|
||||
}
|
||||
R(&TestOpt{}, "monitor-commonalert-create-mul-test", "create test monitor common alert", func(s *mcclient.ClientSession, opt *TestOpt) error {
|
||||
cpuQ := newCommonAlertQuery(cpuTem)
|
||||
memQ := newCommonAlertQuery(memTem)
|
||||
input := monitorapi.CommonAlertCreateInput{
|
||||
CommonMetricInputQuery: monitorapi.CommonMetricInputQuery{
|
||||
MetricQuery: []*monitorapi.CommonAlertQuery{
|
||||
cpuQ,
|
||||
memQ,
|
||||
},
|
||||
},
|
||||
AlertCreateInput: monitorapi.AlertCreateInput{
|
||||
Name: opt.NAME,
|
||||
},
|
||||
CommonAlertCreateBaseInput: monitorapi.CommonAlertCreateBaseInput{
|
||||
Recipients: opt.Users,
|
||||
RobotIds: opt.RobotIds,
|
||||
Channel: []string{"webconsole"},
|
||||
AlertType: monitorapi.CommonAlertNomalAlertType,
|
||||
Scope: "system",
|
||||
},
|
||||
}
|
||||
_, err := modules.CommonAlerts.Create(s, jsonutils.Marshal(input))
|
||||
return err
|
||||
})
|
||||
}
|
||||
|
||||
@@ -15,7 +15,10 @@
|
||||
package monitor
|
||||
|
||||
import (
|
||||
"yunion.io/x/pkg/errors"
|
||||
|
||||
"yunion.io/x/onecloud/cmd/climc/shell"
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules/monitor"
|
||||
options "yunion.io/x/onecloud/pkg/mcclient/options/monitor"
|
||||
)
|
||||
@@ -24,5 +27,18 @@ func init() {
|
||||
cmd := shell.NewResourceCmd(monitor.UnifiedMonitorManager).SetPrefix("monitor")
|
||||
cmd.Show(&options.SimpleQueryOptions{})
|
||||
cmd.GetProperty(&options.MeasurementsQueryOptions{})
|
||||
cmd.GetProperty(&options.DatabasesQueryOptions{})
|
||||
// cmd.GetProperty(&options.DatabasesQueryOptions{})
|
||||
|
||||
R(new(options.MetricQueryOptions), "monitor-unifiedmonitor-query", "Perform metrics query", func(s *mcclient.ClientSession, opts *options.MetricQueryOptions) error {
|
||||
input, err := opts.GetQueryInput()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
resp, err := monitor.UnifiedMonitorManager.PerformQuery(s, input)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "PerformQuery")
|
||||
}
|
||||
printObject(resp)
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
@@ -27,4 +27,5 @@ func init() {
|
||||
cmd.Update(new(options.ConfigUpdateOptions))
|
||||
cmd.Show(new(options.ConfigOptions))
|
||||
cmd.Delete(new(options.ConfigOptions))
|
||||
cmd.GetProperty(new(options.ConfigCapabilityOptions))
|
||||
}
|
||||
|
||||
@@ -44,6 +44,14 @@ const (
|
||||
// Failed, Offline, Degraded, Rebuilding, Out of Sync (OSY)
|
||||
|
||||
func main() {
|
||||
logLevel := "debug"
|
||||
logVerboseLevel := 5
|
||||
log.SetVerboseLevel(int32(logVerboseLevel))
|
||||
err := log.SetLogLevelByString(log.Logger(), logLevel)
|
||||
if err != nil {
|
||||
log.Fatalf("Set log level %q: %v", logLevel, err)
|
||||
}
|
||||
|
||||
// creates the in-cluster config
|
||||
config, err := rest.InClusterConfig()
|
||||
if err != nil {
|
||||
|
||||
26
go.mod
26
go.mod
@@ -26,13 +26,15 @@ require (
|
||||
github.com/golang-plus/uuid v1.0.0
|
||||
github.com/golang/mock v1.4.4
|
||||
github.com/google/gopacket v1.1.17
|
||||
github.com/google/uuid v1.3.0
|
||||
github.com/google/uuid v1.6.0
|
||||
github.com/googollee/go-socket.io v0.0.0-20181214084611-0ad7206c347a
|
||||
github.com/gorilla/mux v1.7.0
|
||||
github.com/gorilla/websocket v1.4.1
|
||||
github.com/gosuri/uitable v0.0.0-20160404203958-36ee7e946282
|
||||
github.com/hako/durafmt v0.0.0-20180520121703-7b7ae1e72ead
|
||||
github.com/hugozhu/godingtalk v1.0.6
|
||||
github.com/influxdata/influxql v1.1.0
|
||||
github.com/influxdata/promql/v2 v2.12.0
|
||||
github.com/jaypipes/ghw v0.11.0
|
||||
github.com/koding/websocketproxy v0.0.0-20181220232114-7ed82d81a28c
|
||||
github.com/lestrrat-go/jwx v1.0.2
|
||||
@@ -54,16 +56,18 @@ require (
|
||||
github.com/sevlyar/go-daemon v0.1.5
|
||||
github.com/shirou/gopsutil v3.21.11+incompatible
|
||||
github.com/shirou/gopsutil/v3 v3.22.10
|
||||
github.com/sirupsen/logrus v1.9.0
|
||||
github.com/skip2/go-qrcode v0.0.0-20190110000554-dc11ecdae0a9
|
||||
github.com/smartystreets/goconvey v1.7.2
|
||||
github.com/stretchr/testify v1.8.1
|
||||
github.com/stretchr/testify v1.9.0
|
||||
github.com/tatsushid/go-fastping v0.0.0-20160109021039-d7bb493dee3e
|
||||
github.com/tjfoc/gmsm v1.4.1
|
||||
github.com/tredoe/osutil/v2 v2.0.0-rc.16
|
||||
github.com/tredoe/osutil v1.5.0
|
||||
github.com/vishvananda/netlink v1.1.0
|
||||
github.com/vishvananda/netns v0.0.0-20211101163701-50045581ed74
|
||||
github.com/vmihailenco/msgpack v4.0.4+incompatible
|
||||
github.com/xuri/excelize/v2 v2.7.1
|
||||
github.com/zexi/influxql-to-metricsql v0.0.6
|
||||
go.etcd.io/etcd/api/v3 v3.5.0
|
||||
go.etcd.io/etcd/client/v3 v3.5.0
|
||||
golang.org/x/crypto v0.8.0
|
||||
@@ -85,14 +89,14 @@ require (
|
||||
k8s.io/client-go v0.19.3
|
||||
k8s.io/cluster-bootstrap v0.19.3
|
||||
moul.io/http2curl/v2 v2.3.0
|
||||
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20231101105715-47037258f09b
|
||||
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20250620092954-45cec7e835fd
|
||||
yunion.io/x/executor v0.0.0-20230705125604-c5ac3141db32
|
||||
yunion.io/x/jsonutils v1.0.1-0.20230613121553-0f3b41e2ef19
|
||||
yunion.io/x/log v1.0.1-0.20230411060016-feb3f46ab361
|
||||
yunion.io/x/jsonutils v1.0.1-0.20240930100528-1671a2d0d22f
|
||||
yunion.io/x/log v1.0.1-0.20240305175729-7cf2d6cd5a91
|
||||
yunion.io/x/ovsdb v0.0.0-20230306173834-f164f413a900
|
||||
yunion.io/x/pkg v1.0.1-0.20231101105448-abef64cdc142
|
||||
yunion.io/x/pkg v1.10.1
|
||||
yunion.io/x/s3cli v0.0.0-20190917004522-13ac36d8687e
|
||||
yunion.io/x/sqlchemy v1.1.2-0.20231017172907-561e7f013926
|
||||
yunion.io/x/sqlchemy v1.1.2
|
||||
yunion.io/x/structarg v0.0.0-20231017124457-df4d5009457c
|
||||
)
|
||||
|
||||
@@ -136,6 +140,7 @@ require (
|
||||
github.com/boltdb/bolt v1.3.1 // indirect
|
||||
github.com/boombuler/barcode v1.0.1-0.20190219062509-6c824513bacc // indirect
|
||||
github.com/bradfitz/iter v0.0.0-20140124041915-454541ec3da2 // indirect
|
||||
github.com/cespare/xxhash v1.1.0 // indirect
|
||||
github.com/cespare/xxhash/v2 v2.1.2 // indirect
|
||||
github.com/cloudflare/golz4 v0.0.0-20150217214814-ef862a3cdc58 // indirect
|
||||
github.com/coreos/go-semver v0.3.0 // indirect
|
||||
@@ -225,11 +230,10 @@ require (
|
||||
github.com/richardlehane/msoleps v1.0.3 // indirect
|
||||
github.com/rivo/uniseg v0.2.0 // indirect
|
||||
github.com/ryszard/goskiplist v0.0.0-20150312221310-2dfbae5fcf46 // indirect
|
||||
github.com/sirupsen/logrus v1.9.0 // indirect
|
||||
github.com/smartystreets/assertions v1.2.0 // indirect
|
||||
github.com/spaolacci/murmur3 v1.1.0 // indirect
|
||||
github.com/spf13/pflag v1.0.5 // indirect
|
||||
github.com/stretchr/objx v0.5.0 // indirect
|
||||
github.com/stretchr/objx v0.5.2 // indirect
|
||||
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.413 // indirect
|
||||
github.com/tencentyun/cos-go-sdk-v5 v0.7.24 // indirect
|
||||
github.com/texttheater/golang-levenshtein v0.0.0-20180516184445-d188e65d659e // indirect
|
||||
@@ -249,7 +253,7 @@ require (
|
||||
go.uber.org/multierr v1.6.0 // indirect
|
||||
go.uber.org/zap v1.17.0 // indirect
|
||||
golang.org/x/lint v0.0.0-20210508222113-6edffad5e616 // indirect
|
||||
golang.org/x/mod v0.8.0 // indirect
|
||||
golang.org/x/mod v0.9.0 // indirect
|
||||
golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c // indirect
|
||||
golang.org/x/term v0.7.0 // indirect
|
||||
golang.org/x/tools v0.6.0 // indirect
|
||||
|
||||
51
go.sum
51
go.sum
@@ -87,6 +87,8 @@ github.com/Masterminds/sprig v2.22.0+incompatible/go.mod h1:y6hNFY5UBTIWBxnzTeuN
|
||||
github.com/Microsoft/azure-vhd-utils v0.0.0-20181115010904-44cbada2ece3 h1:gImoAO1xAcC1oDlYmD/X7dggsodGf2DFJOVE5m0ssms=
|
||||
github.com/Microsoft/azure-vhd-utils v0.0.0-20181115010904-44cbada2ece3/go.mod h1:u0H9gMieFLxkUy8RS0X8VbFWyPs2815qQAaitRbj6x0=
|
||||
github.com/NYTimes/gziphandler v0.0.0-20170623195520-56545f4a5d46/go.mod h1:3wb06e3pkSAbeQ52E9H9iFoQsEEwGN64994WTCIhntQ=
|
||||
github.com/OneOfOne/xxhash v1.2.2 h1:KMrpdQIwFcEqXDklaen+P1axHaj9BSKzvpUUfnHldSE=
|
||||
github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=
|
||||
github.com/PuerkitoBio/purell v1.0.0/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0=
|
||||
github.com/PuerkitoBio/urlesc v0.0.0-20160726150825-5bd2802263f2/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE=
|
||||
github.com/QcloudApi/qcloud_sign_golang v0.0.0-20141224014652-e4130a326409/go.mod h1:1pk82RBxDY/JZnPQrtqHlUFfCctgdorsd9M06fMynOM=
|
||||
@@ -178,6 +180,8 @@ github.com/bradfitz/iter v0.0.0-20140124041915-454541ec3da2/go.mod h1:PyRFw1Lt2w
|
||||
github.com/c-bata/go-prompt v0.2.4 h1:7pKUJ3CUgzdu1HJeWhNRkpVyY/NnlJhM/7d6YgHNOao=
|
||||
github.com/c-bata/go-prompt v0.2.4/go.mod h1:PqlttLXp0E7bZcoDW+dmzyKqFbmQTFoNzGSuW/AQRmo=
|
||||
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
|
||||
github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko=
|
||||
github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc=
|
||||
github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
|
||||
github.com/cespare/xxhash/v2 v2.1.2 h1:YRXhKfTDauu4ajMg1TPgFO5jnlC2HCbmLXMcTG5cbYE=
|
||||
github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
|
||||
@@ -383,8 +387,8 @@ github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hf
|
||||
github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
|
||||
github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
|
||||
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
||||
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg=
|
||||
github.com/googleapis/gax-go/v2 v2.0.5 h1:sjZBwGj9Jlw33ImPtvFviGYvseOtDM7hkSKB7+Tv3SM=
|
||||
github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk=
|
||||
@@ -426,6 +430,10 @@ github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:
|
||||
github.com/imdario/mergo v0.3.5/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA=
|
||||
github.com/imdario/mergo v0.3.6 h1:xTNEAn+kxVO7dTZGu0CegyqKZmoWFI0rF8UxjlB2d28=
|
||||
github.com/imdario/mergo v0.3.6/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA=
|
||||
github.com/influxdata/influxql v1.1.0 h1:sPsaumLFRPMwR5QtD3Up54HXpNND8Eu7G1vQFmi3quQ=
|
||||
github.com/influxdata/influxql v1.1.0/go.mod h1:KpVI7okXjK6PRi3Z5B+mtKZli+R1DnZgb3N+tzevNgo=
|
||||
github.com/influxdata/promql/v2 v2.12.0 h1:kXn3p0D7zPw16rOtfDR+wo6aaiH8tSMfhPwONTxrlEc=
|
||||
github.com/influxdata/promql/v2 v2.12.0/go.mod h1:fxOPu+DY0bqCTCECchSRtWfc+0X19ybifQhZoQNF5D8=
|
||||
github.com/ipandtcp/godingtalk v0.0.0-20180410032244-ca3d6ac197fb/go.mod h1:3umLciE1jBnh2LgrL15R2zbEe+HVPRZXnlSjjb/dYiw=
|
||||
github.com/jaypipes/ghw v0.11.0 h1:i0pKvAM7eZk0KvLm9vzpcpDKTRnfR6AQ5pFkPVnYJXU=
|
||||
github.com/jaypipes/ghw v0.11.0/go.mod h1:jeJGbkRB2lL3/gxYzNYzEDETV1ZJ56OKr+CSeSEym+g=
|
||||
@@ -608,6 +616,7 @@ github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:
|
||||
github.com/prometheus/client_model v0.2.0 h1:uq5h0d+GuxiXLJLNABMgp2qUWDPiLvgCzz2dUR+/W/M=
|
||||
github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
|
||||
github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
|
||||
github.com/prometheus/common v0.6.0/go.mod h1:eBmuwkDJBwy6iBfxCBob6t6dR6ENT/y+J+Zk0j9GMYc=
|
||||
github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo=
|
||||
github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc=
|
||||
github.com/prometheus/common v0.32.1 h1:hWIdL3N2HoUx3B8j3YN9mWor0qhY/NlEKZEaXxuIRh4=
|
||||
@@ -660,7 +669,6 @@ github.com/smartystreets/assertions v1.2.0 h1:42S6lae5dvLc7BrLu/0ugRtcFVjoJNMC/N
|
||||
github.com/smartystreets/assertions v1.2.0/go.mod h1:tcbTF8ujkAEcZ8TElKY+i30BzYlVhC/LOxJk7iOWnoo=
|
||||
github.com/smartystreets/goconvey v0.0.0-20180222194500-ef6db91d284a/go.mod h1:XDJAKZRPZ1CvBcN2aX5YOUTYGHki24fSF0Iv48Ibg0s=
|
||||
github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
|
||||
github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
|
||||
github.com/smartystreets/goconvey v1.7.2 h1:9RBaZCeXEQ3UselpuwUQHltGVXvdwm6cv1hgR6gDIPg=
|
||||
github.com/smartystreets/goconvey v1.7.2/go.mod h1:Vw0tHAZW6lzCRk3xgdin6fKYcG+G3Pg9vgXWeJpQFMM=
|
||||
github.com/smartystreets/gunit v0.0.0-20180314194857-6f0d6275bdcd/go.mod h1:XUKj4gbqj2QvJk/OdLWzyZ3FYli0f+MdpngyryX0gcw=
|
||||
@@ -674,8 +682,9 @@ github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
|
||||
github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c=
|
||||
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
|
||||
github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY=
|
||||
github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=
|
||||
github.com/stretchr/testify v1.2.1/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||
@@ -684,8 +693,9 @@ github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5
|
||||
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
|
||||
github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk=
|
||||
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
|
||||
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
|
||||
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
||||
github.com/syncthing/syncthing v0.14.48-rc.4/go.mod h1:nw3siZwHPA6M8iSfjDCWQ402eqvEIasMQOE8nFOxy7M=
|
||||
github.com/tailscale/depaware v0.0.0-20210622194025-720c4b409502/go.mod h1:p9lPsd+cx33L3H9nNoecRRxPssFKUwwI50I3pZ0yT+8=
|
||||
github.com/tatsushid/go-fastping v0.0.0-20160109021039-d7bb493dee3e h1:nt2877sKfojlHCTOBXbpWjBkuWKritFaGIfgQwbQUls=
|
||||
@@ -705,8 +715,8 @@ github.com/tklauser/go-sysconf v0.3.10 h1:IJ1AZGZRWbY8T5Vfk04D9WOA5WSejdflXxP03O
|
||||
github.com/tklauser/go-sysconf v0.3.10/go.mod h1:C8XykCvCb+Gn0oNCWPIlcb0RuglQTYaQ2hGm7jmxEFk=
|
||||
github.com/tklauser/numcpus v0.4.0 h1:E53Dm1HjH1/R2/aoCtXtPgzmElmn51aOkhCFSuZq//o=
|
||||
github.com/tklauser/numcpus v0.4.0/go.mod h1:1+UI3pD8NW14VMwdgJNJ1ESk2UnwhAnz5hMwiKKqXCQ=
|
||||
github.com/tredoe/osutil/v2 v2.0.0-rc.16 h1:5A2SKvyB2c3lhPYUIHyFtu6jbaXlaA3Hu5gWIam8Pik=
|
||||
github.com/tredoe/osutil/v2 v2.0.0-rc.16/go.mod h1:uLRVx/3pb7Y4RQhG8cQFbPE9ha5r81e6MXpBsxbTAYc=
|
||||
github.com/tredoe/osutil v1.5.0 h1:UGVxbbHRoZi8xXVmbNZ2vgG6XoJ15ndE4LniiQ3rJKg=
|
||||
github.com/tredoe/osutil v1.5.0/go.mod h1:TEzphzUUunysbdDRfdOgqkg10POQbnfIPV50ynqOfIg=
|
||||
github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw=
|
||||
github.com/ugorji/go/codec v1.1.7 h1:2SvQaVZ1ouYrrKKwoSk2pzd4A9evlKJb9oTL+OaLUSs=
|
||||
github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY=
|
||||
@@ -739,6 +749,8 @@ github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1
|
||||
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
|
||||
github.com/yusufpapurcu/wmi v1.2.2 h1:KBNDSne4vP5mbSWnJbO+51IMOXJB67QiYCSBrubbPRg=
|
||||
github.com/yusufpapurcu/wmi v1.2.2/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0=
|
||||
github.com/zexi/influxql-to-metricsql v0.0.6 h1:E16T4oqgjIJtSNVvhGGHnw+pmY3yGz2iRsmmmSVuOpY=
|
||||
github.com/zexi/influxql-to-metricsql v0.0.6/go.mod h1:PyRRM+3Zrzzig6J4okYLeSv+/d+5GaL5ccBaUKQABNs=
|
||||
go.etcd.io/etcd/api/v3 v3.5.0 h1:GsV3S+OfZEOCNXdtNkBSR7kgLobAa/SO6tCxRa0GAYw=
|
||||
go.etcd.io/etcd/api/v3 v3.5.0/go.mod h1:cbVKeC6lCfl7j/8jBhAK6aIYO9XOjdptoxU/nLQcPvs=
|
||||
go.etcd.io/etcd/client/pkg/v3 v3.5.0 h1:2aQv6F436YnN7I4VbI8PPYrBhu+SmrTaADcf8Mi/6PU=
|
||||
@@ -809,8 +821,9 @@ golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
|
||||
golang.org/x/mod v0.8.0 h1:LUYupSeNrTNCGzR/hVBk2NHZO4hXcVaW1k4Qx7rjPx8=
|
||||
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
|
||||
golang.org/x/mod v0.9.0 h1:KENHtAZL2y3NLMYZeHY9DW8HW8V+kQyJsY/V9JlKvCs=
|
||||
golang.org/x/mod v0.9.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
|
||||
golang.org/x/net v0.0.0-20180524181706-dfa909b99c79/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
@@ -1184,26 +1197,28 @@ sigs.k8s.io/structured-merge-diff/v4 v4.0.1/go.mod h1:bJZC9H9iH24zzfZ/41RGcq60oK
|
||||
sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o=
|
||||
sigs.k8s.io/yaml v1.2.0 h1:kr/MCeFWJWTwyaHoR9c8EjH9OumOmoF9YGiZd7lFm/Q=
|
||||
sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc=
|
||||
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20231101105715-47037258f09b h1:t/iEm/UPjHrH43Qog2OBJmbYOFSXXgm5q4GXNBAuouI=
|
||||
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20231101105715-47037258f09b/go.mod h1:2sgCN7nRPQL3woLfdgqLDd92vwAHqtlz3KKiHxC5BAw=
|
||||
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20241225022334-4e2172537c5f h1:aiuvYhva6wqHtF6SqSx2veZKIrTXQQDWng6/MkwZB/c=
|
||||
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20241225022334-4e2172537c5f/go.mod h1:FTcqfExw4fKA/2uBsZy0FXZ6gojGisguUt65586FES4=
|
||||
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20250620092954-45cec7e835fd h1:AOi+PskYKrV/KKCyzgz/ogL72V6uyLyLcuu7qj5QOFE=
|
||||
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20250620092954-45cec7e835fd/go.mod h1:FTcqfExw4fKA/2uBsZy0FXZ6gojGisguUt65586FES4=
|
||||
yunion.io/x/executor v0.0.0-20230705125604-c5ac3141db32 h1:v7POYkQwo1XzOxBoIoRVr/k0V9Y5JyjpshlIFa9raug=
|
||||
yunion.io/x/executor v0.0.0-20230705125604-c5ac3141db32/go.mod h1:Uxuou9WQIeJXNpy7t2fPLL0BYLvLiMvGQwY7Qc6aSws=
|
||||
yunion.io/x/jsonutils v0.0.0-20190625054549-a964e1e8a051/go.mod h1:4N0/RVzsYL3kH3WE/H1BjUQdFiWu50JGCFQuuy+Z634=
|
||||
yunion.io/x/jsonutils v1.0.1-0.20230613121553-0f3b41e2ef19 h1:mZh6vuo7oOiOtE5HF4667+XBNnn7uYpmGN5eIgCVMLk=
|
||||
yunion.io/x/jsonutils v1.0.1-0.20230613121553-0f3b41e2ef19/go.mod h1:VK4Z93dgiKgAijcSqbMKmGaBMJuHulR16Hz4K015ZPo=
|
||||
yunion.io/x/jsonutils v1.0.1-0.20240930100528-1671a2d0d22f h1:N7V0uLqX9mED1HEPeIKcYpkWglnHL5hyn4ENX+VBeqM=
|
||||
yunion.io/x/jsonutils v1.0.1-0.20240930100528-1671a2d0d22f/go.mod h1:VK4Z93dgiKgAijcSqbMKmGaBMJuHulR16Hz4K015ZPo=
|
||||
yunion.io/x/log v0.0.0-20190514041436-04ce53b17c6b/go.mod h1:+gauLs73omeJAPlsXcevLsJLKixV+sR/E7WSYTSx1fE=
|
||||
yunion.io/x/log v0.0.0-20190629062853-9f6483a7103d/go.mod h1:LC6f/4FozL0iaAbnFt2eDX9jlsyo3WiOUPm03d7+U4U=
|
||||
yunion.io/x/log v1.0.1-0.20230411060016-feb3f46ab361 h1:c5LyNdhbvBe/92pXs9jgXOU/S+RgYh/DHe538LpT/Mo=
|
||||
yunion.io/x/log v1.0.1-0.20230411060016-feb3f46ab361/go.mod h1:LC6f/4FozL0iaAbnFt2eDX9jlsyo3WiOUPm03d7+U4U=
|
||||
yunion.io/x/log v1.0.1-0.20240305175729-7cf2d6cd5a91 h1:inY5o3LDa/zgsIZuPN0HmpzKIsu/lLgsBmMttuDPGj4=
|
||||
yunion.io/x/log v1.0.1-0.20240305175729-7cf2d6cd5a91/go.mod h1:LC6f/4FozL0iaAbnFt2eDX9jlsyo3WiOUPm03d7+U4U=
|
||||
yunion.io/x/ovsdb v0.0.0-20230306173834-f164f413a900 h1:Hu/4ERvoWaN6aiFs4h4/yvVBMeVzb3eDaYTxkVx9Kdo=
|
||||
yunion.io/x/ovsdb v0.0.0-20230306173834-f164f413a900/go.mod h1:0vLkNEhlmA64HViPBAnSTUMrx5QP1CLsxXmxDKQ80tc=
|
||||
yunion.io/x/pkg v0.0.0-20190620104149-945c25821dbf/go.mod h1:t6rEGG2sQ4J7DhFxSZVOTjNd0YO/KlfWQyK1W4tog+E=
|
||||
yunion.io/x/pkg v0.0.0-20190628082551-f4033ba2ea30/go.mod h1:t6rEGG2sQ4J7DhFxSZVOTjNd0YO/KlfWQyK1W4tog+E=
|
||||
yunion.io/x/pkg v1.0.1-0.20231101105448-abef64cdc142 h1:L6LqxfP08eWUx+A6yQdrL6VB3KILU1TbQllPtKZq7PM=
|
||||
yunion.io/x/pkg v1.0.1-0.20231101105448-abef64cdc142/go.mod h1:ksCJVQ+DwKrJ5QBEoU8pzrDFfDaZVAFH/iJ6yQCYxJk=
|
||||
yunion.io/x/pkg v1.10.1 h1:X2U0LU5zKFGGG/XjZ6keX/7wvY0HdxxfbydduXIpsiY=
|
||||
yunion.io/x/pkg v1.10.1/go.mod h1:39A2WEJLqD83do7yP5GL1ZT5w4N6x601PtxR+jlOwa8=
|
||||
yunion.io/x/s3cli v0.0.0-20190917004522-13ac36d8687e h1:v+EzIadodSwkdZ/7bremd7J8J50Cise/HCylsOJngmo=
|
||||
yunion.io/x/s3cli v0.0.0-20190917004522-13ac36d8687e/go.mod h1:0iFKpOs1y4lbCxeOmq3Xx/0AcQoewVPwj62eRluioEo=
|
||||
yunion.io/x/sqlchemy v1.1.2-0.20231017172907-561e7f013926 h1:FJ+2J0MwmxUcuN/8ukWHdK2XIoV3GGCotTCgi0w4L+w=
|
||||
yunion.io/x/sqlchemy v1.1.2-0.20231017172907-561e7f013926/go.mod h1:uuPVZEyEq3sWd5vf9VjGSy6lZzof22X87OEHw9sddJQ=
|
||||
yunion.io/x/sqlchemy v1.1.2 h1:h44E1ZO3bwiObXZsnCNSTRgXc9xSV86CWINUMs0qDVE=
|
||||
yunion.io/x/sqlchemy v1.1.2/go.mod h1:uuPVZEyEq3sWd5vf9VjGSy6lZzof22X87OEHw9sddJQ=
|
||||
yunion.io/x/structarg v0.0.0-20231017124457-df4d5009457c h1:QuLab2kSRECZRxo4Lo2KcYn6XjQFDGaZ1+x0pYDVVwQ=
|
||||
yunion.io/x/structarg v0.0.0-20231017124457-df4d5009457c/go.mod h1:EP6NSv2C0zzqBDTKumv8hPWLb3XvgMZDHQRfyuOrQng=
|
||||
|
||||
@@ -108,6 +108,8 @@ func (h *MiscHandler) Bind(app *appsrv.Application) {
|
||||
// syslog webservice handlers
|
||||
app.AddHandler(POST, prefix+"syslog/token", handleSyslogWebServiceToken)
|
||||
app.AddHandler(POST, prefix+"syslog/message", handleSyslogWebServiceMessage)
|
||||
// service settings
|
||||
app.AddHandler(GET, prefix+"service_settings", h.getServiceSettings)
|
||||
}
|
||||
|
||||
func UploadHandlerInfo(method, prefix string, handler func(context.Context, http.ResponseWriter, *http.Request)) *appsrv.SHandlerInfo {
|
||||
@@ -250,7 +252,12 @@ func (mh *MiscHandler) DoBatchHostRegister(ctx context.Context, w http.ResponseW
|
||||
|
||||
ips := []string{}
|
||||
hosts := bytes.Buffer{}
|
||||
for _, row := range rows[1:] {
|
||||
for idx, row := range rows[1:] {
|
||||
rowStr := strings.Join(row, "")
|
||||
if len(rowStr) == 0 {
|
||||
log.Warningf("empty row: %d, skipping it", idx+1)
|
||||
continue
|
||||
}
|
||||
var e *httputils.JSONClientError
|
||||
if i1 >= 0 && len(row[i1]) > 0 {
|
||||
i1Ip := fmt.Sprintf("%d-%s", i1, row[i1])
|
||||
|
||||
81
pkg/apigateway/handler/service_setting.go
Normal file
81
pkg/apigateway/handler/service_setting.go
Normal file
@@ -0,0 +1,81 @@
|
||||
// Copyright 2019 Yunion
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package handler
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
|
||||
"yunion.io/x/jsonutils"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/appsrv"
|
||||
"yunion.io/x/onecloud/pkg/httperrors"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/auth"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules/identity"
|
||||
)
|
||||
|
||||
var settingNames = map[string][]string{
|
||||
"identity": []string{"no_action_logout_seconds"},
|
||||
"yunionapi": []string{"enable_organization"},
|
||||
"image": []string{"enable_pending_delete"},
|
||||
"compute_v2": []string{"enable_pending_delete"},
|
||||
"meter": []string{"cost_conversion_available", "enable_prediction", "share_resource_type"},
|
||||
"common": []string{"api_server", "enable_quota_check", "enable_watermark", "enable_cloud_shell"},
|
||||
}
|
||||
|
||||
func (mh *MiscHandler) getServiceSettings(ctx context.Context, w http.ResponseWriter, req *http.Request) {
|
||||
s := auth.GetAdminSession(ctx, FetchRegion(req))
|
||||
types := []string{}
|
||||
for typ := range settingNames {
|
||||
types = append(types, typ)
|
||||
}
|
||||
params := map[string]interface{}{
|
||||
"limit": 20,
|
||||
"scope": "system",
|
||||
"type": types,
|
||||
}
|
||||
resp, err := identity.ServicesV3.List(s, jsonutils.Marshal(params))
|
||||
if err != nil {
|
||||
e := httperrors.NewInternalServerError(err.Error())
|
||||
httperrors.JsonClientError(ctx, w, e)
|
||||
return
|
||||
}
|
||||
services := []struct {
|
||||
Id string
|
||||
Type string
|
||||
}{}
|
||||
err = jsonutils.Update(&services, resp.Data)
|
||||
if err != nil {
|
||||
e := httperrors.NewInternalServerError(err.Error())
|
||||
httperrors.JsonClientError(ctx, w, e)
|
||||
return
|
||||
}
|
||||
result := map[string]map[string]interface{}{}
|
||||
for _, service := range services {
|
||||
result[service.Type] = map[string]interface{}{}
|
||||
data, err := identity.ServicesV3.GetSpecific(s, service.Id, "config", nil)
|
||||
if err != nil {
|
||||
e := httperrors.NewInternalServerError(err.Error())
|
||||
httperrors.JsonClientError(ctx, w, e)
|
||||
return
|
||||
}
|
||||
names, _ := settingNames[service.Type]
|
||||
for _, name := range names {
|
||||
v, _ := data.Get("config", "default", name)
|
||||
result[service.Type][name] = v
|
||||
}
|
||||
}
|
||||
appsrv.SendJSON(w, jsonutils.Marshal(result))
|
||||
}
|
||||
@@ -17,7 +17,6 @@ package apihelper
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/log"
|
||||
@@ -40,10 +39,6 @@ func (o GetDBModelsOptions) GetModelSet() IModelSet {
|
||||
return o.modelOptions.ModelSet
|
||||
}
|
||||
|
||||
func (o GetDBModelsOptions) GetMinUpdatedAt() time.Time {
|
||||
return o.modelOptions.MinUpdatedAt
|
||||
}
|
||||
|
||||
func (o GetDBModelsOptions) IncludeDetails() bool {
|
||||
return o.modelOptions.IncludeDetails
|
||||
}
|
||||
|
||||
@@ -90,11 +90,11 @@ func SyncModelSets(mssOld IModelSets, s *mcclient.ClientSession, opt *Options) (
|
||||
}
|
||||
|
||||
func syncModelSets(mssOld IModelSets, s *mcclient.ClientSession, opt *Options) (IModelSets, error) {
|
||||
mss := mssOld.ModelSetList()
|
||||
// mss := mssOld.ModelSetList()
|
||||
mssNews := mssOld.NewEmpty()
|
||||
for i, msNew := range mssNews.ModelSetList() {
|
||||
for _, msNew := range mssNews.ModelSetList() {
|
||||
var (
|
||||
minUpdatedAt = ModelSetMaxUpdatedAt(mss[i])
|
||||
// minUpdatedAt = ModelSetMaxUpdatedAt(mss[i])
|
||||
includeEmulated = false
|
||||
)
|
||||
if optProvider, ok := msNew.(IModelSetEmulatedIncluder); ok {
|
||||
@@ -103,7 +103,7 @@ func syncModelSets(mssOld IModelSets, s *mcclient.ClientSession, opt *Options) (
|
||||
err := GetModels(&GetModelsOptions{
|
||||
ClientSession: s,
|
||||
ModelManager: msNew.ModelManager(),
|
||||
MinUpdatedAt: minUpdatedAt,
|
||||
// MinUpdatedAt: minUpdatedAt,
|
||||
ModelSet: msNew,
|
||||
BatchListSize: opt.ListBatchSize,
|
||||
|
||||
@@ -119,11 +119,9 @@ func syncModelSets(mssOld IModelSets, s *mcclient.ClientSession, opt *Options) (
|
||||
}
|
||||
|
||||
func SyncDBModelSets(mssOld IModelSets, s *mcclient.ClientSession, opt *Options) (r ModelSetsUpdateResult, err error) {
|
||||
mss := mssOld.ModelSetList()
|
||||
mssNews := mssOld.NewEmpty()
|
||||
for i, msNew := range mssNews.ModelSetList() {
|
||||
for _, msNew := range mssNews.ModelSetList() {
|
||||
var (
|
||||
minUpdatedAt = ModelSetMaxUpdatedAt(mss[i])
|
||||
includeEmulated = false
|
||||
)
|
||||
if optProvider, ok := msNew.(IModelSetEmulatedIncluder); ok {
|
||||
@@ -133,7 +131,6 @@ func SyncDBModelSets(mssOld IModelSets, s *mcclient.ClientSession, opt *Options)
|
||||
opts := &GetModelsOptions{
|
||||
ClientSession: s,
|
||||
ModelManager: msNew.ModelManager(),
|
||||
MinUpdatedAt: minUpdatedAt,
|
||||
ModelSet: msNew,
|
||||
BatchListSize: opt.ListBatchSize,
|
||||
|
||||
|
||||
@@ -23,7 +23,6 @@ import (
|
||||
"yunion.io/x/log"
|
||||
"yunion.io/x/pkg/errors"
|
||||
"yunion.io/x/pkg/util/printutils"
|
||||
"yunion.io/x/pkg/util/timeutils"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/cloudcommon/db"
|
||||
mcclient "yunion.io/x/onecloud/pkg/mcclient"
|
||||
@@ -41,7 +40,6 @@ type GetModelsOptions struct {
|
||||
ModelSet IModelSet
|
||||
|
||||
BatchListSize int
|
||||
MinUpdatedAt time.Time
|
||||
IncludeDetails bool
|
||||
IncludeEmulated bool
|
||||
InCludeOtherCloudEnv bool
|
||||
@@ -51,56 +49,12 @@ func GetModels(opts *GetModelsOptions) error {
|
||||
man := opts.ModelManager
|
||||
manKeyPlural := man.KeyString()
|
||||
|
||||
minUpdatedAt := opts.MinUpdatedAt
|
||||
minUpdatedAtFilter := func(time time.Time) string {
|
||||
// TODO add GE
|
||||
tstr := timeutils.MysqlTime(time)
|
||||
return fmt.Sprintf("updated_at.ge('%s')", tstr)
|
||||
}
|
||||
setNextListParams := func(params *jsonutils.JSONDict, lastUpdatedAt time.Time, lastResult *printutils.ListResult) (time.Time, error) {
|
||||
minUpdatedAt := PseudoZeroTime
|
||||
setNextListParams := func(params *jsonutils.JSONDict, lastResult *printutils.ListResult) error {
|
||||
// NOTE: the updated_at field has second-level resolution.
|
||||
// If they all have the same date...
|
||||
var max time.Time
|
||||
nmax := 0
|
||||
n := len(lastResult.Data)
|
||||
|
||||
// find out the max updated_at date in the result set, and how
|
||||
// many in the set has this date
|
||||
for i := n - 1; i >= 0; i-- {
|
||||
j := lastResult.Data[i]
|
||||
updatedAt, err := j.GetTime("updated_at")
|
||||
if err != nil {
|
||||
log.Warningf("%s: updated_at field: %s, %s",
|
||||
manKeyPlural, err, j.String())
|
||||
continue
|
||||
}
|
||||
if max.IsZero() {
|
||||
max = updatedAt
|
||||
}
|
||||
if max.Equal(updatedAt) {
|
||||
nmax += 1
|
||||
}
|
||||
}
|
||||
// error if we do not have valid date
|
||||
if max.IsZero() {
|
||||
return time.Time{}, fmt.Errorf("%s: cannot find next updated_at after '%q'",
|
||||
manKeyPlural, lastUpdatedAt)
|
||||
}
|
||||
|
||||
var newTime time.Time
|
||||
var newOffset int
|
||||
// if not all updated_at date are the same, then we can
|
||||
// continue to the next age.
|
||||
if nmax < n || (!max.Equal(lastUpdatedAt) && !max.Equal(PseudoZeroTime)) {
|
||||
newTime = max
|
||||
newOffset = nmax
|
||||
} else {
|
||||
newTime = lastUpdatedAt
|
||||
newOffset = lastResult.Offset + n
|
||||
}
|
||||
params.Set("filter.0", jsonutils.NewString(minUpdatedAtFilter(newTime)))
|
||||
params.Set("offset", jsonutils.NewInt(int64(newOffset)))
|
||||
return newTime, nil
|
||||
params.Set("offset", jsonutils.NewInt(int64(lastResult.Offset+len(lastResult.Data))))
|
||||
return nil
|
||||
}
|
||||
|
||||
listOptions := options.BaseListOptions{
|
||||
@@ -109,13 +63,11 @@ func GetModels(opts *GetModelsOptions) error {
|
||||
Scope: "system",
|
||||
Details: options.Bool(opts.IncludeDetails),
|
||||
ShowEmulated: options.Bool(opts.IncludeEmulated),
|
||||
Filter: []string{
|
||||
minUpdatedAtFilter(minUpdatedAt), // order matters, filter.0
|
||||
},
|
||||
OrderBy: []string{"updated_at"},
|
||||
Order: "asc",
|
||||
Limit: options.Int(opts.BatchListSize),
|
||||
Offset: options.Int(0),
|
||||
Filter: []string{},
|
||||
OrderBy: []string{"updated_at", "created_at", "id"},
|
||||
Order: "asc",
|
||||
Limit: options.Int(opts.BatchListSize),
|
||||
Offset: options.Int(0),
|
||||
}
|
||||
if !opts.InCludeOtherCloudEnv {
|
||||
listOptions.Filter = append(listOptions.Filter,
|
||||
@@ -150,6 +102,7 @@ func GetModels(opts *GetModelsOptions) error {
|
||||
entriesJson := []jsonutils.JSONObject{}
|
||||
for {
|
||||
var err error
|
||||
log.Debugf("fetch %s with params %s", manKeyPlural, jsonutils.Marshal(params))
|
||||
listResult, err := opts.ModelManager.List(opts.ClientSession, params)
|
||||
if err != nil {
|
||||
log.Errorf("%s: list failed with updated_at.gt('%s'): %s", manKeyPlural, minUpdatedAt, err)
|
||||
@@ -159,7 +112,7 @@ func GetModels(opts *GetModelsOptions) error {
|
||||
if listResult.Offset+len(listResult.Data) >= listResult.Total {
|
||||
break
|
||||
}
|
||||
minUpdatedAt, err = setNextListParams(params, minUpdatedAt, listResult)
|
||||
err = setNextListParams(params, listResult)
|
||||
if err != nil {
|
||||
return fmt.Errorf("%s: %s", manKeyPlural, err)
|
||||
}
|
||||
@@ -183,8 +136,7 @@ func InitializeModelSetFromJSON(set IModelSet, entriesJson []jsonutils.JSONObjec
|
||||
manKeyPlural := set.ModelManager().KeyString()
|
||||
for _, entryJson := range entriesJson {
|
||||
m := set.NewModel()
|
||||
var err error
|
||||
err = entryJson.Unmarshal(m)
|
||||
err := entryJson.Unmarshal(m)
|
||||
if err != nil {
|
||||
return fmt.Errorf("%s: unmarshal: %v: %s", manKeyPlural, err, entryJson.String())
|
||||
}
|
||||
@@ -284,5 +236,12 @@ func ModelSetApplyUpdates(aSet, bSet IModelSet) *ModelSetUpdateResult {
|
||||
r.Changed = true
|
||||
}
|
||||
}
|
||||
for _, kRv := range aSetRv.MapKeys() {
|
||||
bMRv := bSetRv.MapIndex(kRv)
|
||||
if !bMRv.IsValid() { // alread deleted
|
||||
aSetRv.SetMapIndex(kRv, reflect.Value{})
|
||||
r.Changed = true
|
||||
}
|
||||
}
|
||||
return r
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
// Copyright 2019 Yunion
|
||||
//
|
||||
//go:build !ignore_autogenerated
|
||||
// +build !ignore_autogenerated
|
||||
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
@@ -12,4 +13,28 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package cloudprovider // import "yunion.io/x/onecloud/pkg/apis/cloudprovider"
|
||||
// Code generated by swagger-gen. DO NOT EDIT.
|
||||
|
||||
// Cloudprovider API
|
||||
//
|
||||
// Schemes: https, http
|
||||
// BasePath: /
|
||||
// Version: 1.0
|
||||
// Host: "127.0.0.1:8889"
|
||||
// Contact: Zexi Li<lizexi@yunion.cn>
|
||||
// License: Apache 2.0 http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
// Consumes:
|
||||
// - application/json
|
||||
//
|
||||
// Produces:
|
||||
// - application/json
|
||||
//
|
||||
// SecurityDefinitions:
|
||||
// keystone:
|
||||
// name: X-Auth-Token
|
||||
// type: apiKey
|
||||
// in: header
|
||||
//
|
||||
// swagger:meta
|
||||
package cloudprovider
|
||||
|
||||
@@ -14,7 +14,22 @@
|
||||
|
||||
package cloudprovider
|
||||
|
||||
import "yunion.io/x/cloudmux/pkg/cloudprovider"
|
||||
// CacheKeyRule is an autogenerated struct via yunion.io/x/cloudmux/pkg/cloudprovider.CacheKeyRule.
|
||||
type CacheKeyRule struct {
|
||||
RulePaths []string `json:"rule_paths"`
|
||||
RuleType string `json:"rule_type"`
|
||||
FullUrlCache bool `json:"full_url_cache"`
|
||||
IgnoreCase bool `json:"ignore_case"`
|
||||
QueryString CacheKeyRuleQueryString `json:"query_string"`
|
||||
RuleTag string `json:"rule_tag"`
|
||||
}
|
||||
|
||||
// CacheKeyRuleQueryString is an autogenerated struct via yunion.io/x/cloudmux/pkg/cloudprovider.CacheKeyRuleQueryString.
|
||||
type CacheKeyRuleQueryString struct {
|
||||
Enabled bool `json:"enabled"`
|
||||
Action string `json:"action"`
|
||||
Value string `json:"value"`
|
||||
}
|
||||
|
||||
// DefaultAction is an autogenerated struct via yunion.io/x/cloudmux/pkg/cloudprovider.DefaultAction.
|
||||
type DefaultAction struct {
|
||||
@@ -30,6 +45,115 @@ type DefaultAction struct {
|
||||
ResponseHeaders map[string]string `json:"response_headers"`
|
||||
}
|
||||
|
||||
// ElasticSearchAccessInfo is an autogenerated struct via yunion.io/x/cloudmux/pkg/cloudprovider.ElasticSearchAccessInfo.
|
||||
type ElasticSearchAccessInfo struct {
|
||||
Domain string `json:"domain"`
|
||||
PrivateDomain string `json:"private_domain"`
|
||||
Vip string `json:"vip"`
|
||||
Port int `json:"port"`
|
||||
PrivatePort int `json:"private_port"`
|
||||
KibanaUrl string `json:"kibana_url"`
|
||||
KibanaPrivateUrl string `json:"kibana_private_url"`
|
||||
}
|
||||
|
||||
// RefererRule is an autogenerated struct via yunion.io/x/cloudmux/pkg/cloudprovider.RefererRule.
|
||||
type RefererRule struct {
|
||||
// 规则类型:
|
||||
// all:所有文件生效
|
||||
// file:指定文件后缀生效
|
||||
// directory:指定路径生效
|
||||
// path:指定绝对路径生效
|
||||
RuleType string `json:"rule_type"`
|
||||
RulePaths []string `json:"rule_paths"`
|
||||
RefererType string `json:"referer_type"`
|
||||
Referers []string `json:"referers"`
|
||||
AllowEmpty *bool `json:"allow_empty"`
|
||||
}
|
||||
|
||||
// RuleCacheConfig is an autogenerated struct via yunion.io/x/cloudmux/pkg/cloudprovider.RuleCacheConfig.
|
||||
type RuleCacheConfig struct {
|
||||
Cache *struct {
|
||||
Enabled bool
|
||||
CacheTime int
|
||||
CompareMaxAge bool
|
||||
IgnoreCacheControl bool
|
||||
IgnoreSetCookie bool
|
||||
} `json:"cache"`
|
||||
NoCache *struct {
|
||||
Enabled bool
|
||||
Revalidate bool
|
||||
} `json:"no_cache"`
|
||||
FollowOrigin *struct {
|
||||
Enabled bool
|
||||
HeuristicCache struct {
|
||||
Enabled bool
|
||||
CacheConfig struct {
|
||||
HeuristicCacheTimeSwitch bool
|
||||
HeuristicCacheTime int
|
||||
}
|
||||
}
|
||||
} `json:"follow_origin"`
|
||||
}
|
||||
|
||||
// SCDNCache is an autogenerated struct via yunion.io/x/cloudmux/pkg/cloudprovider.SCDNCache.
|
||||
type SCDNCache struct {
|
||||
RuleCache []SCacheRuleCache `json:"rule_cache"`
|
||||
}
|
||||
|
||||
// SCDNCacheKeys is an autogenerated struct via yunion.io/x/cloudmux/pkg/cloudprovider.SCDNCacheKeys.
|
||||
type SCDNCacheKeys struct {
|
||||
// 开启关闭忽略参数
|
||||
Enabled *bool `json:"enabled"`
|
||||
// 是否忽略大小
|
||||
IgnoreCase *bool `json:"ignore_case"`
|
||||
// 分路径缓存键配置
|
||||
KeyRules []CacheKeyRule `json:"key_rules"`
|
||||
}
|
||||
|
||||
// SCDNForceRedirect is an autogenerated struct via yunion.io/x/cloudmux/pkg/cloudprovider.SCDNForceRedirect.
|
||||
type SCDNForceRedirect struct {
|
||||
// 访问强制跳转配置开关
|
||||
Enabled *bool `json:"enabled"`
|
||||
// 访问强制跳转类型
|
||||
// enmu: http, https
|
||||
RedirectType string `json:"redirect_type"`
|
||||
}
|
||||
|
||||
// SCDNHttps is an autogenerated struct via yunion.io/x/cloudmux/pkg/cloudprovider.SCDNHttps.
|
||||
type SCDNHttps struct {
|
||||
// https 配置开关
|
||||
Enabled *bool `json:"enabled"`
|
||||
// http2 配置开关
|
||||
Http2 *bool `json:"http2"`
|
||||
}
|
||||
|
||||
// SCDNMaxAge is an autogenerated struct via yunion.io/x/cloudmux/pkg/cloudprovider.SCDNMaxAge.
|
||||
type SCDNMaxAge struct {
|
||||
Enabled *bool `json:"enabled"`
|
||||
MaxAgeRules []SMaxAgeRule `json:"max_age_rules"`
|
||||
}
|
||||
|
||||
// SCDNRangeOriginPull is an autogenerated struct via yunion.io/x/cloudmux/pkg/cloudprovider.SCDNRangeOriginPull.
|
||||
type SCDNRangeOriginPull struct {
|
||||
Enabled *bool `json:"enabled"`
|
||||
RangeOriginPullRules []SRangeOriginPullRule `json:"range_origin_pull_rules"`
|
||||
}
|
||||
|
||||
// SCDNReferer is an autogenerated struct via yunion.io/x/cloudmux/pkg/cloudprovider.SCDNReferer.
|
||||
type SCDNReferer struct {
|
||||
// 是否开启防盗链
|
||||
Enabled *bool `json:"enabled"`
|
||||
RefererRules []RefererRule `json:"referer_rules"`
|
||||
}
|
||||
|
||||
// SCacheRuleCache is an autogenerated struct via yunion.io/x/cloudmux/pkg/cloudprovider.SCacheRuleCache.
|
||||
type SCacheRuleCache struct {
|
||||
RulePaths []string `json:"rule_paths"`
|
||||
RuleType string `json:"rule_type"`
|
||||
Priority int `json:"priority"`
|
||||
CacheConfig *RuleCacheConfig `json:"cache_config"`
|
||||
}
|
||||
|
||||
// SCdnDomain is an autogenerated struct via yunion.io/x/cloudmux/pkg/cloudprovider.SCdnDomain.
|
||||
type SCdnDomain struct {
|
||||
// cdn加速域名
|
||||
@@ -48,14 +172,22 @@ type SCdnDomain struct {
|
||||
|
||||
// SCdnOrigin is an autogenerated struct via yunion.io/x/cloudmux/pkg/cloudprovider.SCdnOrigin.
|
||||
type SCdnOrigin struct {
|
||||
Type string `json:"type"`
|
||||
Origin string `json:"origin"`
|
||||
// 源站类型
|
||||
// domain: 域名类型, cos:对象存储源站, ip:IP 列表作为源站
|
||||
// enmu: domain, cos, ip
|
||||
// required: true
|
||||
Type string `json:"type"`
|
||||
// 源站地址
|
||||
Origin string `json:"origin"`
|
||||
// 回主源站时 Host 头部
|
||||
ServerName string `json:"server_name"`
|
||||
Protocol string `json:"protocol"`
|
||||
Path string `json:"path"`
|
||||
Port int `json:"port"`
|
||||
Enabled string `json:"enabled"`
|
||||
Priority int `json:"priority"`
|
||||
// 回源协议
|
||||
// enmu: http, follow, https
|
||||
Protocol string `json:"protocol"`
|
||||
Path string `json:"path"`
|
||||
Port int `json:"port"`
|
||||
Enabled string `json:"enabled"`
|
||||
Priority int `json:"priority"`
|
||||
}
|
||||
|
||||
// SCdnOrigins is an autogenerated struct via yunion.io/x/cloudmux/pkg/cloudprovider.SCdnOrigins.
|
||||
@@ -85,10 +217,28 @@ type SGeographicInfo struct {
|
||||
CountryCode string `json:"country_code"`
|
||||
}
|
||||
|
||||
// SMaxAgeRule is an autogenerated struct via yunion.io/x/cloudmux/pkg/cloudprovider.SMaxAgeRule.
|
||||
type SMaxAgeRule struct {
|
||||
MaxAgeType string `json:"max_age_type"`
|
||||
MaxAgeContents []string `json:"max_age_contents"`
|
||||
MaxAgeTime int `json:"max_age_time"`
|
||||
FollowOrigin bool `json:"follow_origin"`
|
||||
}
|
||||
|
||||
// SRangeOriginPullRule is an autogenerated struct via yunion.io/x/cloudmux/pkg/cloudprovider.SRangeOriginPullRule.
|
||||
type SRangeOriginPullRule struct {
|
||||
Enabled bool `json:"enabled"`
|
||||
RuleType string `json:"rule_type"`
|
||||
RulePaths []string `json:"rule_paths"`
|
||||
}
|
||||
|
||||
// SSubAccount is an autogenerated struct via yunion.io/x/cloudmux/pkg/cloudprovider.SSubAccount.
|
||||
type SSubAccount struct {
|
||||
Id string `json:"id"`
|
||||
// 若Account不为空,可不传
|
||||
Name string `json:"name"`
|
||||
// 描述信息
|
||||
Desc string `json:"desc"`
|
||||
// 输入必填,若为空,需要指定子账号名称
|
||||
Account string `json:"account"`
|
||||
HealthStatus string `json:"health_status"`
|
||||
@@ -144,9 +294,11 @@ type ServerVncOutput struct {
|
||||
HostId string `json:"host_id"`
|
||||
Zone string `json:"zone"`
|
||||
// kvm host ip
|
||||
Host string `json:"host"`
|
||||
Protocol string `json:"protocol"`
|
||||
Port int64 `json:"port"`
|
||||
Host string `json:"host"`
|
||||
Protocol string `json:"protocol"`
|
||||
Port int64 `json:"port"`
|
||||
// volcengine
|
||||
Region string `json:"region"`
|
||||
Url string `json:"url"`
|
||||
InstanceId string `json:"instance_id"`
|
||||
InstanceName string `json:"instance_name"`
|
||||
@@ -163,7 +315,7 @@ type ServerVncOutput struct {
|
||||
// SubAccounts is an autogenerated struct via yunion.io/x/cloudmux/pkg/cloudprovider.SubAccounts.
|
||||
type SubAccounts struct {
|
||||
// 若输出则是全量子账号列表,若输入,代表允许同步的子账号
|
||||
Accounts []cloudprovider.SSubAccount `json:"accounts"`
|
||||
Accounts []SSubAccount `json:"accounts"`
|
||||
// 若输出是云账号查询到的区域列表,若输入,代表允许同步的区域
|
||||
Cloudregions []struct {
|
||||
Id string
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
//go:build !ignore_autogenerated
|
||||
// +build !ignore_autogenerated
|
||||
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
// Code generated by swagger-gen. DO NOT EDIT.
|
||||
|
||||
package cloudprovider
|
||||
@@ -135,6 +135,10 @@ type DiskConfig struct {
|
||||
// requried: false
|
||||
Fs string `json:"fs"`
|
||||
|
||||
// 关机后自动重置磁盘
|
||||
// required: false
|
||||
AutoReset bool `json:"auto_reset"`
|
||||
|
||||
// 磁盘存储格式
|
||||
// enum: qcow2, raw, docker, iso, vmdk, vmdkflatver1, vmdkflatver2, vmdkflat, vmdksparse, vmdksparsever1, vmdksparsever2, vmdksepsparse vhd
|
||||
// requried: false
|
||||
@@ -256,6 +260,21 @@ type BaremetalDiskConfig struct {
|
||||
Direct *bool `json:"direct,omitempty"`
|
||||
}
|
||||
|
||||
type RootDiskMatcherSizeMBRange struct {
|
||||
Start int64 `json:"start"`
|
||||
End int64 `json:"end"`
|
||||
}
|
||||
|
||||
const (
|
||||
BAREMETAL_SERVER_METATA_ROOT_DISK_MATCHER = "baremetal_root_disk_matcher"
|
||||
)
|
||||
|
||||
type BaremetalRootDiskMatcher struct {
|
||||
Device string `json:"device"`
|
||||
SizeMB int64 `json:"size_mb"`
|
||||
SizeMBRange *RootDiskMatcherSizeMBRange `json:"size_mb_range"`
|
||||
}
|
||||
|
||||
type ServerConfigs struct {
|
||||
// 调度使用指定的云账号
|
||||
PreferManager string `json:"prefer_manager_id"`
|
||||
@@ -348,6 +367,9 @@ type ServerConfigs struct {
|
||||
// 裸金属磁盘配置列表
|
||||
BaremetalDiskConfigs []*BaremetalDiskConfig `json:"baremetal_disk_configs"`
|
||||
|
||||
// 裸金属系统盘匹配器
|
||||
BaremetalRootDiskMatcher *BaremetalRootDiskMatcher `json:"baremetal_root_disk_matcher"`
|
||||
|
||||
// 主机组列表, 参数可以是主机组名称或ID,建议使用ID
|
||||
InstanceGroupIds []string `json:"groups"`
|
||||
|
||||
|
||||
@@ -80,6 +80,11 @@ type BackupStorageDetails struct {
|
||||
|
||||
type BackupStorageListInput struct {
|
||||
apis.EnabledStatusInfrasResourceBaseListInput
|
||||
|
||||
// filter by server_id
|
||||
ServerId string `json:"server_id"`
|
||||
// filter by disk_id
|
||||
DiskId string `json:"disk_id"`
|
||||
}
|
||||
|
||||
type DiskBackupListInput struct {
|
||||
@@ -109,6 +114,8 @@ type DiskBackupDetails struct {
|
||||
BackupStorageName string `json:"backup_storage_name"`
|
||||
// description: 是否是子备份
|
||||
IsSubBackup bool `json:"is_sub_backup"`
|
||||
|
||||
SDiskBackup
|
||||
}
|
||||
|
||||
type DiskBackupCreateInput struct {
|
||||
|
||||
47
pkg/apis/compute/backup_storages.go
Normal file
47
pkg/apis/compute/backup_storages.go
Normal file
@@ -0,0 +1,47 @@
|
||||
// Copyright 2019 Yunion
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package compute
|
||||
|
||||
type BackupstorageResourceInput struct {
|
||||
// 备份存储(ID或Name)
|
||||
BackupstorageId string `json:"backupstorage_id"`
|
||||
// swagger:ignore
|
||||
// Deprecated
|
||||
// filter by backupstorage_id
|
||||
Backupstorage string `json:"backupstorage" yunion-deprecated-by:"backupstorage_id"`
|
||||
}
|
||||
|
||||
type BackupstorageFilterListInputBase struct {
|
||||
BackupstorageResourceInput
|
||||
|
||||
// 以备份存储名称排序
|
||||
// pattern:asc|desc
|
||||
OrderByBackupstorage string `json:"order_by_backupstorage"`
|
||||
}
|
||||
|
||||
type BackupstorageResourceInfo struct {
|
||||
// 备份存储名称
|
||||
Backupstorage string `json:"backupstorage"`
|
||||
|
||||
// 备份存储类型
|
||||
BackupstorageType string `json:"backupstorage_type"`
|
||||
|
||||
// 备份存储状态
|
||||
BackupstorageStatus string `json:"backupstorage_status"`
|
||||
}
|
||||
|
||||
type BackupstorageFilterListInput struct {
|
||||
BackupstorageFilterListInputBase
|
||||
}
|
||||
15
pkg/apis/compute/baremetal/doc.go
Normal file
15
pkg/apis/compute/baremetal/doc.go
Normal file
@@ -0,0 +1,15 @@
|
||||
// Copyright 2019 Yunion
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package baremetal // import "yunion.io/x/onecloud/pkg/apis/compute/baremetal"
|
||||
165
pkg/apis/compute/baremetal/profiles.go
Normal file
165
pkg/apis/compute/baremetal/profiles.go
Normal file
@@ -0,0 +1,165 @@
|
||||
// Copyright 2019 Yunion
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package baremetal
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/apis"
|
||||
"yunion.io/x/onecloud/pkg/cloudcommon/types"
|
||||
)
|
||||
|
||||
const (
|
||||
DefaultBaremetalProfileId = "default"
|
||||
)
|
||||
|
||||
type BaremetalProfileListInput struct {
|
||||
apis.StandaloneAnonResourceListInput
|
||||
|
||||
OemName []string `json:"oem_name"`
|
||||
Model []string `json:"model"`
|
||||
}
|
||||
|
||||
func (input *BaremetalProfileListInput) Normalize() {
|
||||
for i := range input.OemName {
|
||||
input.OemName[i] = strings.TrimSpace(input.OemName[i])
|
||||
}
|
||||
for i := range input.Model {
|
||||
input.Model[i] = strings.TrimSpace(input.Model[i])
|
||||
}
|
||||
}
|
||||
|
||||
type BaremetalProfileCreateInput struct {
|
||||
apis.StandaloneAnonResourceCreateInput
|
||||
|
||||
OemName string
|
||||
Model string
|
||||
LanChannel uint8
|
||||
RootId int
|
||||
RootName string
|
||||
StrongPass bool
|
||||
}
|
||||
|
||||
type BaremetalProfileUpdateInput struct {
|
||||
apis.StandaloneAnonResourceBaseUpdateInput
|
||||
|
||||
LanChannel uint8
|
||||
RootId *int
|
||||
RootName string
|
||||
StrongPass *bool
|
||||
}
|
||||
|
||||
type BaremetalProfileDetails struct {
|
||||
SBaremetalProfile
|
||||
}
|
||||
|
||||
func (detail BaremetalProfileDetails) ToSpec() BaremetalProfileSpec {
|
||||
channels := make([]uint8, 0)
|
||||
if detail.LanChannel > 0 {
|
||||
channels = append(channels, detail.LanChannel)
|
||||
}
|
||||
if detail.LanChannel2 > 0 {
|
||||
channels = append(channels, detail.LanChannel2)
|
||||
}
|
||||
if detail.LanChannel3 > 0 {
|
||||
channels = append(channels, detail.LanChannel3)
|
||||
}
|
||||
return BaremetalProfileSpec{
|
||||
OemName: detail.OemName,
|
||||
Model: detail.Model,
|
||||
LanChannels: channels,
|
||||
RootName: detail.RootName,
|
||||
RootId: detail.RootId,
|
||||
StrongPass: detail.StrongPass,
|
||||
}
|
||||
}
|
||||
|
||||
type BaremetalProfileSpec struct {
|
||||
OemName string
|
||||
Model string
|
||||
LanChannels []uint8
|
||||
RootName string
|
||||
RootId int
|
||||
StrongPass bool
|
||||
}
|
||||
|
||||
type BaremetalProfileSpecs []BaremetalProfileSpec
|
||||
|
||||
func (a BaremetalProfileSpecs) Len() int { return len(a) }
|
||||
func (a BaremetalProfileSpecs) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
|
||||
func (a BaremetalProfileSpecs) Less(i, j int) bool {
|
||||
if a[i].OemName != a[j].OemName {
|
||||
return a[i].OemName < a[j].OemName
|
||||
}
|
||||
if a[i].Model != a[j].Model {
|
||||
return a[i].Model < a[j].Model
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
var PredefinedProfiles = []BaremetalProfileSpec{
|
||||
{
|
||||
OemName: "",
|
||||
LanChannels: []uint8{1, 2, 8},
|
||||
RootName: "root",
|
||||
RootId: 2,
|
||||
},
|
||||
{
|
||||
OemName: types.OEM_NAME_INSPUR,
|
||||
LanChannels: []uint8{8, 1},
|
||||
RootName: "admin",
|
||||
RootId: 2,
|
||||
},
|
||||
{
|
||||
OemName: types.OEM_NAME_LENOVO,
|
||||
LanChannels: []uint8{1, 8},
|
||||
RootName: "root",
|
||||
RootId: 2,
|
||||
},
|
||||
{
|
||||
OemName: types.OEM_NAME_HP,
|
||||
LanChannels: []uint8{1, 2},
|
||||
RootName: "root",
|
||||
RootId: 1,
|
||||
},
|
||||
{
|
||||
OemName: types.OEM_NAME_HUAWEI,
|
||||
LanChannels: []uint8{1},
|
||||
RootName: "root",
|
||||
RootId: 2,
|
||||
StrongPass: true,
|
||||
},
|
||||
{
|
||||
OemName: types.OEM_NAME_FOXCONN,
|
||||
LanChannels: []uint8{1},
|
||||
RootName: "root",
|
||||
RootId: 2,
|
||||
StrongPass: true,
|
||||
},
|
||||
{
|
||||
OemName: types.OEM_NAME_QEMU,
|
||||
LanChannels: []uint8{8, 1},
|
||||
RootName: "root",
|
||||
RootId: 2,
|
||||
StrongPass: true,
|
||||
},
|
||||
{
|
||||
OemName: types.OEM_NAME_H3C,
|
||||
LanChannels: []uint8{1},
|
||||
RootName: "root",
|
||||
RootId: 2,
|
||||
StrongPass: true,
|
||||
},
|
||||
}
|
||||
36
pkg/apis/compute/baremetal/zz_generated.model.go
Normal file
36
pkg/apis/compute/baremetal/zz_generated.model.go
Normal file
@@ -0,0 +1,36 @@
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
// Code generated by model-api-gen. DO NOT EDIT.
|
||||
|
||||
package baremetal
|
||||
|
||||
import (
|
||||
"yunion.io/x/onecloud/pkg/apis"
|
||||
)
|
||||
|
||||
// SBaremetalProfile is an autogenerated struct via yunion.io/x/onecloud/pkg/compute/models/baremetal.SBaremetalProfile.
|
||||
type SBaremetalProfile struct {
|
||||
apis.SStandaloneAnonResourceBase
|
||||
// 品牌名称(English)
|
||||
OemName string `json:"oem_name"`
|
||||
Model string `json:"model"`
|
||||
LanChannel byte `json:"lan_channel"`
|
||||
LanChannel2 byte `json:"lan_channel2"`
|
||||
LanChannel3 byte `json:"lan_channel3"`
|
||||
// BMC Root账号名称,默认为 root
|
||||
RootName string `json:"root_name"`
|
||||
// BMC Root账号ID,默认为 2
|
||||
RootId int `json:"root_id"`
|
||||
// 是否要求强密码
|
||||
StrongPass bool `json:"strong_pass"`
|
||||
}
|
||||
@@ -80,7 +80,7 @@ func (self BucketDetails) GetMetricTags() map[string]string {
|
||||
"tenant_id": self.ProjectId,
|
||||
"external_id": self.ExternalId,
|
||||
}
|
||||
return ret
|
||||
return AppendMetricTags(ret, self.MetadataResourceInfo, self.ProjectizedResourceInfo)
|
||||
}
|
||||
|
||||
func (self BucketDetails) GetMetricPairs() map[string]string {
|
||||
|
||||
@@ -137,6 +137,7 @@ type CloudaccountResourceInfo struct {
|
||||
AccountStatus string `json:"account_status,omitempty"`
|
||||
// 云账号监控状态
|
||||
AccountHealthStatus string `json:"account_health_status,omitempty"`
|
||||
AccountReadOnly bool `json:"account_read_only,omitempty"`
|
||||
}
|
||||
|
||||
type CloudaccountCreateInput struct {
|
||||
@@ -259,6 +260,8 @@ type CloudaccountListInput struct {
|
||||
// 账号健康状态
|
||||
HealthStatus []string `json:"health_status"`
|
||||
|
||||
ReadOnly *bool `json:"read_only"`
|
||||
|
||||
// 共享模式
|
||||
ShareMode []string `json:"share_mode"`
|
||||
|
||||
@@ -370,7 +373,7 @@ func (self CloudaccountDetail) GetMetricTags() map[string]string {
|
||||
"project_domain": self.ProjectDomain,
|
||||
"currency": self.Currency,
|
||||
}
|
||||
return ret
|
||||
return AppendMetricTags(ret, self.MetadataResourceInfo, self.ProjectizedResourceInfo)
|
||||
}
|
||||
|
||||
func (self CloudaccountDetail) GetMetricPairs() map[string]string {
|
||||
|
||||
@@ -115,6 +115,18 @@ var (
|
||||
CLOUD_PROVIDER_INCLOUD_SPHERE, CLOUD_PROVIDER_PROXMOX, CLOUD_PROVIDER_REMOTEFILE,
|
||||
CLOUD_PROVIDER_H3C,
|
||||
}
|
||||
PUBLIC_CLOUD_PROVIDERS = []string{
|
||||
CLOUD_PROVIDER_ALIYUN,
|
||||
CLOUD_PROVIDER_AWS,
|
||||
CLOUD_PROVIDER_AZURE,
|
||||
CLOUD_PROVIDER_CTYUN,
|
||||
CLOUD_PROVIDER_ECLOUD,
|
||||
CLOUD_PROVIDER_HUAWEI,
|
||||
CLOUD_PROVIDER_QCLOUD,
|
||||
CLOUD_PROVIDER_UCLOUD,
|
||||
CLOUD_PROVIDER_GOOGLE,
|
||||
CLOUD_PROVIDER_JDCLOUD,
|
||||
}
|
||||
|
||||
CLOUD_PROVIDERS = []string{
|
||||
CLOUD_PROVIDER_ONECLOUD,
|
||||
|
||||
@@ -255,6 +255,8 @@ type CloudproviderListInput struct {
|
||||
|
||||
SyncableBaseResourceListInput
|
||||
|
||||
ReadOnly *bool `json:"read_only"`
|
||||
|
||||
// 账号健康状态
|
||||
HealthStatus []string `json:"health_status"`
|
||||
|
||||
|
||||
@@ -345,7 +345,8 @@ func (self DBInstanceDetails) GetMetricTags() map[string]string {
|
||||
if len(self.IpAddrs) > 0 {
|
||||
ret["rds_ip"] = strings.ReplaceAll(self.IpAddrs, ",", "|")
|
||||
}
|
||||
return ret
|
||||
|
||||
return AppendMetricTags(ret, self.MetadataResourceInfo, self.ProjectizedResourceInfo)
|
||||
}
|
||||
|
||||
func (self DBInstanceDetails) GetMetricPairs() map[string]string {
|
||||
|
||||
@@ -160,6 +160,9 @@ type DiskListInput struct {
|
||||
// swagger:ignore
|
||||
// Deprecated
|
||||
Snapshot string `json:"snapshot" yunion-deprecated-by:"snapshot_id"`
|
||||
|
||||
// 根据虚拟机状态过滤
|
||||
GuestStatus string `json:"guest_status"`
|
||||
}
|
||||
|
||||
type DiskResourceInput struct {
|
||||
@@ -230,11 +233,6 @@ type DiskDetails struct {
|
||||
|
||||
// 自动快照策略
|
||||
Snapshotpolicies []SimpleSnapshotPolicy `json:"snapshotpolicies"`
|
||||
|
||||
// 手动快照数量
|
||||
ManualSnapshotCount int `json:"manual_snapshot_count"`
|
||||
// 最多可创建手动快照数量
|
||||
MaxManualSnapshotCount int `json:"max_manual_snapshot_count"`
|
||||
}
|
||||
|
||||
type DiskResourceInfoBase struct {
|
||||
@@ -259,6 +257,8 @@ type DiskUpdateInput struct {
|
||||
|
||||
// 磁盘类型
|
||||
DiskType string `json:"disk_type"`
|
||||
// 关机自动重置
|
||||
AutoReset *bool `json:"auto_reset"`
|
||||
}
|
||||
|
||||
type DiskSaveInput struct {
|
||||
|
||||
@@ -66,7 +66,10 @@ const (
|
||||
DISK_EXIST = "exist"
|
||||
)
|
||||
|
||||
const DISK_META_EXISTING_PATH = "disk_existing_path"
|
||||
const (
|
||||
DISK_META_EXISTING_PATH = "disk_existing_path"
|
||||
DISK_META_LAST_ATTACHED_HOST = "__disk_last_attached_host"
|
||||
)
|
||||
|
||||
const (
|
||||
DISK_DRIVER_VIRTIO = "virtio"
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
// Copyright 2019 Yunion
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package compute
|
||||
|
||||
import "yunion.io/x/onecloud/pkg/apis"
|
||||
|
||||
const (
|
||||
DNS_ZONE_CACHE_STATUS_DELETING = "deleting"
|
||||
DNS_ZONE_CACHE_STATUS_DELETE_FAILED = "delete_failed"
|
||||
DNS_ZONE_CACHE_STATUS_CREATING = "creating"
|
||||
DNS_ZONE_CACHE_STATUS_CREATE_FAILED = "create_failed"
|
||||
DNS_ZONE_CACHE_STATUS_AVAILABLE = "available"
|
||||
DNS_ZONE_CACHE_STATUS_UNKNOWN = "unknown"
|
||||
)
|
||||
|
||||
type DnsZoneCacheCreateInput struct {
|
||||
}
|
||||
|
||||
type DnsZoneCacheDetails struct {
|
||||
apis.StatusStandaloneResourceDetails
|
||||
SDnsZoneCache
|
||||
|
||||
Account string
|
||||
Brand string
|
||||
Provider string
|
||||
}
|
||||
|
||||
type DnsZoneCacheListInput struct {
|
||||
apis.StatusStandaloneResourceListInput
|
||||
|
||||
DnsZoneFilterListBase
|
||||
|
||||
CloudaccountId string `json:"cloudaccount_id"`
|
||||
}
|
||||
@@ -57,7 +57,7 @@ func (self ElasticcacheDetails) GetMetricTags() map[string]string {
|
||||
"project_domain": self.ProjectDomain,
|
||||
"external_id": self.ExternalId,
|
||||
}
|
||||
return ret
|
||||
return AppendMetricTags(ret, self.MetadataResourceInfo, self.ProjectizedResourceInfo)
|
||||
}
|
||||
|
||||
func (self ElasticcacheDetails) GetMetricPairs() map[string]string {
|
||||
|
||||
@@ -113,7 +113,7 @@ func (self ElasticipDetails) GetMetricTags() map[string]string {
|
||||
"ip_addr": self.IpAddr,
|
||||
"external_id": self.ExternalId,
|
||||
}
|
||||
return ret
|
||||
return AppendMetricTags(ret, self.MetadataResourceInfo, self.ProjectizedResourceInfo)
|
||||
}
|
||||
|
||||
type ElasticipSyncstatusInput struct {
|
||||
|
||||
@@ -45,6 +45,12 @@ const (
|
||||
VM_DETACH_DISK = "detach_disk"
|
||||
VM_UNSYNC = "unsync"
|
||||
|
||||
VM_START_RESCUE = "start_rescue"
|
||||
VM_RESCUING = "rescuing"
|
||||
VM_STOP_RESCUE = "stop_rescue"
|
||||
VM_START_RESCUE_FAILED = "start_rescue_failed"
|
||||
VM_STOP_RESCUE_FAILED = "stop_rescue_failed"
|
||||
|
||||
VM_BACKUP_STARTING = "backup_starting"
|
||||
VM_BACKUP_STOPING = "backup_stopping"
|
||||
VM_BACKUP_CREATING = "backup_creating"
|
||||
@@ -166,6 +172,7 @@ const (
|
||||
VM_QGA_SET_PASSWORD = "qga_set_password"
|
||||
VM_QGA_COMMAND_EXECUTING = "qga_command_executing"
|
||||
VM_QGA_EXEC_COMMAND_FAILED = "qga_exec_command_failed"
|
||||
VM_QGA_SYNC_OS_INFO = "qga_sync_os_info"
|
||||
|
||||
VM_QGA_SET_NETWORK = "qga_set_network"
|
||||
VM_QGA_SET_NETWORK_FAILED = "qga_set_network_failed"
|
||||
@@ -384,18 +391,23 @@ const (
|
||||
VM_AZURE_DEFAULT_LOGIN_USER = compute.VM_AZURE_DEFAULT_LOGIN_USER
|
||||
VM_ZSTACK_DEFAULT_LOGIN_USER = compute.VM_ZSTACK_DEFAULT_LOGIN_USER
|
||||
|
||||
VM_METADATA_APP_TAGS = "app_tags"
|
||||
VM_METADATA_CREATE_PARAMS = "create_params"
|
||||
VM_METADATA_LOGIN_ACCOUNT = "login_account"
|
||||
VM_METADATA_LOGIN_KEY = "login_key"
|
||||
VM_METADATA_LAST_LOGIN_KEY = "last_login_key"
|
||||
VM_METADATA_LOGIN_KEY_TIMESTAMP = "login_key_timestamp"
|
||||
VM_METADATA_OS_ARCH = "os_arch"
|
||||
VM_METADATA_OS_DISTRO = "os_distribution"
|
||||
VM_METADATA_OS_NAME = "os_name"
|
||||
VM_METADATA_OS_VERSION = "os_version"
|
||||
VM_METADATA_CGROUP_CPUSET = "cgroup_cpuset"
|
||||
VM_METADATA_ENABLE_MEMCLEAN = "enable_memclean"
|
||||
VM_METADATA_APP_TAGS = "app_tags"
|
||||
VM_METADATA_CREATE_PARAMS = "create_params"
|
||||
VM_METADATA_LOGIN_ACCOUNT = "login_account"
|
||||
VM_METADATA_LOGIN_KEY = "login_key"
|
||||
VM_METADATA_LAST_LOGIN_KEY = "last_login_key"
|
||||
VM_METADATA_LOGIN_KEY_TIMESTAMP = "login_key_timestamp"
|
||||
VM_METADATA_OS_ARCH = "os_arch"
|
||||
VM_METADATA_OS_DISTRO = "os_distribution"
|
||||
VM_METADATA_OS_NAME = "os_name"
|
||||
VM_METADATA_OS_VERSION = "os_version"
|
||||
VM_METADATA_CGROUP_CPUSET = "cgroup_cpuset"
|
||||
VM_METADATA_ENABLE_MEMCLEAN = "enable_memclean"
|
||||
VM_METADATA_HOTPLUG_CPU_MEM = "hotplug_cpu_mem"
|
||||
VM_METADATA_HOT_REMOVE_NIC = "hot_remove_nic"
|
||||
VM_METADATA_START_VMEM_MB = "start_vmem_mb"
|
||||
VM_METADATA_START_VCPU_COUNT = "start_vcpu_count"
|
||||
VM_METADATA_DISABLE_AUTO_MERGE_SNAPSHOT = "disable_auto_merge_snapshot"
|
||||
)
|
||||
|
||||
func Hypervisors2HostTypes(hypervisors []string) []string {
|
||||
|
||||
@@ -34,6 +34,8 @@ type GuestDiskDetails struct {
|
||||
// 磁盘类型
|
||||
// example: data
|
||||
DiskType string `json:"disk_type"`
|
||||
// 关机自动重置
|
||||
AutoReset bool `json:"auto_reset"`
|
||||
// 介质类型
|
||||
// example: ssd
|
||||
MediumType string `json:"medium_type"`
|
||||
@@ -90,6 +92,7 @@ type GuestdiskJsonDesc struct {
|
||||
Dev string `json:"dev"`
|
||||
IsSSD bool `json:"is_ssd"`
|
||||
NumQueues uint8 `json:"num_queues"`
|
||||
AutoReset bool `json:"auto_reset"`
|
||||
|
||||
// esxi
|
||||
ImageInfo struct {
|
||||
|
||||
28
pkg/apis/compute/guest_rescue.go
Normal file
28
pkg/apis/compute/guest_rescue.go
Normal file
@@ -0,0 +1,28 @@
|
||||
// Copyright 2019 Yunion
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package compute
|
||||
|
||||
// Rescue constants are used for rescue mode
|
||||
const (
|
||||
GUEST_RESCUE_RELATIVE_PATH = "rescue" // serverxxx/rescue
|
||||
|
||||
GUEST_RESCUE_INITRAMFS = "initramfs"
|
||||
GUEST_RESCUE_KERNEL = "kernel"
|
||||
GUEST_RESCUE_INITRAMFS_ARM64 = "initramfs_aarch64"
|
||||
GUEST_RESCUE_KERNEL_ARM64 = "kernel_aarch64"
|
||||
|
||||
GUEST_RESCUE_SYS_DISK_NAME = "sys_img"
|
||||
GUEST_RESCUE_SYS_DISK_SIZE = 500 // MB
|
||||
)
|
||||
@@ -109,6 +109,8 @@ type GuestnetworkBaseDesc struct {
|
||||
} `json:"vpc"`
|
||||
|
||||
Networkaddresses jsonutils.JSONObject `json:"networkaddresses"`
|
||||
|
||||
VirtualIps []string `json:"virtual_ips"`
|
||||
}
|
||||
|
||||
type GuestnetworkJsonDesc struct {
|
||||
@@ -118,10 +120,9 @@ type GuestnetworkJsonDesc struct {
|
||||
NumQueues int `json:"num_queues"`
|
||||
Vectors *int `json:"vectors"`
|
||||
|
||||
VirtualIps []string `json:"virtual_ips"`
|
||||
ExternalId string `json:"external_id"`
|
||||
TeamWith string `json:"team_with"`
|
||||
Manual *bool `json:"manual"`
|
||||
ExternalId string `json:"external_id"`
|
||||
TeamWith string `json:"team_with"`
|
||||
Manual *bool `json:"manual"`
|
||||
|
||||
UpscriptPath string `json:"upscript_path"`
|
||||
DownscriptPath string `json:"downscript_path"`
|
||||
@@ -136,4 +137,6 @@ type GuestnetworkJsonDesc struct {
|
||||
type SNicTrafficRecord struct {
|
||||
RxTraffic int64
|
||||
TxTraffic int64
|
||||
|
||||
HasBeenSetDown bool
|
||||
}
|
||||
|
||||
@@ -16,7 +16,6 @@ package compute
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"yunion.io/x/jsonutils"
|
||||
@@ -24,7 +23,6 @@ import (
|
||||
|
||||
"yunion.io/x/onecloud/pkg/apis"
|
||||
"yunion.io/x/onecloud/pkg/apis/billing"
|
||||
"yunion.io/x/onecloud/pkg/apis/cloudcommon/db"
|
||||
imageapi "yunion.io/x/onecloud/pkg/apis/image"
|
||||
"yunion.io/x/onecloud/pkg/httperrors"
|
||||
)
|
||||
@@ -75,6 +73,8 @@ type ServerListInput struct {
|
||||
// 列出操作系统为指定值的主机
|
||||
// enum: linux,windows,vmware
|
||||
OsType []string `json:"os_type"`
|
||||
// 操作系统发行版
|
||||
OsDist []string `json:"os_dist"`
|
||||
|
||||
// 对列表结果按照磁盘大小进行排序
|
||||
// enum: asc,desc
|
||||
@@ -124,6 +124,9 @@ type ServerListInput struct {
|
||||
|
||||
InstanceType []string `json:"instance_type"`
|
||||
|
||||
// 根据镜像发行版排序
|
||||
OrderByOsDist string `json:"order_by_os_dist"`
|
||||
|
||||
// 是否调度到宿主机上
|
||||
WithHost *bool `json:"with_host"`
|
||||
}
|
||||
@@ -187,18 +190,11 @@ type ServerDetails struct {
|
||||
// 系统管理员可见的安全组规则
|
||||
AdminSecurityRules string `json:"admin_security_rules"`
|
||||
|
||||
// list
|
||||
AttachTime time.Time `json:"attach_time"`
|
||||
|
||||
// common
|
||||
IsPrepaidRecycle bool `json:"is_prepaid_recycle"`
|
||||
|
||||
// 备份主机所在宿主机名称
|
||||
BackupHostName string `json:"backup_host_name"`
|
||||
// 备份主机所在宿主机状态
|
||||
BackupHostStatus string `json:"backup_host_status"`
|
||||
// 主备机同步状态
|
||||
BackupGuestSyncStatus string `json:"backup_guest_sync_status"`
|
||||
// 主备机信息
|
||||
BackupInfo
|
||||
|
||||
// 是否可以回收
|
||||
CanRecycle bool `json:"can_recycle"`
|
||||
@@ -268,6 +264,15 @@ type ServerDetails struct {
|
||||
MonitorUrl string `json:"monitor_url"`
|
||||
}
|
||||
|
||||
type BackupInfo struct {
|
||||
// 备份主机所在宿主机名称
|
||||
BackupHostName string `json:"backup_host_name"`
|
||||
// 备份主机所在宿主机状态
|
||||
BackupHostStatus string `json:"backup_host_status"`
|
||||
// 主备机同步状态
|
||||
BackupGuestSyncStatus string `json:"backup_guest_sync_status"`
|
||||
}
|
||||
|
||||
type Floppy struct {
|
||||
Ordinal int `json:"ordinal"`
|
||||
Detail string `json:"detail"`
|
||||
@@ -279,6 +284,22 @@ type Cdrom struct {
|
||||
BootIndex int8 `json:"boot_index"`
|
||||
}
|
||||
|
||||
type IMetricResource interface {
|
||||
GetMetricTags() map[string]string
|
||||
}
|
||||
|
||||
func AppendMetricTags(ret map[string]string, res ...IMetricResource) map[string]string {
|
||||
if ret == nil {
|
||||
ret = map[string]string{}
|
||||
}
|
||||
for _, r := range res {
|
||||
for k, v := range r.GetMetricTags() {
|
||||
ret[k] = v
|
||||
}
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
||||
func (self ServerDetails) GetMetricTags() map[string]string {
|
||||
ret := map[string]string{
|
||||
"id": self.Id,
|
||||
@@ -307,15 +328,8 @@ func (self ServerDetails) GetMetricTags() map[string]string {
|
||||
"account_id": self.AccountId,
|
||||
"external_id": self.ExternalId,
|
||||
}
|
||||
for k, v := range self.Metadata {
|
||||
if strings.HasPrefix(k, db.USER_TAG_PREFIX) {
|
||||
if strings.Contains(k, "login_key") || strings.Contains(v, "=") {
|
||||
continue
|
||||
}
|
||||
ret[k] = v
|
||||
}
|
||||
}
|
||||
return ret
|
||||
|
||||
return AppendMetricTags(ret, self.MetadataResourceInfo, self.ProjectizedResourceInfo)
|
||||
}
|
||||
|
||||
func (self ServerDetails) GetMetricPairs() map[string]string {
|
||||
@@ -340,6 +354,7 @@ type GuestDiskInfo struct {
|
||||
Driver string `json:"driver"`
|
||||
CacheMode string `json:"cache_mode"`
|
||||
AioMode string `json:"aio_mode"`
|
||||
AutoReset bool `json:"auto_reset"`
|
||||
MediumType string `json:"medium_type"`
|
||||
StorageType string `json:"storage_type"`
|
||||
Iops int `json:"iops"`
|
||||
@@ -593,6 +608,9 @@ type ServerStopInput struct {
|
||||
// 是否强制关机
|
||||
IsForce bool `json:"is_force"`
|
||||
|
||||
// 关机等待时间,如果是强制关机,则等待时间为0,如果不设置,默认为30秒
|
||||
TimeoutSecs int `json:"timeout_secs"`
|
||||
|
||||
// 是否关机停止计费, 若平台不支持停止计费,此参数无作用
|
||||
// 目前仅阿里云,腾讯云此参数生效
|
||||
StopCharging bool `json:"stop_charging"`
|
||||
@@ -716,6 +734,8 @@ type ServerDeployInputBase struct {
|
||||
ResetPassword bool `json:"reset_password"`
|
||||
// 重置指定密码
|
||||
Password string `json:"password"`
|
||||
// swagger: ignore
|
||||
LoginAccount string `json:"login_account"`
|
||||
|
||||
// swagger: ignore
|
||||
Restart bool `json:"restart"`
|
||||
@@ -865,6 +885,8 @@ type GuestJsonDesc struct {
|
||||
EncryptKeyId string `json:"encrypt_key_id,omitempty"`
|
||||
|
||||
IsDaemon bool `json:"is_daemon"`
|
||||
|
||||
LightMode bool `json:"light_mode"`
|
||||
}
|
||||
|
||||
type ServerSetBootIndexInput struct {
|
||||
@@ -912,6 +934,13 @@ type ServerChangeDiskStorageInternalInput struct {
|
||||
CloneDiskCount int `json:"disk_count"`
|
||||
}
|
||||
|
||||
type ServerCopyDiskToStorageInput struct {
|
||||
KeepOriginDisk bool `json:"keep_origin_disk"`
|
||||
GuestRunning bool `json:"guest_running"`
|
||||
CompletedDiskCount int `json:"completed_disk_count"`
|
||||
CloneDiskCount int `json:"disk_count"`
|
||||
}
|
||||
|
||||
type ServerSetExtraOptionInput struct {
|
||||
Key string `json:"key"`
|
||||
Value string `json:"value"`
|
||||
@@ -1115,3 +1144,13 @@ type GuestPerformStartInput struct {
|
||||
// 仅适用于KVM虚拟机
|
||||
QemuVersion string `json:"qemu_version"`
|
||||
}
|
||||
|
||||
type ServerSetOSInfoInput struct {
|
||||
// OS type, e.g.: Linux, Windows
|
||||
Type string `json:"type" help:"OS type, e.g.: Linux, Windows"`
|
||||
// OS distribution, e.g.: CentOS, Ubuntu, Windows Server 2016 Datacenter
|
||||
Distribution string `json:"distribution" help:"OS distribution, e.g.: CentOS, Ubuntu, Windows Server 2016 Datacenter"`
|
||||
// OS version, e.g: 7.9, 22.04, 6.3
|
||||
Version string `json:"version" help:"OS version, e.g.: 7.9, 22.04, 6.3"`
|
||||
Arch string `json:"arch" help:"OS arch, e.g.: x86_64, aarch64"`
|
||||
}
|
||||
|
||||
@@ -69,6 +69,7 @@ type HostListInput struct {
|
||||
|
||||
StorageFilterListInput
|
||||
UsableResourceListInput
|
||||
BackupstorageFilterListInput
|
||||
|
||||
// filter by ResourceType
|
||||
ResourceType string `json:"resource_type"`
|
||||
@@ -253,7 +254,8 @@ func (self HostDetails) GetMetricTags() map[string]string {
|
||||
"account_id": self.AccountId,
|
||||
"external_id": self.ExternalId,
|
||||
}
|
||||
return ret
|
||||
|
||||
return AppendMetricTags(ret, self.MetadataResourceInfo)
|
||||
}
|
||||
|
||||
func (self HostDetails) GetMetricPairs() map[string]string {
|
||||
@@ -284,6 +286,11 @@ type HostResourceInfo struct {
|
||||
// 宿主机状态
|
||||
HostStatus string `json:"host_status"`
|
||||
|
||||
HostResourceType string `json:"host_resource_type"`
|
||||
|
||||
// 宿主机计费类型
|
||||
HostBillingType string `json:"host_billing_type"`
|
||||
|
||||
// 宿主机服务状态`
|
||||
HostServiceStatus string `json:"host_service_status"`
|
||||
|
||||
@@ -396,7 +403,7 @@ type HostIpmiAttributes struct {
|
||||
// presence
|
||||
IpmiPresent *bool `json:"ipmi_present"`
|
||||
// lan channel
|
||||
IpmiLanChannel *int `json:"ipmi_lan_channel"`
|
||||
IpmiLanChannel *uint8 `json:"ipmi_lan_channel"`
|
||||
// verified
|
||||
IpmiVerified *bool `json:"ipmi_verified"`
|
||||
// Redfish API support
|
||||
@@ -497,6 +504,8 @@ type HostUpdateInput struct {
|
||||
|
||||
// 主机启动模式, 可能值位PXE和ISO
|
||||
BootMode string `json:"boot_mode"`
|
||||
|
||||
EnableNumaAllocate *bool `json:"enable_numa_allocate"`
|
||||
}
|
||||
|
||||
type HostOfflineInput struct {
|
||||
@@ -555,3 +564,8 @@ type HostLoginInfoOutput struct {
|
||||
|
||||
type HostPerformStartInput struct {
|
||||
}
|
||||
|
||||
type HostSetCommitBoundInput struct {
|
||||
CpuCmtbound *float32
|
||||
MemCmtbound *float32
|
||||
}
|
||||
|
||||
@@ -15,29 +15,33 @@
|
||||
package compute
|
||||
|
||||
import (
|
||||
"yunion.io/x/jsonutils"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/apis"
|
||||
)
|
||||
|
||||
type DnsTrafficPolicyCreateInput struct {
|
||||
apis.EnabledStatusInfrasResourceBaseCreateInput
|
||||
type HostBackupstorageDetails struct {
|
||||
HostJointResourceDetails
|
||||
|
||||
Provider string `json:"provider"`
|
||||
PolicyType string `json:"policy_type"`
|
||||
PolicyValue string `json:"policy_value"`
|
||||
// 额外参数
|
||||
Options *jsonutils.JSONDict `json:"options"`
|
||||
SHostBackupstorage
|
||||
|
||||
// 存储名称
|
||||
Backupstorage string `json:"backupstorage"`
|
||||
// 存储大小
|
||||
CapacityMb int64 `json:"capacity_mb"`
|
||||
// 存储类型
|
||||
// example: local
|
||||
StorageType string `json:"storage_type"`
|
||||
// 是否启用
|
||||
Enabled bool `json:"enabled"`
|
||||
}
|
||||
|
||||
type DnsTrafficPolicyDetails struct {
|
||||
apis.EnabledStatusInfrasResourceBaseDetails
|
||||
SDnsTrafficPolicy
|
||||
type HostBackupstorageListInput struct {
|
||||
HostJointsListInput
|
||||
|
||||
BackupstorageFilterListInput
|
||||
}
|
||||
|
||||
type DnsTrafficPolicyListInput struct {
|
||||
apis.EnabledStatusInfrasResourceBaseListInput
|
||||
|
||||
Provider []string `json:"provider"`
|
||||
PolicyType string `json:"policy_type"`
|
||||
type HostBackupstorageCreateInput struct {
|
||||
apis.JoinResourceBaseCreateInput
|
||||
BackupstorageId string `json:"backupstorage_id"`
|
||||
HostId string `json:"host_id"`
|
||||
}
|
||||
@@ -27,7 +27,8 @@ type HostJointResourceDetailsBase struct {
|
||||
type HostJointResourceDetails struct {
|
||||
apis.JointResourceBaseDetails
|
||||
|
||||
HostJointResourceDetailsBase
|
||||
// HostJointResourceDetailsBase
|
||||
HostResourceInfo
|
||||
}
|
||||
|
||||
type HostJointsListInput struct {
|
||||
|
||||
@@ -115,6 +115,7 @@ type IsolatedDeviceJsonDesc struct {
|
||||
DiskIndex int8 `json:"disk_index"`
|
||||
NvmeSizeMB int `json:"nvme_size_mb"`
|
||||
MdevId string `json:"mdev_id"`
|
||||
NumaNode int8 `json:"numa_node"`
|
||||
}
|
||||
|
||||
type IsolatedDeviceModelCreateInput struct {
|
||||
@@ -177,4 +178,23 @@ type IsolatedDeviceModelListInput struct {
|
||||
|
||||
// 支持热插拔 HotPluggable
|
||||
HotPluggable bool `json:"hot_pluggable"`
|
||||
|
||||
// 宿主机 Id
|
||||
HostId string `json:"host_id"`
|
||||
}
|
||||
|
||||
type HostIsolatedDeviceModelDetails struct {
|
||||
SHostJointsBase
|
||||
HostJointResourceDetails
|
||||
// 宿主机Id
|
||||
HostId string `json:"host_id"`
|
||||
// 存储Id
|
||||
IsolatedDeviceModelId string `json:"isolated_device_model_id"`
|
||||
|
||||
Model string
|
||||
VendorId string
|
||||
DeviceId string
|
||||
DevType string
|
||||
HotPluggable bool
|
||||
DisableAutoDetect bool
|
||||
}
|
||||
|
||||
@@ -28,8 +28,6 @@ const (
|
||||
AMD_VENDOR_ID = "1002"
|
||||
)
|
||||
|
||||
const MEAT_PROBED_HOST_COUNT = "probed_host_count"
|
||||
|
||||
var VALID_GPU_TYPES = []string{GPU_HPC_TYPE, GPU_VGA_TYPE}
|
||||
var VALID_ATTACH_TYPES = []string{GPU_HPC_TYPE, GPU_VGA_TYPE, USB_TYPE, SRIOV_VGPU_TYPE, LEGACY_VGPU_TYPE}
|
||||
|
||||
|
||||
@@ -67,7 +67,8 @@ func (self KubeClusterDetails) GetMetricTags() map[string]string {
|
||||
"account_id": self.AccountId,
|
||||
"external_id": self.ExternalId,
|
||||
}
|
||||
return ret
|
||||
|
||||
return AppendMetricTags(ret, self.MetadataResourceInfo)
|
||||
}
|
||||
|
||||
func (self KubeClusterDetails) GetMetricPairs() map[string]string {
|
||||
|
||||
@@ -246,5 +246,5 @@ func (self LoadbalancerDetails) GetMetricTags() map[string]string {
|
||||
"tenant_id": self.ProjectId,
|
||||
"external_id": self.ExternalId,
|
||||
}
|
||||
return ret
|
||||
return AppendMetricTags(ret, self.MetadataResourceInfo, self.ProjectizedResourceInfo)
|
||||
}
|
||||
|
||||
@@ -144,7 +144,7 @@ type LoadbalancerListenerCreateInput struct {
|
||||
HealthCheck string `json:"health_check"`
|
||||
// enum: tcp, udp, http
|
||||
HealthCheckType string `json:"health_check_type"`
|
||||
HealthCheckDomain string `json:"string"`
|
||||
HealthCheckDomain string `json:"health_check_domain"`
|
||||
HealthCheckPath string `json:"health_check_path"`
|
||||
// default: http_2xx,http_3xx
|
||||
HealthCheckHttpCode string `json:"health_check_http_code"`
|
||||
|
||||
@@ -73,7 +73,8 @@ func (self ModelartsPoolDetails) GetMetricTags() map[string]string {
|
||||
"account": self.Account,
|
||||
"external_id": self.ExternalId,
|
||||
}
|
||||
return ret
|
||||
|
||||
return AppendMetricTags(ret, self.MetadataResourceInfo, self.ProjectizedResourceInfo)
|
||||
}
|
||||
|
||||
type ModelartsPoolListInput struct {
|
||||
|
||||
@@ -394,17 +394,17 @@ type NetworkUpdateInput struct {
|
||||
// 接收IP地址
|
||||
GuestIpEnd string `json:"guest_ip_end"`
|
||||
// 掩码
|
||||
GuestIpMask *int8 `json:"guest_ip_mask"`
|
||||
GuestIpMask int8 `json:"guest_ip_mask"`
|
||||
// 网关地址
|
||||
GuestGateway string `json:"guest_gateway"`
|
||||
GuestGateway *string `json:"guest_gateway"`
|
||||
// DNS
|
||||
GuestDns string `json:"guest_dns"`
|
||||
GuestDns *string `json:"guest_dns"`
|
||||
// allow multiple dhcp, seperated by ","
|
||||
GuestDhcp string `json:"guest_dhcp"`
|
||||
GuestDhcp *string `json:"guest_dhcp"`
|
||||
// NTP
|
||||
GuestNtp string `json:"guest_ntp"`
|
||||
GuestNtp *string `json:"guest_ntp"`
|
||||
|
||||
GuestDomain string `json:"guest_domain"`
|
||||
GuestDomain *string `json:"guest_domain"`
|
||||
|
||||
VlanId *int `json:"vlan_id"`
|
||||
|
||||
@@ -425,6 +425,14 @@ type GetNetworkAddressesOutput struct {
|
||||
Addresses []SNetworkUsedAddress `json:"addresses"`
|
||||
}
|
||||
|
||||
type GetNetworkAvailableAddressesInput struct {
|
||||
}
|
||||
|
||||
type GetNetworkAvailableAddressesOutput struct {
|
||||
// IP子网地址记录
|
||||
Addresses []string `json:"addresses"`
|
||||
}
|
||||
|
||||
type NetworkSetBgpTypeInput struct {
|
||||
apis.Meta
|
||||
|
||||
|
||||
@@ -20,10 +20,6 @@ import (
|
||||
"yunion.io/x/cloudmux/pkg/apis/compute"
|
||||
)
|
||||
|
||||
const (
|
||||
DefaultDNSServers = "223.5.5.5,223.6.6.6"
|
||||
)
|
||||
|
||||
const (
|
||||
// # DEFAULT_BANDWIDTH = options.default_bandwidth
|
||||
MAX_BANDWIDTH = 100000
|
||||
|
||||
@@ -71,6 +71,12 @@ type StorageCreateInput struct {
|
||||
// example: 192.168.222.3,192.168.222.4,192.168.222.99
|
||||
RbdMonHost string `json:"rbd_mon_host"`
|
||||
|
||||
// enable ceph messenger v2
|
||||
EnableMessengerV2 *bool `json:"enable_messenger_v2"`
|
||||
|
||||
// rbd storage auto cache glance images
|
||||
AutoCacheImages *bool `json:"auto_cache_images"`
|
||||
|
||||
// swagger:ignore
|
||||
MonHost string
|
||||
|
||||
@@ -104,6 +110,13 @@ type StorageCreateInput struct {
|
||||
// 网络文件系统共享目录, storage_type 为 nfs 时, 此参数必传
|
||||
// example: /nfs_root/
|
||||
NfsSharedDir string `json:"nfs_shared_dir"`
|
||||
|
||||
// CLVM VG Name
|
||||
CLVMVgName string
|
||||
// SLVM VG Name
|
||||
SLVMVgName string
|
||||
MasterHost string
|
||||
Lvmlockd bool
|
||||
}
|
||||
|
||||
type RbdTimeoutInput struct {
|
||||
@@ -177,7 +190,7 @@ func (self StorageDetails) GetMetricTags() map[string]string {
|
||||
"project_domain": self.ProjectDomain,
|
||||
"external_id": self.ExternalId,
|
||||
}
|
||||
return ret
|
||||
return AppendMetricTags(ret, self.MetadataResourceInfo)
|
||||
}
|
||||
|
||||
func (self StorageDetails) GetMetricPairs() map[string]string {
|
||||
@@ -224,10 +237,32 @@ type StorageUpdateInput struct {
|
||||
// example: AQDigB9dtnDAKhAAxS6X4zi4BPR/lIle4nf4Dw==
|
||||
RbdKey string `json:"rbd_key"`
|
||||
|
||||
// enable ceph messenger v2
|
||||
EnableMessengerV2 *bool `json:"enable_messenger_v2"`
|
||||
// rbd storage auto cache glance images
|
||||
AutoCacheImages *bool `json:"auto_cache_images"`
|
||||
|
||||
RbdTimeoutInput
|
||||
|
||||
// swagger:ignore
|
||||
StorageConf *jsonutils.JSONDict
|
||||
|
||||
UpdateStorageConf bool
|
||||
MasterHost string
|
||||
}
|
||||
|
||||
type RbdStorageConf struct {
|
||||
RadosMonOpTimeout int `json:"rados_mon_op_timeout"`
|
||||
RadosOsdOpTimeout int `json:"rados_osd_op_timeout"`
|
||||
ClientMountTimeout int `json:"client_mount_timeout"`
|
||||
|
||||
MonHost string `json:"mon_host"`
|
||||
Pool string `json:"pool"`
|
||||
Key string `json:"key"`
|
||||
EnableMessengerV2 bool `json:"enable_messenger_v2"`
|
||||
AutoCacheImages bool `json:"auto_cache_images"`
|
||||
}
|
||||
|
||||
type StorageSetCmtBoundInput struct {
|
||||
Cmtbound *float32
|
||||
}
|
||||
|
||||
@@ -34,6 +34,8 @@ const (
|
||||
STORAGE_NVME_PT = "nvme_pt" // nvme passthrough
|
||||
STORAGE_NVME = "nvme" // nvme sriov
|
||||
STORAGE_LVM = "lvm"
|
||||
STORAGE_CLVM = "clvm" // clustered lvm
|
||||
STORAGE_SLVM = "slvm" // shared lvm
|
||||
|
||||
STORAGE_PUBLIC_CLOUD = compute.STORAGE_PUBLIC_CLOUD
|
||||
STORAGE_CLOUD_EFFICIENCY = compute.STORAGE_CLOUD_EFFICIENCY
|
||||
@@ -43,6 +45,7 @@ const (
|
||||
STORAGE_CLOUD_ESSD_PL2 = compute.STORAGE_CLOUD_ESSD_PL2 // 单盘最高随机读写IOPS 10万
|
||||
STORAGE_CLOUD_ESSD_PL3 = compute.STORAGE_CLOUD_ESSD_PL3 // 单盘最高随机读写IOPS 100万
|
||||
STORAGE_CLOUD_AUTO = compute.STORAGE_CLOUD_AUTO // ESSD AutoPL
|
||||
STORAGE_CLOUD_ESSD_ENTRY = "cloud_essd_entry" // ESSD Entry云盘
|
||||
STORAGE_EPHEMERAL_SSD = compute.STORAGE_EPHEMERAL_SSD // 单块本地SSD盘, 容量最大不能超过800 GiB
|
||||
STORAGE_LOCAL_HDD_PRO = compute.STORAGE_LOCAL_HDD_PRO // 实例规格族d1ne和d1搭载的SATA HDD本地盘
|
||||
STORAGE_LOCAL_SSD_PRO = compute.STORAGE_LOCAL_SSD_PRO // 实例规格族i2、i2g、i1、ga1和gn5等搭载的NVMe
|
||||
@@ -93,6 +96,7 @@ const (
|
||||
// Zstack storage type
|
||||
STORAGE_ZSTACK_LOCAL_STORAGE = compute.STORAGE_ZSTACK_LOCAL_STORAGE
|
||||
STORAGE_ZSTACK_CEPH = compute.STORAGE_ZSTACK_CEPH
|
||||
STORAGE_ZSTACK_SHARED_BLOCK = compute.STORAGE_ZSTACK_SHARED_BLOCK
|
||||
|
||||
// Google storage type
|
||||
STORAGE_GOOGLE_LOCAL_SSD = compute.STORAGE_GOOGLE_LOCAL_SSD //本地SSD暂存盘 (最多8个)
|
||||
@@ -161,19 +165,20 @@ var (
|
||||
STORAGE_HUAWEI_SSD, STORAGE_HUAWEI_SAS, STORAGE_HUAWEI_SATA,
|
||||
STORAGE_OPENSTACK_ISCSI, STORAGE_UCLOUD_CLOUD_NORMAL, STORAGE_UCLOUD_CLOUD_SSD,
|
||||
STORAGE_UCLOUD_LOCAL_NORMAL, STORAGE_UCLOUD_LOCAL_SSD, STORAGE_UCLOUD_EXCLUSIVE_LOCAL_DISK,
|
||||
STORAGE_ZSTACK_LOCAL_STORAGE, STORAGE_ZSTACK_CEPH, STORAGE_GPFS, STORAGE_CIFS,
|
||||
STORAGE_NVME_PT, STORAGE_NVME, STORAGE_LVM,
|
||||
STORAGE_ZSTACK_LOCAL_STORAGE, STORAGE_ZSTACK_CEPH, STORAGE_ZSTACK_LOCAL_STORAGE, STORAGE_GPFS, STORAGE_CIFS,
|
||||
STORAGE_NVME_PT, STORAGE_NVME, STORAGE_LVM, STORAGE_CLVM, STORAGE_SLVM,
|
||||
}
|
||||
|
||||
HOST_STORAGE_LOCAL_TYPES = []string{STORAGE_LOCAL, STORAGE_BAREMETAL, STORAGE_ZSTACK_LOCAL_STORAGE, STORAGE_OPENSTACK_NOVA}
|
||||
|
||||
STORAGE_LIMITED_TYPES = []string{STORAGE_LOCAL, STORAGE_BAREMETAL, STORAGE_NAS, STORAGE_RBD, STORAGE_NFS, STORAGE_GPFS, STORAGE_VSAN, STORAGE_CIFS}
|
||||
STORAGE_LIMITED_TYPES = []string{STORAGE_LOCAL, STORAGE_BAREMETAL, STORAGE_NAS, STORAGE_RBD,
|
||||
STORAGE_NFS, STORAGE_GPFS, STORAGE_VSAN, STORAGE_CIFS, STORAGE_CLVM, STORAGE_SLVM}
|
||||
|
||||
SHARED_FILE_STORAGE = []string{STORAGE_NFS, STORAGE_GPFS}
|
||||
FIEL_STORAGE = []string{STORAGE_LOCAL, STORAGE_NFS, STORAGE_GPFS}
|
||||
FIEL_STORAGE = []string{STORAGE_LOCAL, STORAGE_NFS, STORAGE_GPFS, STORAGE_LVM, STORAGE_CLVM, STORAGE_SLVM}
|
||||
|
||||
// 目前来说只支持这些
|
||||
SHARED_STORAGE = []string{STORAGE_NFS, STORAGE_GPFS, STORAGE_RBD}
|
||||
// supported shared storage types
|
||||
SHARED_STORAGE = []string{STORAGE_NFS, STORAGE_GPFS, STORAGE_RBD, STORAGE_CLVM, STORAGE_SLVM}
|
||||
)
|
||||
|
||||
func IsDiskTypeMatch(t1, t2 string) bool {
|
||||
@@ -253,4 +258,7 @@ type StorageListInput struct {
|
||||
|
||||
// filter storages of baremetal host
|
||||
IsBaremetal *bool `json:"is_baremetal"`
|
||||
|
||||
// filter by storage type
|
||||
StorageType string `json:"storage_type"`
|
||||
}
|
||||
|
||||
@@ -98,6 +98,26 @@ type StoragecacheResourceInfo struct {
|
||||
|
||||
// 存储缓存名称
|
||||
Storagecache string `json:"storagecache"`
|
||||
|
||||
// 关联存储名称
|
||||
Storages []string `json:"storages"`
|
||||
|
||||
// 关联存储信息
|
||||
StorageInfo []StorageInfo `json:"storage_info"`
|
||||
}
|
||||
|
||||
type StorageInfo struct {
|
||||
Id string `json:"id"`
|
||||
|
||||
Name string `json:"name"`
|
||||
|
||||
StorageType string `json:"storage_type"`
|
||||
|
||||
MediumType string `json:"medium_type"`
|
||||
|
||||
ZoneId string `json:"zone_id"`
|
||||
|
||||
Zone string `json:"zone"`
|
||||
}
|
||||
|
||||
type StoragecacheFilterListInputBase struct {
|
||||
|
||||
@@ -15,12 +15,12 @@
|
||||
package compute
|
||||
|
||||
import (
|
||||
"yunion.io/x/jsonutils"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/apis"
|
||||
)
|
||||
|
||||
type StoragecachedimageDetails struct {
|
||||
SStoragecachedimage
|
||||
|
||||
apis.JointResourceBaseDetails
|
||||
|
||||
StoragecacheResourceInfo
|
||||
@@ -29,15 +29,20 @@ type StoragecachedimageDetails struct {
|
||||
Cachedimage string `json:"cachedimage"`
|
||||
|
||||
// 存储列表
|
||||
Storages []string `json:"storages"`
|
||||
// Storages []string `json:"storages"`
|
||||
// 通过一致性哈希获取的一个宿主机详情
|
||||
Host *jsonutils.JSONDict `json:"host"`
|
||||
// Host *jsonutils.JSONDict `json:"host"`
|
||||
|
||||
// 镜像名称
|
||||
Image string `json:"image"`
|
||||
// 镜像大小
|
||||
Size int64 `json:"size"`
|
||||
// 引用次数
|
||||
Reference int `json:"reference"`
|
||||
// Disk引用次数
|
||||
DiskReference int `json:"disk_reference"`
|
||||
// Cdrom引用次数
|
||||
CdromReference int `json:"cdrom_reference"`
|
||||
}
|
||||
|
||||
type StoragecachedimageListInput struct {
|
||||
|
||||
@@ -17,10 +17,10 @@ package compute
|
||||
import (
|
||||
time "time"
|
||||
|
||||
cloudprovider "yunion.io/x/cloudmux/pkg/cloudprovider"
|
||||
jsonutils "yunion.io/x/jsonutils"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/apis"
|
||||
"yunion.io/x/onecloud/pkg/apis/cloudprovider"
|
||||
)
|
||||
|
||||
// SAccessGroup is an autogenerated struct via yunion.io/x/onecloud/pkg/compute/models.SAccessGroup.
|
||||
@@ -329,6 +329,9 @@ type SCloudprovider struct {
|
||||
CloudaccountId string `json:"cloudaccount_id"`
|
||||
// 云账号的平台信息
|
||||
Provider string `json:"provider"`
|
||||
// 云上同步资源是否在本地被更改过配置, local: 更改过, cloud: 未更改过
|
||||
// example: local
|
||||
ProjectSrc string `json:"project_src"`
|
||||
SProjectMappingResourceBase
|
||||
}
|
||||
|
||||
@@ -352,9 +355,9 @@ type SCloudproviderQuota struct {
|
||||
QuotaRange string `json:"quota_range"`
|
||||
// 已使用的配额
|
||||
// -1代表未从云平台拿到已使用配额信息
|
||||
UsedCount int `json:"used_count"`
|
||||
UsedCount int64 `json:"used_count"`
|
||||
// 最大配额限制
|
||||
MaxCount int `json:"max_count"`
|
||||
MaxCount int64 `json:"max_count"`
|
||||
// 配额类型
|
||||
QuotaType string `json:"quota_type"`
|
||||
}
|
||||
@@ -388,7 +391,6 @@ type SCloudproviderschedtag struct {
|
||||
type SCloudregion struct {
|
||||
apis.SEnabledStatusStandaloneResourceBase
|
||||
SI18nResourceBase
|
||||
SManagedResourceBase
|
||||
apis.SExternalizedResourceBase
|
||||
cloudprovider.SGeographicInfo
|
||||
// 云环境
|
||||
@@ -664,48 +666,29 @@ type SDiskResourceBase struct {
|
||||
DiskId string `json:"disk_id"`
|
||||
}
|
||||
|
||||
// SDnsRecordis an autogenerated struct via yunion.io/x/onecloud/pkg/compute/models.SDnsRecord.
|
||||
// SDnsRecord is an autogenerated struct via yunion.io/x/onecloud/pkg/compute/models.SDnsRecord.
|
||||
type SDnsRecord struct {
|
||||
apis.SEnabledStatusStandaloneResourceBase
|
||||
apis.SExternalizedResourceBase
|
||||
SDnsZoneResourceBase
|
||||
DnsType string `json:"dns_type"`
|
||||
DnsValue string `json:"dns_value"`
|
||||
TTL int64 `json:"ttl"`
|
||||
MxPriority int64 `json:"mx_priority"`
|
||||
}
|
||||
|
||||
// SDnsRecordSetTrafficPolicy is an autogenerated struct via yunion.io/x/onecloud/pkg/compute/models.SDnsRecordSetTrafficPolicy.
|
||||
type SDnsRecordSetTrafficPolicy struct {
|
||||
apis.SJointResourceBase
|
||||
DnsRecordsetId string `json:"dns_recordset_id"`
|
||||
DnsTrafficPolicyId string `json:"dns_traffic_policy_id"`
|
||||
}
|
||||
|
||||
// SDnsTrafficPolicy is an autogenerated struct via yunion.io/x/onecloud/pkg/compute/models.SDnsTrafficPolicy.
|
||||
type SDnsTrafficPolicy struct {
|
||||
apis.SEnabledStatusInfrasResourceBase
|
||||
Provider string `json:"provider"`
|
||||
PolicyType string `json:"policy_type"`
|
||||
PolicyValue string `json:"policy_value"`
|
||||
Options *jsonutils.JSONDict `json:"options"`
|
||||
// 解析线路类型
|
||||
PolicyType string `json:"policy_type"`
|
||||
// 解析线路
|
||||
PolicyValue string `json:"policy_value"`
|
||||
}
|
||||
|
||||
// SDnsZone is an autogenerated struct via yunion.io/x/onecloud/pkg/compute/models.SDnsZone.
|
||||
type SDnsZone struct {
|
||||
apis.SEnabledStatusInfrasResourceBase
|
||||
IsDirty bool `json:"is_dirty"`
|
||||
ZoneType string `json:"zone_type"`
|
||||
Options *jsonutils.JSONDict `json:"options"`
|
||||
}
|
||||
|
||||
// SDnsZoneCache is an autogenerated struct via yunion.io/x/onecloud/pkg/compute/models.SDnsZoneCache.
|
||||
type SDnsZoneCache struct {
|
||||
apis.SStatusStandaloneResourceBase
|
||||
apis.SSharableVirtualResourceBase
|
||||
apis.SEnabledResourceBase
|
||||
apis.SExternalizedResourceBase
|
||||
SDnsZoneResourceBase
|
||||
// 归属云账号ID
|
||||
CloudaccountId string `json:"cloudaccount_id"`
|
||||
ProductType string `json:"product_type"`
|
||||
SManagedResourceBase
|
||||
ZoneType string `json:"zone_type"`
|
||||
ProductType string `json:"product_type"`
|
||||
}
|
||||
|
||||
// SDnsZoneResourceBase is an autogenerated struct via yunion.io/x/onecloud/pkg/compute/models.SDnsZoneResourceBase.
|
||||
@@ -988,6 +971,9 @@ type SExternalProject struct {
|
||||
apis.SVirtualResourceBase
|
||||
apis.SExternalizedResourceBase
|
||||
SManagedResourceBase
|
||||
// 优先级,同一个本地项目映射多个云上项目,优先级高的优先选择
|
||||
// 数值越高,优先级越大
|
||||
Priority int `json:"priority"`
|
||||
ExternalDomainId string `json:"external_domain_id"`
|
||||
// 归属云账号ID
|
||||
CloudaccountId string `json:"cloudaccount_id"`
|
||||
@@ -1133,6 +1119,8 @@ type SGuest struct {
|
||||
QgaStatus string `json:"qga_status"`
|
||||
// power_states limit in [on, off, unknown]
|
||||
PowerStates string `json:"power_states"`
|
||||
// Used for guest rescue
|
||||
RescueMode bool `json:"rescue_mode"`
|
||||
}
|
||||
|
||||
// SGuestJointsBase is an autogenerated struct via yunion.io/x/onecloud/pkg/compute/models.SGuestJointsBase.
|
||||
@@ -1206,6 +1194,12 @@ type SGuestnetwork struct {
|
||||
NumQueues int `json:"num_queues"`
|
||||
// 带宽限制,单位mbps
|
||||
BwLimit int `json:"bw_limit"`
|
||||
// 下行流量限制,单位 bytes
|
||||
RxTrafficLimit int64 `json:"rx_traffic_limit"`
|
||||
RxTrafficUsed int64 `json:"rx_traffic_used"`
|
||||
// 上行流量限制,单位 bytes
|
||||
TxTrafficLimit int64 `json:"tx_traffic_limit"`
|
||||
TxTrafficUsed int64 `json:"tx_traffic_used"`
|
||||
// 网卡序号
|
||||
Index byte `json:"index"`
|
||||
// 是否为虚拟接口(无IP)
|
||||
@@ -1273,9 +1267,10 @@ type SHost struct {
|
||||
// 内存超分比
|
||||
MemCmtbound float32 `json:"mem_cmtbound"`
|
||||
// 页大小
|
||||
PageSizeKB int `json:"page_size_kb"`
|
||||
PageSizeKB int `json:"page_size_kb"`
|
||||
EnableNumaAllocate bool `json:"enable_numa_allocate"`
|
||||
// 存储大小,单位Mb
|
||||
StorageSize int `json:"storage_size"`
|
||||
StorageSize int64 `json:"storage_size"`
|
||||
// 存储类型
|
||||
StorageType string `json:"storage_type"`
|
||||
// 存储驱动类型
|
||||
@@ -1316,6 +1311,24 @@ type SHost struct {
|
||||
UefiInfo jsonutils.JSONObject `json:"uefi_info"`
|
||||
}
|
||||
|
||||
// SHostBackupstorage is an autogenerated struct via yunion.io/x/onecloud/pkg/compute/models.SHostBackupstorage.
|
||||
type SHostBackupstorage struct {
|
||||
SHostJointsBase
|
||||
// 宿主机Id
|
||||
HostId string `json:"host_id"`
|
||||
// 存储Id
|
||||
BackupstorageId string `json:"backupstorage_id"`
|
||||
}
|
||||
|
||||
// SHostIsolatedDeviceModel is an autogenerated struct via yunion.io/x/onecloud/pkg/compute/models.SHostIsolatedDeviceModel.
|
||||
type SHostIsolatedDeviceModel struct {
|
||||
SHostJointsBase
|
||||
// 宿主机Id
|
||||
HostId string `json:"host_id"`
|
||||
// 设备类型Id
|
||||
IsolatedDeviceModelId string `json:"isolated_device_model_id"`
|
||||
}
|
||||
|
||||
// SHostJointsBase is an autogenerated struct via yunion.io/x/onecloud/pkg/compute/models.SHostJointsBase.
|
||||
type SHostJointsBase struct {
|
||||
apis.SJointResourceBase
|
||||
@@ -1516,7 +1529,25 @@ type SIsolatedDevice struct {
|
||||
// guest disk index
|
||||
DiskIndex byte `json:"disk_index"`
|
||||
// # pci address of `Bus:Device.Function` format, or usb bus address of `bus.addr`
|
||||
Addr string `json:"addr"`
|
||||
Addr string `json:"addr"`
|
||||
// Is vgpu physical funcion, That means it cannot be attached to guest
|
||||
// VGPUPhysicalFunction bool `nullable:"true" default:"false" list:"domain" create:"domain_optional"`
|
||||
// nvidia vgpu config
|
||||
// vgpu uuid generated on create
|
||||
MdevId string `json:"mdev_id"`
|
||||
// The frame rate limiter (FRL) configuration in frames per second
|
||||
FRL string `json:"frl"`
|
||||
// The frame buffer size in Mbytes
|
||||
Framebuffer string `json:"framebuffer"`
|
||||
// The maximum resolution per display head, eg: 5120x2880
|
||||
MaxResolution string `json:"max_resolution"`
|
||||
// The maximum number of virtual display heads that the vGPU type supports
|
||||
// In computer graphics and display technology, the term "head" is commonly used to
|
||||
// describe the physical interface of a display device or display output.
|
||||
// It refers to a connection point on the monitor, such as HDMI, DisplayPort, or VGA interface.
|
||||
NumHeads string `json:"num_heads"`
|
||||
// The maximum number of vGPU instances per physical GPU
|
||||
MaxInstance string `json:"max_instance"`
|
||||
VendorDeviceId string `json:"vendor_device_id"`
|
||||
// reserved memory size for isolated device
|
||||
ReservedMemory int `json:"reserved_memory"`
|
||||
@@ -1524,6 +1555,8 @@ type SIsolatedDevice struct {
|
||||
ReservedCpu int `json:"reserved_cpu"`
|
||||
// reserved storage size for isolated device
|
||||
ReservedStorage int `json:"reserved_storage"`
|
||||
// device numa node
|
||||
NumaNode byte `json:"numa_node"`
|
||||
}
|
||||
|
||||
// SIsolatedDeviceModel is an autogenerated struct via yunion.io/x/onecloud/pkg/compute/models.SIsolatedDeviceModel.
|
||||
@@ -1534,6 +1567,8 @@ type SIsolatedDeviceModel struct {
|
||||
DeviceId string `json:"device_id"`
|
||||
DevType string `json:"dev_type"`
|
||||
HotPluggable *bool `json:"hot_pluggable,omitempty"`
|
||||
// Disable auto detect isolated devices on host
|
||||
DisableAutoDetect *bool `json:"disable_auto_detect,omitempty"`
|
||||
}
|
||||
|
||||
// SKafka is an autogenerated struct via yunion.io/x/onecloud/pkg/compute/models.SKafka.
|
||||
@@ -2660,6 +2695,8 @@ type SStorage struct {
|
||||
StorageConf jsonutils.JSONObject `json:"storage_conf"`
|
||||
// 存储缓存Id
|
||||
StoragecacheId string `json:"storagecache_id"`
|
||||
// master host id
|
||||
MasterHost string `json:"master_host"`
|
||||
// indicating whether system disk can be allocated in this storage
|
||||
// 是否可以用作系统盘存储
|
||||
// example: true
|
||||
@@ -2678,6 +2715,8 @@ type SStoragecache struct {
|
||||
SManagedResourceBase
|
||||
// 镜像存储地址
|
||||
Path string `json:"path"`
|
||||
// master host id
|
||||
MasterHost string `json:"master_host"`
|
||||
}
|
||||
|
||||
// SStoragecacheResourceBase is an autogenerated struct via yunion.io/x/onecloud/pkg/compute/models.SStoragecacheResourceBase.
|
||||
|
||||
@@ -36,8 +36,10 @@ const (
|
||||
SERVICE_TYPE_CLOUDMON = "cloudmon"
|
||||
SERVICE_TYPE_VPCAGENT = "vpcagent"
|
||||
|
||||
SERVICE_TYPE_ETCD = "etcd"
|
||||
SERVICE_TYPE_INFLUXDB = "influxdb"
|
||||
SERVICE_TYPE_ETCD = "etcd"
|
||||
SERVICE_TYPE_INFLUXDB = "influxdb"
|
||||
SERVICE_TYPE_NTP = "ntp"
|
||||
SERVICE_TYPE_VICTORIA_METRICS = "victoria-metrics"
|
||||
|
||||
SERVICE_TYPE_SCHEDULEDTASK = "scheduledtask"
|
||||
|
||||
@@ -98,9 +100,9 @@ var (
|
||||
"apigateway",
|
||||
"yunionapi",
|
||||
"billing",
|
||||
"etcd",
|
||||
SERVICE_TYPE_ETCD,
|
||||
"itsm",
|
||||
"ntp",
|
||||
SERVICE_TYPE_NTP,
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@@ -211,6 +211,7 @@ var (
|
||||
"force_dhcp_probe_ipmi",
|
||||
"tftp_block_size_in_bytes",
|
||||
"tftp_max_timeout_retries",
|
||||
"enable_grub_tftp_download",
|
||||
"lengthy_worker_count",
|
||||
"short_worker_count",
|
||||
// "default_ipmi_password",
|
||||
|
||||
@@ -335,7 +335,7 @@ type IdentityProviderListInput struct {
|
||||
|
||||
// 过滤支持SSO的认证源,如果值为all,则列出所有的全局认证源,否则可出sso为域ID的域认证源
|
||||
// example: all
|
||||
SsoDomain string `json:"sso"`
|
||||
SsoDomain string `json:"sso_domain"`
|
||||
|
||||
AutoCreateProject *bool `json:"auto_create_project"`
|
||||
AutoCreateUser *bool `json:"auto_create_user"`
|
||||
|
||||
@@ -307,6 +307,19 @@ type SServiceCertificate struct {
|
||||
CaPrivateKey string `json:"ca_private_key"`
|
||||
}
|
||||
|
||||
// STokenCache is an autogenerated struct via yunion.io/x/onecloud/pkg/keystone/models.STokenCache.
|
||||
type STokenCache struct {
|
||||
apis.SStandaloneAnonResourceBase
|
||||
Valid bool `json:"valid"`
|
||||
Method string `json:"method"`
|
||||
AuditIds string `json:"audit_ids"`
|
||||
UserId string `json:"user_id"`
|
||||
ProjectId string `json:"project_id"`
|
||||
DomainId string `json:"domain_id"`
|
||||
Source string `json:"source"`
|
||||
Ip string `json:"ip"`
|
||||
}
|
||||
|
||||
// SUser is an autogenerated struct via yunion.io/x/onecloud/pkg/keystone/models.SUser.
|
||||
type SUser struct {
|
||||
apis.SRecordChecksumResourceBase
|
||||
|
||||
@@ -93,10 +93,9 @@ type AlertCondition struct {
|
||||
}
|
||||
|
||||
type AlertQuery struct {
|
||||
Model MetricQuery `json:"model"`
|
||||
DataSourceId string `json:"data_source_id"`
|
||||
From string `json:"from"`
|
||||
To string `json:"to"`
|
||||
Model MetricQuery `json:"model"`
|
||||
From string `json:"from"`
|
||||
To string `json:"to"`
|
||||
}
|
||||
|
||||
type AlertCreateInput struct {
|
||||
@@ -156,6 +155,7 @@ type AlertListInput struct {
|
||||
apis.StatusStandaloneResourceListInput
|
||||
// 以报警是否启用/禁用过滤列表
|
||||
// Enabled *bool `json:"enabled"`
|
||||
MonitorResourceId []string `json:"monitor_resource_id"`
|
||||
}
|
||||
|
||||
type AlertDetails struct {
|
||||
@@ -179,12 +179,14 @@ type ResultLogEntry struct {
|
||||
|
||||
// EvalMatch represents the series violating the threshold.
|
||||
type EvalMatch struct {
|
||||
Condition string `json:"condition"`
|
||||
Value *float64 `json:"value"`
|
||||
ValueStr string `json:"value_str"`
|
||||
Metric string `json:"metric"`
|
||||
Tags map[string]string `json:"tags"`
|
||||
Unit string `json:"unit"`
|
||||
Condition string `json:"condition"`
|
||||
Value *float64 `json:"value"`
|
||||
ValueStr string `json:"value_str"`
|
||||
Metric string `json:"metric"`
|
||||
Tags map[string]string `json:"tags"`
|
||||
Unit string `json:"unit"`
|
||||
AlertDetails jsonutils.JSONObject `json:"alert_details"`
|
||||
IsRecovery bool `json:"is_recovery"`
|
||||
}
|
||||
|
||||
type AlertTestRunOutput struct {
|
||||
|
||||
28
pkg/apis/monitor/alertjoint.go
Normal file
28
pkg/apis/monitor/alertjoint.go
Normal file
@@ -0,0 +1,28 @@
|
||||
// Copyright 2019 Yunion
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package monitor
|
||||
|
||||
import "yunion.io/x/onecloud/pkg/apis"
|
||||
|
||||
type AlertJointCreateInput struct {
|
||||
apis.Meta
|
||||
|
||||
AlertId string `json:"alert_id"`
|
||||
}
|
||||
|
||||
type AlertJointListInput struct {
|
||||
apis.JointResourceBaseListInput
|
||||
AlertIds []string `json:"alert_ids"`
|
||||
}
|
||||
@@ -36,12 +36,7 @@ type AlertJointResourceBaseDetails struct {
|
||||
type AlertnotificationDetails struct {
|
||||
AlertJointResourceBaseDetails
|
||||
Notification string `json:"notification"`
|
||||
}
|
||||
|
||||
type AlertJointCreateInput struct {
|
||||
apis.Meta
|
||||
|
||||
AlertId string `json:"alert_id"`
|
||||
Frequency int64 `json:"frequency"`
|
||||
}
|
||||
|
||||
type AlertnotificationCreateInput struct {
|
||||
@@ -51,3 +46,7 @@ type AlertnotificationCreateInput struct {
|
||||
UsedBy string `json:"used_by"`
|
||||
Params jsonutils.JSONObject `json:"params"`
|
||||
}
|
||||
|
||||
type AlertNotificationListInput struct {
|
||||
AlertJointListInput
|
||||
}
|
||||
|
||||
@@ -71,12 +71,12 @@ type AlertRecordCreateInput struct {
|
||||
|
||||
AlertId string `json:"alert_id"`
|
||||
// 报警级别
|
||||
Level string `json:"level"`
|
||||
State string `json:"state"`
|
||||
SendState string `json:"send_state"`
|
||||
ResType string `json:"res_type"`
|
||||
EvalData []*EvalMatch `json:"eval_data"`
|
||||
AlertRule AlertRecordRule
|
||||
Level string `json:"level"`
|
||||
State string `json:"state"`
|
||||
SendState string `json:"send_state"`
|
||||
ResType string `json:"res_type"`
|
||||
EvalData []*EvalMatch `json:"eval_data"`
|
||||
AlertRule []*AlertRecordRule `json:"alert_rule"`
|
||||
}
|
||||
|
||||
type AlertRecordRule struct {
|
||||
@@ -96,4 +96,5 @@ type AlertRecordRule struct {
|
||||
ConditionType string `json:"condition_type"`
|
||||
// 静默期
|
||||
SilentPeriod string `json:"silent_period"`
|
||||
Reducer string `json:"reducer"`
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ const (
|
||||
// AlertResourceTypeCloudaccount means cloudaccount resource
|
||||
AlertResourceTypeCloudaccount AlertResourceType = "cloudaccount"
|
||||
// AlertResourceTypeVM means virtual machine guest resource
|
||||
// AlertResourceTypeVM AlertResourceType = "vm"
|
||||
AlertResourceTypeVM AlertResourceType = "vm"
|
||||
)
|
||||
|
||||
type AlertResourceCreateInput struct {
|
||||
|
||||
@@ -103,6 +103,8 @@ type CommonAlertQuery struct {
|
||||
//field yunsuan
|
||||
FieldOpt string `json:"field_opt"`
|
||||
ConditionType string `json:"condition_type"`
|
||||
// Operator should be chosen from 'and | or'
|
||||
Operator string `json:"operator"`
|
||||
}
|
||||
|
||||
type CommonAlertListInput struct {
|
||||
@@ -159,6 +161,7 @@ type CommonAlertDetails struct {
|
||||
}
|
||||
|
||||
type CommonAlertMetricDetails struct {
|
||||
Operator string `json:"operator"`
|
||||
Comparator string `json:"comparator"`
|
||||
Threshold float64 `json:"threshold"`
|
||||
WithinRange []float64 `json:"within_range"`
|
||||
|
||||
8
pkg/apis/monitor/datasource.go
Normal file
8
pkg/apis/monitor/datasource.go
Normal file
@@ -0,0 +1,8 @@
|
||||
package monitor
|
||||
|
||||
import "yunion.io/x/onecloud/pkg/apis"
|
||||
|
||||
const (
|
||||
DataSourceTypeInfluxdb = apis.SERVICE_TYPE_INFLUXDB
|
||||
DataSourceTypeVictoriaMetrics = apis.SERVICE_TYPE_VICTORIA_METRICS
|
||||
)
|
||||
@@ -40,6 +40,7 @@ const (
|
||||
|
||||
METRIC_UNIT_PERCENT = "%"
|
||||
METRIC_UNIT_BPS = "bps"
|
||||
METRIC_UNIT_PPS = "pps"
|
||||
METRIC_UNIT_MBPS = "Mbps"
|
||||
METRIC_UNIT_BYTEPS = "Bps"
|
||||
METRIC_UNIT_CPS = "cps"
|
||||
|
||||
@@ -28,18 +28,23 @@ type MonitorResourceJointListInput struct {
|
||||
MonitorResourceId string `json:"monitor_resource_id"`
|
||||
AlertId string `json:"alert_id"`
|
||||
JointId []int64 `json:"joint_id"`
|
||||
Alerting bool `json:"alertinng"`
|
||||
Alerting bool `json:"alerting"`
|
||||
AlertState string `json:"alert_state"`
|
||||
SendState string `json:"send_state"`
|
||||
ResType string `json:"res_type"`
|
||||
Metric string `json:"metric"`
|
||||
ResName string `json:"res_name"`
|
||||
AlertName string `json:"alert_name"`
|
||||
Level string `json:"level"`
|
||||
// 查询所有状态
|
||||
AllState bool `json:"all_state"`
|
||||
}
|
||||
|
||||
type MonitorResourceJointCreateInput struct {
|
||||
apis.Meta
|
||||
MonitorResourceId string `json:"monitor_resource_id"`
|
||||
AlertId string `json:"alert_id"`
|
||||
Metric string `json:"metric"`
|
||||
|
||||
AlertRecordId string `width:"36" charset:"ascii" list:"user" update:"user"`
|
||||
AlertState string `width:"18" charset:"ascii" list:"user" update:"user"`
|
||||
|
||||
@@ -19,10 +19,10 @@ type NotificationTemplateCreateInput struct {
|
||||
}
|
||||
|
||||
type NotificationTemplateConfig struct {
|
||||
Title string `json:"title"`
|
||||
Name string `json:"name"`
|
||||
ResourceName string `json:"resource_name"`
|
||||
Matches []EvalMatch `json:"matches"`
|
||||
Title string `json:"title"`
|
||||
Name string `json:"name"`
|
||||
ResourceName string `json:"resource_name"`
|
||||
Matches []*EvalMatch `json:"matches"`
|
||||
// PrevAlertState AlertStateType `json:"prev_alert_state"`
|
||||
// State AlertStateType `json:"state"`
|
||||
NoDataFound bool `json:"no_data"`
|
||||
|
||||
@@ -14,54 +14,12 @@
|
||||
|
||||
package monitor
|
||||
|
||||
const (
|
||||
DataSourceTypeInfluxdb = "influxdb"
|
||||
)
|
||||
import "fmt"
|
||||
|
||||
type DataSourceConfig struct {
|
||||
Id string
|
||||
Name string
|
||||
Driver string
|
||||
Config interface{}
|
||||
}
|
||||
|
||||
type MetricResource struct {
|
||||
// Type is the metric resource type. e.g: host, vm, lbinstance
|
||||
Type string `json:"type"`
|
||||
// ConfigId is the data source config id
|
||||
ConfigId string `json:"config_id"`
|
||||
}
|
||||
|
||||
type Metric struct {
|
||||
Resource MetricResource `json:"resource"`
|
||||
Measurement string `json:"measurement"`
|
||||
Field string `json:"field"`
|
||||
DisplayName string `json:"displayname"`
|
||||
}
|
||||
|
||||
type TimeSeries struct {
|
||||
Results []TimeSeriesResult `json:"results"`
|
||||
}
|
||||
|
||||
type TimeSeriesResult struct {
|
||||
Series []TimeSeriesRow `json:"series"`
|
||||
}
|
||||
|
||||
type TimeSeriesRow struct {
|
||||
Metric Metric `json:"metric"`
|
||||
Tags map[string]string `json:"tags,omitempty"`
|
||||
Columns []string `json:"columns,omitempty"`
|
||||
// Value item is a point with timestamp and value
|
||||
Values [][]interface{} `json:"values,omitempty"`
|
||||
}
|
||||
|
||||
type MetricRequest struct {
|
||||
// The start time for the query
|
||||
From string `json:"from"`
|
||||
// An end time for the query
|
||||
To string `json:"to"`
|
||||
Queries []*MetricQuery `json:"queries"`
|
||||
Debug bool `json:"debug"`
|
||||
type Condition struct {
|
||||
Type string `json:"type"`
|
||||
Params []float64 `json:"params"`
|
||||
Operators []string `json:"operators"`
|
||||
}
|
||||
|
||||
type MetricQueryTag struct {
|
||||
@@ -76,6 +34,61 @@ type MetricQueryPart struct {
|
||||
Params []string `json:"params"`
|
||||
}
|
||||
|
||||
func NewMetricQueryPartField(fieldName string) MetricQueryPart {
|
||||
return MetricQueryPart{
|
||||
Type: "field",
|
||||
Params: []string{fieldName},
|
||||
}
|
||||
}
|
||||
|
||||
func NewMetricQueryPartAS(alias string) MetricQueryPart {
|
||||
return MetricQueryPart{
|
||||
Type: "alias",
|
||||
Params: []string{alias},
|
||||
}
|
||||
}
|
||||
|
||||
func NewMetricQueryPartMath(op string, val string) MetricQueryPart {
|
||||
return MetricQueryPart{
|
||||
Type: "math",
|
||||
Params: []string{fmt.Sprintf("%s %s", op, val)},
|
||||
}
|
||||
}
|
||||
|
||||
func NewMetricQueryPartFunc(funcName string) MetricQueryPart {
|
||||
return MetricQueryPart{
|
||||
Type: funcName,
|
||||
}
|
||||
}
|
||||
|
||||
func NewMetricQueryPartMean() MetricQueryPart {
|
||||
return NewMetricQueryPartFunc("mean")
|
||||
}
|
||||
|
||||
func NewMetricQueryPartCount() MetricQueryPart {
|
||||
return NewMetricQueryPartFunc("count")
|
||||
}
|
||||
|
||||
func NewMetricQueryPartDistinct() MetricQueryPart {
|
||||
return NewMetricQueryPartFunc("distinct")
|
||||
}
|
||||
|
||||
func NewMetricQueryPartSum() MetricQueryPart {
|
||||
return NewMetricQueryPartFunc("sum")
|
||||
}
|
||||
|
||||
func NewMetricQueryPartMin() MetricQueryPart {
|
||||
return NewMetricQueryPartFunc("min")
|
||||
}
|
||||
|
||||
func NewMetricQueryPartMax() MetricQueryPart {
|
||||
return NewMetricQueryPartFunc("max")
|
||||
}
|
||||
|
||||
func NewMetricQueryPartLast() MetricQueryPart {
|
||||
return NewMetricQueryPartFunc("last")
|
||||
}
|
||||
|
||||
type MetricQuerySelect []MetricQueryPart
|
||||
|
||||
func NewMetricQuerySelect(parts ...MetricQueryPart) MetricQuerySelect {
|
||||
@@ -94,11 +107,3 @@ type MetricQuery struct {
|
||||
Policy string `json:"policy"`
|
||||
ResultFormat string `json:"result_format"`
|
||||
}
|
||||
|
||||
type AlertConditionCombiner string
|
||||
|
||||
type Condition struct {
|
||||
Type string `json:"type"`
|
||||
Params []float64 `json:"params"`
|
||||
Operators []string `json:"operators"`
|
||||
}
|
||||
|
||||
@@ -14,15 +14,17 @@
|
||||
|
||||
package monitor
|
||||
|
||||
import "time"
|
||||
import (
|
||||
"strconv"
|
||||
"time"
|
||||
)
|
||||
|
||||
var (
|
||||
UNIFIED_MONITOR_FIELD_OPT_TYPE = []string{"Aggregations", "Selectors"}
|
||||
UNIFIED_MONITOR_GROUPBY_OPT_TYPE = []string{"time", "tag", "fill"}
|
||||
UNIFIED_MONITOR_FIELD_OPT_VALUE = map[string][]string{
|
||||
"Aggregations": {"COUNT", "DISTINCT", "INTEGRAL",
|
||||
"MEAN", "MEDIAN", "MODE", "STDDEV", "SUM"},
|
||||
"Selectors": {"BOTTOM", "FIRST", "LAST", "MAX", "MIN", "TOP"},
|
||||
"Aggregations": {"MEAN", "SUM"}, // {"COUNT", "DISTINCT", "INTEGRAL", "MEAN", "MEDIAN", "MODE", "STDDEV", "SUM"},
|
||||
"Selectors": {"BOTTOM", "FIRST", "LAST", "MAX", "MIN", "TOP"},
|
||||
}
|
||||
UNIFIED_MONITOR_GROUPBY_OPT_VALUE = map[string][]string{
|
||||
"fill": {"linear", "none", "previous", "0"},
|
||||
@@ -63,6 +65,27 @@ var (
|
||||
}
|
||||
)
|
||||
|
||||
func GetMeasurementTagIdKeyByResType(resType string) string {
|
||||
return MEASUREMENT_TAG_ID[resType]
|
||||
}
|
||||
|
||||
func GetMeasurementTagIdKeyByResTypeWithDefault(resType string) string {
|
||||
tagId := GetMeasurementTagIdKeyByResType(resType)
|
||||
if len(tagId) == 0 {
|
||||
tagId = "host_id"
|
||||
}
|
||||
return tagId
|
||||
}
|
||||
|
||||
func GetMeasurementResourceId(tags map[string]string, resType string) string {
|
||||
return tags[GetMeasurementTagIdKeyByResType(resType)]
|
||||
}
|
||||
|
||||
func GetResourceIdFromTagWithDefault(tags map[string]string, resType string) string {
|
||||
tagId := GetMeasurementTagIdKeyByResTypeWithDefault(resType)
|
||||
return tags[tagId]
|
||||
}
|
||||
|
||||
type MetricFunc struct {
|
||||
FieldOptType []string `json:"field_opt_type"`
|
||||
FieldOptValue map[string][]string `json:"field_opt_value"`
|
||||
@@ -70,23 +93,6 @@ type MetricFunc struct {
|
||||
GroupOptValue map[string][]string `json:"group_opt_value"`
|
||||
}
|
||||
|
||||
type MetricInputQuery struct {
|
||||
From string `json:"from"`
|
||||
To string `json:"to"`
|
||||
Scope string `json:"scope"`
|
||||
Slimit string `json:"slimit"`
|
||||
Soffset string `json:"soffset"`
|
||||
//default group by
|
||||
Unit bool `json:"unit"`
|
||||
Interval string `json:"interval"`
|
||||
DomainId string `json:"domain_id"`
|
||||
ProjectId string `json:"project_id"`
|
||||
MetricQuery []*AlertQuery `json:"metric_query"`
|
||||
Signature string `json:"signature"`
|
||||
ShowMeta bool `json:"show_meta"`
|
||||
SkipCheckSeries bool `json:"skip_check_series"`
|
||||
}
|
||||
|
||||
type SimpleQueryInput struct {
|
||||
// 资源Id, 可以不填, 代表查询指定监控的所有监控数据
|
||||
Id string `json:"id"`
|
||||
@@ -108,3 +114,103 @@ type SimpleQueryOutput struct {
|
||||
Time time.Time `json:"time"`
|
||||
Value float64 `json:"value"`
|
||||
}
|
||||
|
||||
type MetricsQueryResult struct {
|
||||
SeriesTotal int64
|
||||
Series TimeSeriesSlice
|
||||
Metas []QueryResultMeta
|
||||
}
|
||||
|
||||
type TimeSeriesPoints []TimePoint
|
||||
|
||||
type TimeSeriesSlice []*TimeSeries
|
||||
|
||||
type TimeSeries struct {
|
||||
// RawName is used to frontend displaying the curve name
|
||||
RawName string `json:"raw_name"`
|
||||
Columns []string `json:"columns"`
|
||||
Name string `json:"name"`
|
||||
Points TimeSeriesPoints `json:"points"`
|
||||
Tags map[string]string `json:"tags,omitempty"`
|
||||
}
|
||||
|
||||
type TimePoint []interface{}
|
||||
|
||||
func NewTimePoint(value *float64, timestamp float64) TimePoint {
|
||||
return TimePoint{value, timestamp}
|
||||
}
|
||||
|
||||
func NewTimePointByVal(value float64, timestamp float64) TimePoint {
|
||||
return NewTimePoint(&value, timestamp)
|
||||
}
|
||||
|
||||
func (p TimePoint) IsValid() bool {
|
||||
if val, ok := p[0].(*float64); ok && val != nil {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
//return p[0].(*float64) != nil
|
||||
}
|
||||
|
||||
func (p TimePoint) IsValids() bool {
|
||||
for i := 0; i < len(p)-1; i++ {
|
||||
if p[i] == nil {
|
||||
return false
|
||||
}
|
||||
if p[i].(*float64) == nil {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
func (p TimePoint) Value() float64 {
|
||||
return *(p[0].(*float64))
|
||||
}
|
||||
|
||||
func (p TimePoint) Timestamp() float64 {
|
||||
return p[len(p)-1].(float64)
|
||||
}
|
||||
|
||||
func (p TimePoint) Values() []float64 {
|
||||
values := make([]float64, 0)
|
||||
for i := 0; i < len(p)-1; i++ {
|
||||
values = append(values, *(p[i].(*float64)))
|
||||
}
|
||||
return values
|
||||
}
|
||||
|
||||
func (p TimePoint) PointValueStr() []string {
|
||||
arrStr := make([]string, 0)
|
||||
for i := 0; i < len(p)-1; i++ {
|
||||
if p[i] == nil {
|
||||
arrStr = append(arrStr, "")
|
||||
}
|
||||
if fval, ok := p[i].(*float64); ok {
|
||||
arrStr = append(arrStr, strconv.FormatFloat((*fval), 'f', -1, 64))
|
||||
continue
|
||||
}
|
||||
if ival, ok := p[i].(*int64); ok {
|
||||
arrStr = append(arrStr, strconv.FormatInt((*ival), 64))
|
||||
continue
|
||||
}
|
||||
arrStr = append(arrStr, p[i].(string))
|
||||
}
|
||||
return arrStr
|
||||
}
|
||||
|
||||
func NewTimeSeriesPointsFromArgs(values ...float64) TimeSeriesPoints {
|
||||
points := make(TimeSeriesPoints, 0)
|
||||
|
||||
for i := 0; i < len(values); i += 2 {
|
||||
points = append(points, NewTimePoint(&values[i], values[i+1]))
|
||||
}
|
||||
|
||||
return points
|
||||
}
|
||||
|
||||
type QueryResultMeta struct {
|
||||
RawQuery string `json:"raw_query"`
|
||||
}
|
||||
|
||||
const ConditionTypeMetricQuery = "metricquery"
|
||||
47
pkg/apis/monitor/unifiedmonitor_query_input.go
Normal file
47
pkg/apis/monitor/unifiedmonitor_query_input.go
Normal file
@@ -0,0 +1,47 @@
|
||||
// Copyright 2019 Yunion
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package monitor
|
||||
|
||||
import (
|
||||
"crypto/sha256"
|
||||
"fmt"
|
||||
|
||||
"yunion.io/x/jsonutils"
|
||||
)
|
||||
|
||||
type MetricQueryInput struct {
|
||||
From string `json:"from"`
|
||||
To string `json:"to"`
|
||||
Scope string `json:"scope"`
|
||||
Slimit string `json:"slimit"`
|
||||
Soffset string `json:"soffset"`
|
||||
Unit bool `json:"unit"`
|
||||
Interval string `json:"interval"`
|
||||
DomainId string `json:"domain_id"`
|
||||
ProjectId string `json:"project_id"`
|
||||
MetricQuery []*AlertQuery `json:"metric_query"`
|
||||
Signature string `json:"signature"`
|
||||
ShowMeta bool `json:"show_meta"`
|
||||
SkipCheckSeries bool `json:"skip_check_series"`
|
||||
}
|
||||
|
||||
const (
|
||||
QUERY_SIGNATURE_KEY = "signature"
|
||||
)
|
||||
|
||||
func DigestQuerySignature(data *jsonutils.JSONDict) string {
|
||||
data.Remove(QUERY_SIGNATURE_KEY)
|
||||
return fmt.Sprintf("%x", sha256.Sum256([]byte(data.String())))
|
||||
}
|
||||
1
pkg/apis/monitor/unifiedmonitor_query_input_test.go
Normal file
1
pkg/apis/monitor/unifiedmonitor_query_input_test.go
Normal file
@@ -0,0 +1 @@
|
||||
package monitor
|
||||
@@ -168,6 +168,7 @@ type SendParams struct {
|
||||
// minutes
|
||||
GroupTimes uint
|
||||
ReceiverId string
|
||||
SendTime time.Time
|
||||
}
|
||||
|
||||
type SRemoteTemplateParam struct {
|
||||
@@ -225,6 +226,10 @@ type SNotifyConfigContent struct {
|
||||
//AppSecret string
|
||||
AppKey string
|
||||
// sms
|
||||
VerifiyCode string
|
||||
AlertsCode string
|
||||
ErrorCode string
|
||||
PhoneNumber string
|
||||
AccessKeyId string
|
||||
AccessKeySecret string
|
||||
ServiceUrl string
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user