mirror of
https://hubproxy.babadafafafafa.cn/https://github.com/yunionio/cloudpods.git
synced 2026-09-21 00:24:07 +08:00
Compare commits
437 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
73246a90b7 | ||
|
|
5cf2937871 | ||
|
|
a7064c792e | ||
|
|
d797eb3144 | ||
|
|
a3fa8463dd | ||
|
|
ddc7c4ffb6 | ||
|
|
9a94f03e11 | ||
|
|
194998499b | ||
|
|
d435034e6d | ||
|
|
d51ea4d961 | ||
|
|
8381a3f1f2 | ||
|
|
df141ff513 | ||
|
|
09854f51c3 | ||
|
|
f0fd038faa | ||
|
|
c9c2c8e478 | ||
|
|
25a9086f98 | ||
|
|
b736a6d483 | ||
|
|
d3c8315b81 | ||
|
|
bad21c8698 | ||
|
|
f42bce4184 | ||
|
|
a0e31df7be | ||
|
|
e4e1469114 | ||
|
|
982430a025 | ||
|
|
e1fd572f0e | ||
|
|
4938bd8b4f | ||
|
|
5f5f02ac07 | ||
|
|
101502895e | ||
|
|
8ecd6b5967 | ||
|
|
e0aaf54316 | ||
|
|
07ea3fa160 | ||
|
|
d36f8103dd | ||
|
|
15af5feed5 | ||
|
|
d9165e540e | ||
|
|
3d15d0ffde | ||
|
|
5bc85cc8a9 | ||
|
|
5b55749dbd | ||
|
|
0d0c52ddb1 | ||
|
|
d766d5a979 | ||
|
|
2798b9e592 | ||
|
|
b67dd5200a | ||
|
|
3c7c40e71a | ||
|
|
77ed62fbf0 | ||
|
|
8e982788fe | ||
|
|
35cba00416 | ||
|
|
58e8f9dd03 | ||
|
|
a663c5ce87 | ||
|
|
6a661d3eae | ||
|
|
928bb282ac | ||
|
|
928e2902a1 | ||
|
|
eeec217220 | ||
|
|
8ab7b49f05 | ||
|
|
4c00be06a2 | ||
|
|
06dcc0b6d9 | ||
|
|
881f4085ea | ||
|
|
37223ce58a | ||
|
|
aa80106b84 | ||
|
|
d8f0cc6b4a | ||
|
|
57244dcbd0 | ||
|
|
6e7d07f47e | ||
|
|
e90f89efa8 | ||
|
|
7756028da0 | ||
|
|
fe66a6e907 | ||
|
|
7e68d87c60 | ||
|
|
7f1f9e21d8 | ||
|
|
b773be0f73 | ||
|
|
777920cd29 | ||
|
|
00cb7fb015 | ||
|
|
8b1aa2e675 | ||
|
|
3940d23b21 | ||
|
|
c874e90985 | ||
|
|
5a71c664d1 | ||
|
|
17aeab6b4e | ||
|
|
b73d206365 | ||
|
|
722855f8f1 | ||
|
|
5f0c1cfd49 | ||
|
|
6b115aa28b | ||
|
|
fee8a08fb9 | ||
|
|
0a6daca02d | ||
|
|
eafd63ed99 | ||
|
|
0c6d7f1534 | ||
|
|
55db52bc3a | ||
|
|
4365c22e31 | ||
|
|
904f00cc55 | ||
|
|
5350c65fdd | ||
|
|
5be6a18f2b | ||
|
|
798f5e638e | ||
|
|
29cdd2154c | ||
|
|
98a31154e5 | ||
|
|
14431ff1dc | ||
|
|
00c4490ec8 | ||
|
|
c3f37211a2 | ||
|
|
1b741f18fc | ||
|
|
de876d1736 | ||
|
|
65786781e1 | ||
|
|
8cc318ac34 | ||
|
|
22a7f0a748 | ||
|
|
23bde8e519 | ||
|
|
8345f0ab8f | ||
|
|
3b5c84f5e0 | ||
|
|
505303c708 | ||
|
|
34c96d68ac | ||
|
|
68b341561c | ||
|
|
bd1cb2fc1d | ||
|
|
69d66eef67 | ||
|
|
0a140753be | ||
|
|
fe54f42735 | ||
|
|
1e53b7a995 | ||
|
|
40a9c4723f | ||
|
|
b880951a01 | ||
|
|
a0c176936e | ||
|
|
09c02afdac | ||
|
|
3acb2469a7 | ||
|
|
6ab9b68ab5 | ||
|
|
9ba603e29b | ||
|
|
0a4f530d4b | ||
|
|
ed3bd14773 | ||
|
|
bd40d802ec | ||
|
|
ea8f261ed6 | ||
|
|
86817febe1 | ||
|
|
8f1d9998f1 | ||
|
|
3026b2d73c | ||
|
|
5ea09eea51 | ||
|
|
bbb91f39d9 | ||
|
|
a7bf1fc8c6 | ||
|
|
63b97fbad0 | ||
|
|
a0bd95fabb | ||
|
|
f87e5c4004 | ||
|
|
155f9620c6 | ||
|
|
48d45592e4 | ||
|
|
5ebb30ed83 | ||
|
|
a09dccf981 | ||
|
|
7d49c48eff | ||
|
|
9407ff7397 | ||
|
|
7cc3a98825 | ||
|
|
cea2968b04 | ||
|
|
b2b21f8095 | ||
|
|
e4280eaa48 | ||
|
|
c6e291b425 | ||
|
|
140898a2f8 | ||
|
|
32b3d831b6 | ||
|
|
b974842932 | ||
|
|
30875951e1 | ||
|
|
c6fd3d5dbd | ||
|
|
5414541ce5 | ||
|
|
8b889fc561 | ||
|
|
3ce447c35e | ||
|
|
9a2e197c43 | ||
|
|
dc27b93775 | ||
|
|
2a49b7903b | ||
|
|
272e4173c2 | ||
|
|
ac674553ee | ||
|
|
d7078cd1d6 | ||
|
|
2c34090015 | ||
|
|
b5d55c7ebc | ||
|
|
62189913f1 | ||
|
|
05e19381d8 | ||
|
|
ae98388b8a | ||
|
|
da1fc9e8f3 | ||
|
|
ee3df76aa3 | ||
|
|
7ce28e78fd | ||
|
|
436b809249 | ||
|
|
d894992e29 | ||
|
|
c0db3ead14 | ||
|
|
91dbb1b64e | ||
|
|
7f52cc5ec0 | ||
|
|
213637679e | ||
|
|
02dc737ccd | ||
|
|
627e97b73a | ||
|
|
3d8a727eb8 | ||
|
|
49366c5174 | ||
|
|
a50782ab52 | ||
|
|
974dd220e8 | ||
|
|
bf99c1d824 | ||
|
|
678626ff3a | ||
|
|
8b6791b908 | ||
|
|
78b5b0a94c | ||
|
|
cb264e7d1a | ||
|
|
6fb58e8c63 | ||
|
|
4c12de8eea | ||
|
|
e55aa144fa | ||
|
|
a55732b782 | ||
|
|
128ea60569 | ||
|
|
0988bf1578 | ||
|
|
42612205fd | ||
|
|
de48910c63 | ||
|
|
c80945338e | ||
|
|
96973b15bd | ||
|
|
04521a1548 | ||
|
|
9025a56617 | ||
|
|
973ebbf9f3 | ||
|
|
c53164e430 | ||
|
|
0ac263dee1 | ||
|
|
95aaa66c76 | ||
|
|
1e2773bd18 | ||
|
|
e6ba4a1dc7 | ||
|
|
e5afb63551 | ||
|
|
ced94cfb66 | ||
|
|
628244f7b9 | ||
|
|
7033974ab4 | ||
|
|
cb733ded80 | ||
|
|
658d734ec4 | ||
|
|
2f3e6f80a7 | ||
|
|
c4b5f59e11 | ||
|
|
5a5cca4110 | ||
|
|
5f8c36b407 | ||
|
|
a62ac5fb30 | ||
|
|
9694075bee | ||
|
|
4e84ace30a | ||
|
|
e96dbaba60 | ||
|
|
05d7a87c1b | ||
|
|
d94ddc43a4 | ||
|
|
57d3e37c08 | ||
|
|
ce7dd991d2 | ||
|
|
6364389877 | ||
|
|
3c2f99313b | ||
|
|
e91bc4e8fb | ||
|
|
946a0395ad | ||
|
|
dea562a733 | ||
|
|
a552c3ff85 | ||
|
|
cc5d7713e4 | ||
|
|
a94b00604d | ||
|
|
3d5361bee1 | ||
|
|
8c44e4e3e9 | ||
|
|
d46f44ccc1 | ||
|
|
3f06837b92 | ||
|
|
2c6aa4fb09 | ||
|
|
7835d0521b | ||
|
|
a43a3dc4bc | ||
|
|
99fb78de35 | ||
|
|
e7d67a41f5 | ||
|
|
5f1d1f748f | ||
|
|
8189fdb496 | ||
|
|
609db4298d | ||
|
|
09f31ce467 | ||
|
|
7cad0e5ee6 | ||
|
|
d5355f21bb | ||
|
|
e9f6a90bc5 | ||
|
|
b281ab8543 | ||
|
|
60b333bd1f | ||
|
|
b3093fbfd6 | ||
|
|
f8822c745a | ||
|
|
4c3adeb328 | ||
|
|
25c473a435 | ||
|
|
d65471ec41 | ||
|
|
8961bf4968 | ||
|
|
157921f5c4 | ||
|
|
cd65b9498b | ||
|
|
f850e179f2 | ||
|
|
cf7c8fb03f | ||
|
|
ace44f9490 | ||
|
|
72f6412f6c | ||
|
|
1eeb11be87 | ||
|
|
acab975d94 | ||
|
|
b2c52fd1fe | ||
|
|
e6975a6474 | ||
|
|
7c1d16cc63 | ||
|
|
17c6698073 | ||
|
|
ea4f290f8c | ||
|
|
c5e8ff9b39 | ||
|
|
10ad4c32dc | ||
|
|
625d7ef304 | ||
|
|
f68567e28c | ||
|
|
a368985923 | ||
|
|
a12e235fe3 | ||
|
|
27ec4567cc | ||
|
|
020092cc4d | ||
|
|
d64f80ddc8 | ||
|
|
cee3246346 | ||
|
|
7da7ffcb7a | ||
|
|
22e2896afc | ||
|
|
c63ed9093b | ||
|
|
9f4fc77bd2 | ||
|
|
8702653395 | ||
|
|
44d738a0b8 | ||
|
|
032353b0cc | ||
|
|
a6a2e4c288 | ||
|
|
0f67656287 | ||
|
|
5ad7bbf61c | ||
|
|
22dbb38ff5 | ||
|
|
420c1968dc | ||
|
|
07f482da0f | ||
|
|
dbee3ec258 | ||
|
|
aab33d1355 | ||
|
|
8e495f1589 | ||
|
|
67513c50c8 | ||
|
|
95abcef299 | ||
|
|
1c2472ae87 | ||
|
|
ce3e4ac385 | ||
|
|
5e787456b7 | ||
|
|
5a55a17967 | ||
|
|
c1a03c16b3 | ||
|
|
1fc6c8b42e | ||
|
|
a51b977953 | ||
|
|
b6fc27d64f | ||
|
|
aa2445d1c4 | ||
|
|
80670214be | ||
|
|
76c9d8a5ae | ||
|
|
5fd3aebbb1 | ||
|
|
04d533138f | ||
|
|
7547142600 | ||
|
|
7166a100ec | ||
|
|
3ff4d65300 | ||
|
|
b61399f12e | ||
|
|
1d4565807f | ||
|
|
5b232c2ff2 | ||
|
|
281698906d | ||
|
|
c25535d21b | ||
|
|
cb0d0b68b2 | ||
|
|
f6c9aa09ea | ||
|
|
2eec54723e | ||
|
|
f78047601b | ||
|
|
63cd9bec46 | ||
|
|
57bc6f1445 | ||
|
|
d5e6532711 | ||
|
|
4d511c98e9 | ||
|
|
f96c1f9fd2 | ||
|
|
315054703c | ||
|
|
f9064a0018 | ||
|
|
6641eb15f0 | ||
|
|
59f837c0e3 | ||
|
|
e5891349cd | ||
|
|
fe9f5fa4cc | ||
|
|
76b110445e | ||
|
|
d274e3078c | ||
|
|
e1269cf9fe | ||
|
|
5a972e6ddf | ||
|
|
a905f67fb2 | ||
|
|
9bca310026 | ||
|
|
edcbf3b2d3 | ||
|
|
e09c21d452 | ||
|
|
f270daa6ae | ||
|
|
49d1f6ee1e | ||
|
|
bdf015668f | ||
|
|
334ae46514 | ||
|
|
cbbf5c28e1 | ||
|
|
f517795c85 | ||
|
|
82b05b2cd1 | ||
|
|
429d38f06d | ||
|
|
b50d54d8cc | ||
|
|
d4104bb98d | ||
|
|
c8b1cfc397 | ||
|
|
df3d24b40a | ||
|
|
3483446885 | ||
|
|
b84b5786ed | ||
|
|
ad4f0da021 | ||
|
|
31aa3e36ee | ||
|
|
c4c095e0f8 | ||
|
|
a9a1c64ef0 | ||
|
|
dda5a309ac | ||
|
|
328dcf8ebb | ||
|
|
7628bd2a81 | ||
|
|
237a54a79f | ||
|
|
1927f32109 | ||
|
|
9dcabdb247 | ||
|
|
6785b43bad | ||
|
|
a51f8b6c2c | ||
|
|
40127b24e6 | ||
|
|
d2f608696f | ||
|
|
a38f03516e | ||
|
|
e7935d6412 | ||
|
|
4a72e87323 | ||
|
|
a6295d340a | ||
|
|
e8338f2832 | ||
|
|
f87d0e905a | ||
|
|
9274649334 | ||
|
|
13b05bf0c6 | ||
|
|
2069057967 | ||
|
|
197ff6f805 | ||
|
|
c52ee7d073 | ||
|
|
3eafa21456 | ||
|
|
749d063a61 | ||
|
|
7ee8b8abe5 | ||
|
|
3353aa0062 | ||
|
|
8e493053ee | ||
|
|
eb307bbffd | ||
|
|
904f6b3358 | ||
|
|
161cec3a08 | ||
|
|
8c6d9ad876 | ||
|
|
bdeed9e7a8 | ||
|
|
b9f3f55e62 | ||
|
|
aa60326bc3 | ||
|
|
43deb292fb | ||
|
|
99eaebe34a | ||
|
|
5afb0c82a8 | ||
|
|
8fbd42e535 | ||
|
|
c57c4cc5b2 | ||
|
|
c7ad1243be | ||
|
|
18b008d838 | ||
|
|
36b91f5afe | ||
|
|
fe0f3b01b9 | ||
|
|
45219f3cf4 | ||
|
|
eebdd2b591 | ||
|
|
18e806ba7d | ||
|
|
45dd2ece7c | ||
|
|
bb62477f80 | ||
|
|
a6340afcbe | ||
|
|
fc9e1719b7 | ||
|
|
73a8a01b63 | ||
|
|
1455c52270 | ||
|
|
c810ea46c6 | ||
|
|
9b9bcc881e | ||
|
|
0a4ad0a305 | ||
|
|
4573622ba5 | ||
|
|
11cd699c9c | ||
|
|
ef873d9f77 | ||
|
|
7ca332aa79 | ||
|
|
eca062143b | ||
|
|
9b6fe19ea4 | ||
|
|
f0e61cd918 | ||
|
|
a0170df031 | ||
|
|
c78f7a2f04 | ||
|
|
cb9b344bd4 | ||
|
|
b9c4336dff | ||
|
|
e5f352fa37 | ||
|
|
f0862574db | ||
|
|
d7978069a9 | ||
|
|
1df2e03b73 | ||
|
|
9c2502db8d | ||
|
|
22f188f8c0 | ||
|
|
d4656072de | ||
|
|
db34e8ad3b | ||
|
|
dd390aa6dd | ||
|
|
e9b0203da4 | ||
|
|
08c5f3c816 | ||
|
|
5317e842f3 | ||
|
|
afe7f5d828 | ||
|
|
c8966f7e87 | ||
|
|
f89c9b933a | ||
|
|
66c6a7570c | ||
|
|
297d905d4f | ||
|
|
c24c923a8f | ||
|
|
40909986f6 | ||
|
|
48d6492715 | ||
|
|
fcc635a90e | ||
|
|
38582f5f93 | ||
|
|
8deacfcf59 | ||
|
|
f1d422e85f |
@@ -1,4 +1,4 @@
|
||||
FROM registry.cn-beijing.aliyuncs.com/yunionio/baremetal-base:v0.3.2
|
||||
FROM registry.cn-beijing.aliyuncs.com/yunionio/baremetal-base:v0.3.3
|
||||
|
||||
MAINTAINER "Zexi Li <lizexi@yunionyun.com>"
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
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-21080303.x86_64.rpm
|
||||
#RUN yum install -y http://192.168.122.112:8083/baremetal-pxerom-1.1.0-21080303.x86_64.rpm
|
||||
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/onecloud-base:v0.3.5
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
FROM registry.cn-beijing.aliyuncs.com/yunionio/climc-base:20210817
|
||||
FROM registry.cn-beijing.aliyuncs.com/yunionio/climc-base:20210901
|
||||
|
||||
ADD ./build/climc/root/opt /opt
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ RUN mkdir -p /opt/yunion/bin
|
||||
|
||||
RUN echo http://dl-cdn.alpinelinux.org/alpine/edge/testing >>/etc/apk/repositories
|
||||
|
||||
RUN apk add --no-cache bash bash-completion tzdata ca-certificates vim ipmitool kubectl && \
|
||||
RUN apk add --no-cache bash bash-completion tzdata ca-certificates vim ipmitool kubectl ceph-common && \
|
||||
rm -rf /var/cache/apk/*
|
||||
|
||||
RUN cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
|
||||
|
||||
@@ -4,6 +4,5 @@ MAINTAINER "Yaoqi Wan wanyaoqi@yunionyun.com"
|
||||
|
||||
ENV TZ Asia/Shanghai
|
||||
|
||||
RUN apk add librados librbd
|
||||
RUN mkdir -p /opt/yunion/bin
|
||||
ADD ./_output/alpine-build/bin/host /opt/yunion/bin/host
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
FROM registry.cn-beijing.aliyuncs.com/yunionio/host-deployer-base:1.0
|
||||
FROM registry.cn-beijing.aliyuncs.com/yunionio/host-deployer-base:1.1
|
||||
|
||||
MAINTAINER "Yaoqi Wan wanyaoqi@yunionyun.com"
|
||||
|
||||
|
||||
@@ -17,13 +17,13 @@ ANSIBLESERVER_BASE = v1.0.5
|
||||
ansibleserver-base:
|
||||
$(DOCKER_BUILDX)/ansibleserver-base:$(ANSIBLESERVER_BASE) -f ./Dockerfile.ansibleserver-base .
|
||||
|
||||
CLIMC_BASE_VERSION = 20210817
|
||||
CLIMC_BASE_VERSION = 20210901
|
||||
|
||||
climc-base:
|
||||
docker buildx build --platform linux/arm64,linux/amd64 --push \
|
||||
-t registry.cn-beijing.aliyuncs.com/yunionio/climc-base:$(CLIMC_BASE_VERSION) -f ./Dockerfile.climc-base .
|
||||
|
||||
BAREMETAL_BASE_VERSION = v0.3.2
|
||||
BAREMETAL_BASE_VERSION = v0.3.3
|
||||
|
||||
baremetal-base:
|
||||
$(DOCKER_BUILDX)/baremetal-base:$(BAREMETAL_BASE_VERSION) -f ./Dockerfile.baremetal-base .
|
||||
|
||||
@@ -13,6 +13,5 @@ MAINTAINER "Yaoqi Wan wanyaoqi@yunionyun.com"
|
||||
|
||||
ENV TZ Asia/Shanghai
|
||||
|
||||
RUN apk add librados librbd
|
||||
RUN mkdir -p /opt/yunion/bin
|
||||
COPY --from=build /root/go/src/yunion.io/x/onecloud/_output/bin/host /opt/yunion/bin/host
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
{{- if $d.brand -}}
|
||||
{{ $d.brand }}平台
|
||||
{{- end -}}
|
||||
{{ .resource_type_display }}{{ $d.name }}已经{{ .action_display }}{{.result_display}}
|
||||
{{ .resource_type_display }}{{ $d.name }}{{ .action_display }}{{.result_display}}
|
||||
{{- if eq .result "failed" -}}
|
||||
,请尽快前往控制台进行处理
|
||||
{{- end -}}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
{{- if $d.brand -}}
|
||||
{{ $d.brand }}平台
|
||||
{{- end -}}
|
||||
{{ .resource_type_display }}{{ $d.name }}已经创建成功
|
||||
{{ .resource_type_display }}{{ $d.name }}创建成功
|
||||
{{- if $d.private_dns -}}
|
||||
,内网地址为{{ $d.private_dns }}:{{ $d.private_connect_port }}
|
||||
{{- end -}}
|
||||
@@ -13,8 +13,8 @@
|
||||
,外网地址为{{ $d.public_dns }}:{{ $d.public_connect_port }}
|
||||
{{- end -}}
|
||||
|
||||
{{- if and $d.address_type $d.address -}}
|
||||
,服务地址为{{ $d.address_type }}{{ $d.address }}
|
||||
{{- if $d.address -}}
|
||||
,服务地址为{{ $d.address }}
|
||||
{{- end -}}
|
||||
|
||||
{{- if $d.ips -}}
|
||||
@@ -29,8 +29,8 @@
|
||||
,IP地址为{{ $d.ip_addr }}
|
||||
{{- end -}}
|
||||
|
||||
{{- if $d.account -}}
|
||||
,初始帐号为{{ $d.account }}
|
||||
{{- if $d.login_account -}}
|
||||
,初始帐号为{{ $d.login_account }}
|
||||
{{- end -}}
|
||||
|
||||
{{- if $d.password -}}
|
||||
@@ -56,7 +56,7 @@
|
||||
{{- else -}}
|
||||
SSH
|
||||
{{- end -}}
|
||||
或控制面板控制台访问虚拟机。
|
||||
或前往控制台访问虚拟机。
|
||||
{{- end -}}
|
||||
|
||||
{{- if has .resource_type $consoleServiceType -}}
|
||||
|
||||
@@ -19,4 +19,4 @@
|
||||
{{- if $d.ip_addr -}}
|
||||
,IP地址为{{ $d.ip_addr }}
|
||||
{{- end -}}
|
||||
{{ .resource_type_display }}{{ $d.name }}已经删除成功。
|
||||
{{ .resource_type_display }}{{ $d.name }}删除成功
|
||||
|
||||
@@ -3,4 +3,12 @@
|
||||
{{- if $d.brand -}}
|
||||
{{ $d.brand }}平台
|
||||
{{- end -}}
|
||||
|
||||
{{- if $d.private_dns -}}
|
||||
,内网地址为{{ $d.private_dns }}:{{ $d.private_connect_port }}
|
||||
{{- end -}}
|
||||
|
||||
{{- if $d.public_dns -}}
|
||||
,外网地址为{{ $d.public_dns }}:{{ $d.public_connect_port }}的
|
||||
{{- end -}}
|
||||
{{ .resource_type_display }}{{ $d.name }}还有{{ .advance_days }}天就要到期释放,如需续期使用,请尽快前往控制台处理
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
{{- $d := .resource_details -}}
|
||||
您在{{ $d.project }}项目的
|
||||
|
||||
{{- if $d.ips -}}
|
||||
IP地址为{{ $d.ips }}的
|
||||
{{- end -}}
|
||||
|
||||
{{- if $d.ip_addr -}}
|
||||
IP地址为{{ $d.ip_addr }}的
|
||||
{{- end -}}
|
||||
{{- if $d.brand -}}
|
||||
{{ $d.brand }}平台
|
||||
{{- end -}}
|
||||
{{ .resource_type_display }}{{ $d.name }}成功加入回收站
|
||||
@@ -3,7 +3,7 @@
|
||||
{{- if $d.brand -}}
|
||||
{{ $d.brand }}平台
|
||||
{{- end -}}
|
||||
{{ .resource_type_display }}{{ $d.name }}已经{{ .action_display }}成功
|
||||
{{ .resource_type_display }}{{ $d.name }}{{ .action_display }}成功
|
||||
{{- if $d.account -}}
|
||||
,帐号为{{ $d.account }}
|
||||
{{- end -}}
|
||||
|
||||
@@ -9,8 +9,8 @@ Your {{ if $d.brand -}} {{ $d.brand }} {{ end -}} {{ .resource_type_display }} {
|
||||
, the internet address is {{ $d.public_dns }}:{{ $d.public_connect_port }}
|
||||
{{- end -}}
|
||||
|
||||
{{- if and $d.address_type $d.address -}}
|
||||
, the service address is {{ $d.address_type }}{{ $d.address }}
|
||||
{{- if $d.address -}}
|
||||
, the service address is {{ $d.address }}
|
||||
{{- end -}}
|
||||
|
||||
{{- if $d.ips -}}
|
||||
@@ -46,7 +46,7 @@ Your {{ if $d.brand -}} {{ $d.brand }} {{ end -}} {{ .resource_type_display }} {
|
||||
{{- end -}}
|
||||
|
||||
{{- if eq .resource_type "server" -}}
|
||||
, and please use {{ if $d.windows -}} Remote Desktop Connector (RDC) {{ else -}} SSH {{ end -}} or the control panel console to access the VM.
|
||||
, and please use {{ if $d.windows -}} Remote Desktop Connector (RDC) {{ else -}} SSH {{ end -}} or go to the console to access the VM.
|
||||
{{- end -}}
|
||||
|
||||
{{- if has .resource_type $consoleServiceType -}}
|
||||
|
||||
@@ -6,7 +6,7 @@ Your {{ if $d.brand -}} {{ $d.brand }} {{ end -}} {{ .resource_type_display }} {
|
||||
{{- end -}}
|
||||
|
||||
{{- if $d.public_dns -}}
|
||||
, the internet address is {{ $d.public_dns }}:{{ $d.public_connect_port }}
|
||||
, the external address is {{ $d.public_dns }}:{{ $d.public_connect_port }}
|
||||
{{- end -}}
|
||||
|
||||
{{- if and $d.address_type $d.address -}}
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
{{- $d := .resource_details -}}
|
||||
Your {{ if $d.brand -}} {{ $d.brand }} {{ end -}} {{ .resource_type }} {{ $d.name }} {{ if $d.project -}} in project {{ $d.project }} {{ end -}} will expire and be released in {{ .advance_days }} days. If you need to renew, please go to the console as soon as possible
|
||||
Your {{ if $d.brand -}} {{ $d.brand }} {{ end -}} {{ .resource_type }} {{ $d.name }} {{ if $d.public_dns -}} with external address {{ $d.public_dns }}:{{ $d.public_connect_port }} {{ end -}} {{ if $d.project -}} in project {{ $d.project }} {{ end -}} will expire and be released in {{ .advance_days }} days. If you need to renew, please go to the console as soon as possible
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
{{- $d := .resource_details -}}
|
||||
Your {{ if $d.brand -}} {{ $d.brand }} {{ end -}} {{ .resource_type_display }} {{ $d.name }}
|
||||
{{ if $d.project -}} in project {{ $d.project }} {{ end -}} has been added to recycle bin successfully
|
||||
{{- if $d.private_dns -}}
|
||||
, the intranet address is {{ $d.private_dns }}:{{ $d.private_connect_port }}
|
||||
{{- end -}}
|
||||
|
||||
{{- if $d.public_dns -}}
|
||||
, the external address is {{ $d.public_dns }}:{{ $d.public_connect_port }}
|
||||
{{- end -}}
|
||||
|
||||
{{- if and $d.address_type $d.address -}}
|
||||
, the service address is {{ $d.address_type }}{{ $d.address }}
|
||||
{{- end -}}
|
||||
|
||||
{{- if $d.ips -}}
|
||||
, the IP address is {{ $d.ips }}
|
||||
{{- end -}}
|
||||
|
||||
{{- if $d.ip_addr -}}
|
||||
, the IP address is {{ $d.ip_addr }}
|
||||
{{- end -}}
|
||||
@@ -0,0 +1,5 @@
|
||||
{{- $d := .resource_details -}}
|
||||
{{- if $d.project -}}
|
||||
{{ $d.project }}项目的
|
||||
{{- end -}}
|
||||
{{ .resource_type_display }}{{ $d.name }}成功加入回收站
|
||||
@@ -0,0 +1,2 @@
|
||||
{{- $d := .resource_details -}}
|
||||
The {{ .resource_type_display }} {{ .Name }} {{ if $d.project }} in poject {{ $d.project }} {{ end -}} has been added to recycle bin successfully
|
||||
@@ -28,4 +28,5 @@ func init() {
|
||||
cmd.List(&options.ProxyAgentListOptions{})
|
||||
cmd.Show(&options.ProxyAgentShowOptions{})
|
||||
cmd.Delete(&options.ProxyAgentDeleteOptions{})
|
||||
cmd.Perform("purge-forwards", &options.ProxyAgentPurgeForwardsOptions{})
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ func init() {
|
||||
cmd.CreateWithKeyword("create-aws", &options.SAWSCloudAccountCreateOptions{})
|
||||
cmd.CreateWithKeyword("create-openstack", &options.SOpenStackCloudAccountCreateOptions{})
|
||||
cmd.CreateWithKeyword("create-huawei", &options.SHuaweiCloudAccountCreateOptions{})
|
||||
cmd.CreateWithKeyword("create-huaweicloudstack", &options.SHuaweiCloudStackAccountCreateOptions{})
|
||||
cmd.CreateWithKeyword("create-hcso", &options.SHCSOAccountCreateOptions{})
|
||||
cmd.CreateWithKeyword("create-ucloud", &options.SUcloudCloudAccountCreateOptions{})
|
||||
cmd.CreateWithKeyword("create-zstack", &options.SZStackCloudAccountCreateOptions{})
|
||||
cmd.CreateWithKeyword("create-s3", &options.SS3CloudAccountCreateOptions{})
|
||||
@@ -57,7 +57,7 @@ func init() {
|
||||
cmd.UpdateWithKeyword("update-aws", &options.SAWSCloudAccountUpdateOptions{})
|
||||
cmd.UpdateWithKeyword("update-openstack", &options.SOpenStackCloudAccountUpdateOptions{})
|
||||
cmd.UpdateWithKeyword("update-huawei", &options.SHuaweiCloudAccountUpdateOptions{})
|
||||
cmd.UpdateWithKeyword("update-huaweicloudstack", &options.SHuaweiCloudStackAccountUpdateOptions{})
|
||||
cmd.UpdateWithKeyword("update-hcso", &options.SHCSOAccountUpdateOptions{})
|
||||
cmd.UpdateWithKeyword("update-ucloud", &options.SUcloudCloudAccountUpdateOptions{})
|
||||
cmd.UpdateWithKeyword("update-zstack", &options.SZStackCloudAccountUpdateOptions{})
|
||||
cmd.UpdateWithKeyword("update-s3", &options.SS3CloudAccountUpdateOptions{})
|
||||
@@ -75,7 +75,7 @@ func init() {
|
||||
cmd.PerformWithKeyword("update-credential-aws", "update-credential", &options.SAWSCloudAccountUpdateCredentialOptions{})
|
||||
cmd.PerformWithKeyword("update-credential-openstack", "update-credential", &options.SOpenStackCloudAccountUpdateCredentialOptions{})
|
||||
cmd.PerformWithKeyword("update-credential-huawei", "update-credential", &options.SHuaweiCloudAccountUpdateCredentialOptions{})
|
||||
cmd.PerformWithKeyword("update-credential-huaweicloudstack", "update-credential", &options.SHuaweiCloudStackAccountUpdateCredentialOptions{})
|
||||
cmd.PerformWithKeyword("update-credential-hcso", "update-credential", &options.SHCSOAccountUpdateCredentialOptions{})
|
||||
cmd.PerformWithKeyword("update-credential-ucloud", "update-credential", &options.SUcloudCloudAccountUpdateCredentialOptions{})
|
||||
cmd.PerformWithKeyword("update-credential-zstack", "update-credential", &options.SZStackCloudAccountUpdateCredentialOptions{})
|
||||
cmd.PerformWithKeyword("update-credential-s3", "update-credential", &options.SS3CloudAccountUpdateCredentialOptions{})
|
||||
|
||||
@@ -15,10 +15,12 @@
|
||||
package compute
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/log"
|
||||
"yunion.io/x/pkg/errors"
|
||||
|
||||
"yunion.io/x/onecloud/cmd/climc/shell"
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
@@ -26,6 +28,7 @@ import (
|
||||
"yunion.io/x/onecloud/pkg/mcclient/options"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/options/compute"
|
||||
"yunion.io/x/onecloud/pkg/util/fileutils2"
|
||||
"yunion.io/x/onecloud/pkg/util/httputils"
|
||||
"yunion.io/x/onecloud/pkg/util/ssh"
|
||||
)
|
||||
|
||||
@@ -43,7 +46,7 @@ func init() {
|
||||
cmd.Perform("start", &options.BaseIdOptions{})
|
||||
cmd.Perform("stop", &options.BaseIdOptions{})
|
||||
cmd.Perform("reset", &options.BaseIdOptions{})
|
||||
cmd.Perform("delete", &options.BaseIdOptions{})
|
||||
cmd.BatchDelete(&options.BaseIdsOptions{})
|
||||
cmd.Perform("remove-all-netifs", &options.BaseIdOptions{})
|
||||
|
||||
cmd.BatchPerform("enable", &options.BaseIdsOptions{})
|
||||
@@ -523,9 +526,36 @@ func init() {
|
||||
return e
|
||||
}
|
||||
i, e := modules.Hosts.GetLoginInfo(s, srvid, nil)
|
||||
privateKey := ""
|
||||
if e != nil {
|
||||
return e
|
||||
if httputils.ErrorCode(e) == 404 || e.Error() == "ciphertext too short" {
|
||||
var err error
|
||||
privateKey, err = modules.Sshkeypairs.FetchPrivateKeyBySession(context.Background(), s)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "fetch private key")
|
||||
}
|
||||
params := jsonutils.NewDict()
|
||||
params.Add(jsonutils.NewString(string(args.ID)), "ID")
|
||||
ret, err := modules.Hosts.Get(s, args.ID, params)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "get host by ID")
|
||||
}
|
||||
ip, err := ret.GetString("access_ip")
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "get the ip of the host")
|
||||
}
|
||||
|
||||
jsonItem := jsonutils.NewDict()
|
||||
jsonItem.Add(jsonutils.NewString(ip), "ip")
|
||||
jsonItem.Add(jsonutils.NewString("root"), "username")
|
||||
jsonItem.Add(jsonutils.NewString(""), "password")
|
||||
jsonItem.Add(jsonutils.NewInt(22), "port")
|
||||
i = jsonItem
|
||||
} else {
|
||||
return e
|
||||
}
|
||||
}
|
||||
|
||||
host, err := i.GetString("ip")
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -542,7 +572,7 @@ func init() {
|
||||
if args.Port != 22 {
|
||||
port = args.Port
|
||||
}
|
||||
sshCli, err := ssh.NewClient(host, port, user, passwd, "")
|
||||
sshCli, err := ssh.NewClient(host, port, user, passwd, privateKey)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
package compute
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
@@ -88,6 +89,9 @@ func init() {
|
||||
cmd.Perform("create-eip", &options.ServerCreateEipOptions{})
|
||||
cmd.Perform("make-sshable", &options.ServerMakeSshableOptions{})
|
||||
cmd.Perform("migrate-network", &options.ServerMigrateNetworkOptions{})
|
||||
cmd.Perform("set-sshport", &options.ServerSetSshportOptions{})
|
||||
cmd.Perform("have-agent", &options.ServerHaveAgentOptions{})
|
||||
cmd.Perform("change-disk-storage", &options.ServerChangeDiskStorageOptions{})
|
||||
|
||||
cmd.Get("vnc", new(options.ServerIdOptions))
|
||||
cmd.Get("desc", new(options.ServerIdOptions))
|
||||
@@ -99,6 +103,8 @@ func init() {
|
||||
cmd.Get("change-owner-candidate-domains", new(options.ServerChangeOwnerCandidateDomainsOptions))
|
||||
cmd.Get("change-owner-candidate-domains", new(options.ServerChangeOwnerCandidateDomainsOptions))
|
||||
cmd.GetProperty(&options.ServerStatusStatisticsOptions{})
|
||||
cmd.GetProperty(&options.ServerProjectStatisticsOptions{})
|
||||
cmd.GetProperty(&options.ServerDomainStatisticsOptions{})
|
||||
|
||||
type ServerTaskShowOptions struct {
|
||||
ID string `help:"ID or name of server" json:"-"`
|
||||
@@ -817,13 +823,15 @@ func init() {
|
||||
return fmt.Errorf("Not found ip address from server %s", opts.ID)
|
||||
}
|
||||
|
||||
privateKey := ""
|
||||
params := jsonutils.NewDict()
|
||||
if len(opts.Key) > 0 {
|
||||
privateKey, e := ioutil.ReadFile(opts.Key)
|
||||
key, e := ioutil.ReadFile(opts.Key)
|
||||
if e != nil {
|
||||
return e
|
||||
}
|
||||
params.Add(jsonutils.NewString(string(privateKey)), "private_key")
|
||||
params.Add(jsonutils.NewString(string(key)), "private_key")
|
||||
privateKey = string(key)
|
||||
}
|
||||
|
||||
i, e := modules.Servers.GetLoginInfo(s, srvid, params)
|
||||
@@ -831,14 +839,14 @@ func init() {
|
||||
return e
|
||||
}
|
||||
passwd, err := i.GetString("password")
|
||||
if err != nil {
|
||||
if err != nil && !opts.UseCloudroot {
|
||||
return err
|
||||
}
|
||||
if opts.Password != "" {
|
||||
passwd = opts.Password
|
||||
}
|
||||
user, err := i.GetString("username")
|
||||
if err != nil {
|
||||
if err != nil && !opts.UseCloudroot {
|
||||
return err
|
||||
}
|
||||
if opts.User != "" {
|
||||
@@ -868,8 +876,22 @@ func init() {
|
||||
}
|
||||
}
|
||||
|
||||
if opts.UseCloudroot {
|
||||
var err error
|
||||
privateKey, err = modules.Sshkeypairs.FetchPrivateKeyBySession(context.Background(), s)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
passwd = ""
|
||||
user = "cloudroot"
|
||||
}
|
||||
|
||||
var sshCli *ssh.Client
|
||||
for sshCli, err = ssh.NewClient(host, port, user, passwd, ""); err != nil; {
|
||||
err = nil
|
||||
for ; sshCli == nil; sshCli, err = ssh.NewClient(host, port, user, passwd, privateKey) {
|
||||
if err == nil {
|
||||
continue
|
||||
}
|
||||
if opts.Host != "" {
|
||||
return err
|
||||
}
|
||||
@@ -877,12 +899,14 @@ func init() {
|
||||
closeForward(s, srvid, forwardItem)
|
||||
return err
|
||||
} else {
|
||||
forwardItem, err = openForward(s, srvid)
|
||||
if err != nil {
|
||||
return err
|
||||
if vpcid != "default" {
|
||||
forwardItem, e = openForward(s, srvid)
|
||||
if e != nil {
|
||||
return e
|
||||
}
|
||||
host = forwardItem.ProxyAddr
|
||||
port = forwardItem.ProxyPort
|
||||
}
|
||||
host = forwardItem.ProxyAddr
|
||||
port = forwardItem.ProxyPort
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
29
cmd/climc/shell/devtool/serviceurl.go
Normal file
29
cmd/climc/shell/devtool/serviceurl.go
Normal file
@@ -0,0 +1,29 @@
|
||||
// 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 devtool
|
||||
|
||||
import (
|
||||
"yunion.io/x/onecloud/cmd/climc/shell"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules"
|
||||
options "yunion.io/x/onecloud/pkg/mcclient/options/devtool"
|
||||
)
|
||||
|
||||
func init() {
|
||||
cmd := shell.NewResourceCmd(&modules.DevToolServiceUrls).WithKeyword("devtool-serviceurl")
|
||||
cmd.List(new(options.ServiceUrlListOptions))
|
||||
cmd.Create(new(options.ServiceUrlCreateOptions))
|
||||
cmd.Show(new(options.ServiceUrlOptions))
|
||||
cmd.Delete(new(options.ServiceUrlOptions))
|
||||
}
|
||||
29
cmd/climc/shell/devtool/sshinfo.go
Normal file
29
cmd/climc/shell/devtool/sshinfo.go
Normal file
@@ -0,0 +1,29 @@
|
||||
// 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 devtool
|
||||
|
||||
import (
|
||||
"yunion.io/x/onecloud/cmd/climc/shell"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules"
|
||||
options "yunion.io/x/onecloud/pkg/mcclient/options/devtool"
|
||||
)
|
||||
|
||||
func init() {
|
||||
cmd := shell.NewResourceCmd(&modules.DevToolSshInfos).WithKeyword("devtool-sshinfo")
|
||||
cmd.List(new(options.SshInfoListOptions))
|
||||
cmd.Create(new(options.SshInfoCreateOptions))
|
||||
cmd.Show(new(options.SshInfoOptions))
|
||||
cmd.Delete(new(options.SshInfoOptions))
|
||||
}
|
||||
@@ -44,13 +44,14 @@ type BaseEventListOptions struct {
|
||||
|
||||
type EventListOptions struct {
|
||||
BaseEventListOptions
|
||||
Id string `help:"" metavar:"OBJ_ID"`
|
||||
Id []string `help:"object IDs" metavar:"OBJ_ID"`
|
||||
Name []string `help:"object names" metavar:"OBJ_NAME"`
|
||||
Type []string `help:"Type of relevant object" metavar:"OBJ_TYPE"`
|
||||
}
|
||||
|
||||
type TypeEventListOptions struct {
|
||||
BaseEventListOptions
|
||||
ID string `help:"" metavar:"OBJ_ID"`
|
||||
ID []string `help:"object IDs" metavar:"OBJ_ID"`
|
||||
}
|
||||
|
||||
func doComputeEventList(s *mcclient.ClientSession, args *EventListOptions) error {
|
||||
@@ -71,7 +72,10 @@ func DoEventList(man modulebase.ResourceManager, s *mcclient.ClientSession, args
|
||||
params.Add(jsonutils.NewStringArray(args.Type), "obj_type")
|
||||
}
|
||||
if len(args.Id) > 0 {
|
||||
params.Add(jsonutils.NewString(args.Id), "obj_id")
|
||||
params.Add(jsonutils.NewStringArray(args.Id), "obj_id")
|
||||
}
|
||||
if len(args.Name) > 0 {
|
||||
params.Add(jsonutils.NewStringArray(args.Name), "obj_name")
|
||||
}
|
||||
if len(args.Since) > 0 {
|
||||
params.Add(jsonutils.NewString(args.Since), "since")
|
||||
|
||||
@@ -16,7 +16,6 @@ package shell
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"yunion.io/x/pkg/util/timeutils"
|
||||
|
||||
@@ -110,7 +109,7 @@ func init() {
|
||||
}
|
||||
fmt.Println("primary key hash:", fm.PrimaryKeyHash())
|
||||
|
||||
ret := fm.Decrypt([]byte(args.MSG), time.Hour*-1)
|
||||
ret := fm.Decrypt([]byte(args.MSG))
|
||||
if len(ret) == 0 {
|
||||
return fmt.Errorf("invalid message")
|
||||
}
|
||||
|
||||
@@ -21,13 +21,13 @@ import (
|
||||
"yunion.io/x/structarg"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/cloudprovider"
|
||||
huawei "yunion.io/x/onecloud/pkg/multicloud/huaweistack"
|
||||
_ "yunion.io/x/onecloud/pkg/multicloud/huaweistack/shell"
|
||||
huawei "yunion.io/x/onecloud/pkg/multicloud/hcso"
|
||||
_ "yunion.io/x/onecloud/pkg/multicloud/hcso/shell"
|
||||
"yunion.io/x/onecloud/pkg/util/shellutils"
|
||||
)
|
||||
|
||||
type BaseOptions struct {
|
||||
cloudprovider.SHuaweiCloudStackEndpoints
|
||||
cloudprovider.SHCSOEndpoints
|
||||
Help bool `help:"Show help" default:"false"`
|
||||
Debug bool `help:"Show debug" default:"false"`
|
||||
AccessKey string `help:"Access key" default:"$HUAWEI_ACCESS_KEY" metavar:"HUAWEI_ACCESS_KEY"`
|
||||
@@ -92,7 +92,7 @@ func newClient(options *BaseOptions) (*huawei.SRegion, error) {
|
||||
options.AccessKey,
|
||||
options.Secret,
|
||||
options.ProjectId,
|
||||
&options.SHuaweiCloudStackEndpoints,
|
||||
&options.SHCSOEndpoints,
|
||||
).Debug(options.Debug),
|
||||
)
|
||||
if err != nil {
|
||||
6
go.mod
6
go.mod
@@ -40,6 +40,7 @@ require (
|
||||
github.com/coredns/coredns v1.3.0
|
||||
github.com/coreos/go-systemd v0.0.0-20190620071333-e64a0ec8b42a // indirect
|
||||
github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f // indirect
|
||||
github.com/creack/pty v1.1.11
|
||||
github.com/dnaeon/go-vcr v1.1.0 // indirect
|
||||
github.com/dnstap/golang-dnstap v0.0.0-20170829151710-2cf77a2b5e11 // indirect
|
||||
github.com/eapache/go-resiliency v1.1.0 // indirect
|
||||
@@ -78,7 +79,6 @@ require (
|
||||
github.com/jdcloud-api/jdcloud-sdk-go v1.55.0
|
||||
github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0 // indirect
|
||||
github.com/koding/websocketproxy v0.0.0-20181220232114-7ed82d81a28c
|
||||
github.com/kr/pty v1.1.5
|
||||
github.com/lestrrat-go/jwx v1.0.2
|
||||
github.com/lestrrat/go-jwx v0.0.0-20180221005942-b7d4802280ae
|
||||
github.com/lestrrat/go-pdebug v0.0.0-20180220043741-569c97477ae8 // indirect
|
||||
@@ -153,9 +153,9 @@ require (
|
||||
yunion.io/x/jsonutils v0.0.0-20210709075951-798a67800349
|
||||
yunion.io/x/log v0.0.0-20201210064738-43181789dc74
|
||||
yunion.io/x/ovsdb v0.0.0-20200526071744-27bf0940cbc7
|
||||
yunion.io/x/pkg v0.0.0-20210721081124-55078288ca4c
|
||||
yunion.io/x/pkg v0.0.0-20210918114143-ce839f862c5f
|
||||
yunion.io/x/s3cli v0.0.0-20190917004522-13ac36d8687e
|
||||
yunion.io/x/sqlchemy v0.0.0-20210619142628-653684d2c4f8
|
||||
yunion.io/x/sqlchemy v0.0.0-20210918113031-c1c107f37ada
|
||||
yunion.io/x/structarg v0.0.0-20200720093445-9f850fa222ce
|
||||
)
|
||||
|
||||
|
||||
32
go.sum
32
go.sum
@@ -172,6 +172,8 @@ github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfc
|
||||
github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f h1:lBNOc5arjvs8E5mO2tbpBpLoyyu8B6e44T7hJy6potg=
|
||||
github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA=
|
||||
github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY=
|
||||
github.com/creack/pty v1.1.11 h1:07n33Z8lZxZ2qwegKbObQohDhXDQxiMMz1NOUGYlesw=
|
||||
github.com/creack/pty v1.1.11/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
@@ -224,8 +226,6 @@ github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk=
|
||||
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
|
||||
github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE=
|
||||
github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI=
|
||||
github.com/gin-gonic/gin v1.5.0 h1:fi+bqFAx/oLK54somfCtEZs9HeH1LHVoEPUgARpTqyc=
|
||||
github.com/gin-gonic/gin v1.5.0/go.mod h1:Nd6IXA8m5kNZdNEHMBd93KT+mdY3+bewLgRvmCsR2Do=
|
||||
github.com/gin-gonic/gin v1.7.0 h1:jGB9xAJQ12AIGNB4HguylppmDK1Am9ppF7XnGXXJuoU=
|
||||
github.com/gin-gonic/gin v1.7.0/go.mod h1:jD2toBW3GZUr5UMcdrwQA10I7RuaFOl/SGeDjXkfUtY=
|
||||
github.com/glycerine/go-unsnap-stream v0.0.0-20180323001048-9f0cb55181dd/go.mod h1:/20jfyN9Y5QPEAprSgKAUr+glWDY39ZiUEAYOEv5dsE=
|
||||
@@ -250,13 +250,10 @@ github.com/go-openapi/jsonpointer v0.0.0-20160704185906-46af16f9f7b1/go.mod h1:+
|
||||
github.com/go-openapi/jsonreference v0.0.0-20160704190145-13c6e3589ad9/go.mod h1:W3Z9FmVs9qj+KR4zFKmDPGiLdk1D9Rlm7cyMvf57TTg=
|
||||
github.com/go-openapi/spec v0.0.0-20160808142527-6aced65f8501/go.mod h1:J8+jY1nAiCcj+friV/PDoE1/3eeccG9LYBs0tYvLOWc=
|
||||
github.com/go-openapi/swag v0.0.0-20160704191624-1d0bd113de87/go.mod h1:DXUve3Dpr1UfpPtxFw+EFuQ41HhCWZfha5jSVRG7C7I=
|
||||
github.com/go-playground/assert/v2 v2.0.1 h1:MsBgLAaY856+nPRTKrp3/OZK38U/wa0CcBYNjji3q3A=
|
||||
github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
|
||||
github.com/go-playground/locales v0.12.1 h1:2FITxuFt/xuCNP1Acdhv62OzaCiviiE4kotfhkmOqEc=
|
||||
github.com/go-playground/locales v0.12.1/go.mod h1:IUMDtCfWo/w/mtMfIE/IG2K+Ey3ygWanZIBtBW0W2TM=
|
||||
github.com/go-playground/locales v0.13.0 h1:HyWk6mgj5qFqCT5fjGBuRArbVDfE4hi8+e8ceBS/t7Q=
|
||||
github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8=
|
||||
github.com/go-playground/universal-translator v0.16.0 h1:X++omBR/4cE2MNg91AoC3rmGrCjJ8eAeUP/K/EKx4DM=
|
||||
github.com/go-playground/universal-translator v0.16.0/go.mod h1:1AnU7NaIRDWWzGEKwgtJRd2xk99HeFyHw3yid4rvQIY=
|
||||
github.com/go-playground/universal-translator v0.17.0 h1:icxd5fm+REJzpZx7ZfpaD876Lmtgy7VtROAbHHXk8no=
|
||||
github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA=
|
||||
github.com/go-playground/validator/v10 v10.4.1 h1:pH2c5ADXtd66mxoE0Zm9SUhxE20r7aM3F26W0hOn+GE=
|
||||
@@ -342,8 +339,6 @@ github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORR
|
||||
github.com/gorilla/mux v1.7.0 h1:tOSd0UKHQd6urX6ApfOn4XdBMY6Sh1MfxV3kmaazO+U=
|
||||
github.com/gorilla/mux v1.7.0/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs=
|
||||
github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=
|
||||
github.com/gorilla/websocket v1.4.0 h1:WDFjx/TMzVgy9VdMMQi2K2Emtwi2QcUQsztZ/zLaH/Q=
|
||||
github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=
|
||||
github.com/gorilla/websocket v1.4.1 h1:q7AeDBpnBk8AogcD4DSag/Ukw/KV+YhzLj2bP5HvKCM=
|
||||
github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
|
||||
github.com/gosuri/uilive v0.0.0-20170323041506-ac356e6e42cd/go.mod h1:qkLSc0A5EXSP6B04TrN4oQoxqFI7A8XvoXSlJi8cwk8=
|
||||
@@ -411,12 +406,8 @@ github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORN
|
||||
github.com/kr/pretty v0.2.0 h1:s5hAObm+yFO5uHYt5dYjxi2rXrsnmRpJx4OYvIWUaQs=
|
||||
github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
|
||||
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||
github.com/kr/pty v1.1.5 h1:hyz3dwM5QLc1Rfoz4FuWJQG5BN7tc6K1MndAUnGpQr4=
|
||||
github.com/kr/pty v1.1.5/go.mod h1:9r2w37qlBe7rQ6e1fg1S/9xpWHSnaqNdHD3WcMdbPDA=
|
||||
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
|
||||
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||
github.com/leodido/go-urn v1.1.0 h1:Sm1gr51B1kKyfD2BlRcLSiEkffoG96g6TPv6eRoEiB8=
|
||||
github.com/leodido/go-urn v1.1.0/go.mod h1:+cyI34gQWZcE1eQU7NVgKkkzdXDQHr1dBMtdAPozLkw=
|
||||
github.com/leodido/go-urn v1.2.0 h1:hpXL4XnriNwQ/ABnpepYM/1vCLWNDfUNts8dX3xTG6Y=
|
||||
github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII=
|
||||
github.com/lestrrat-go/iter v0.0.0-20200422075355-fc1769541911 h1:FvnrqecqX4zT0wOIbYK1gNgTm0677INEWiFY8UEYggY=
|
||||
@@ -440,8 +431,6 @@ github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVc
|
||||
github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
|
||||
github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
|
||||
github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
|
||||
github.com/mattn/go-isatty v0.0.9 h1:d5US/mDsogSGW37IV293h//ZFaeajb69h+EHFsv2xGg=
|
||||
github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2yME+cCiQ=
|
||||
github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY=
|
||||
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
|
||||
github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
|
||||
@@ -471,8 +460,6 @@ github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b h1:j7+1HpAFS1zy5+Q4qx1f
|
||||
github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE=
|
||||
github.com/mholt/caddy v0.10.11 h1:s8X+R8DuBbrrMuUTcWSxlDe567B0s5EDmiDBKSYsioY=
|
||||
github.com/mholt/caddy v0.10.11/go.mod h1:Wb1PlT4DAYSqOEd03MsqkdkXnTxA8v9pKjdpxbqM1kY=
|
||||
github.com/miekg/dns v1.1.4 h1:rCMZsU2ScVSYcAsOXgmC6+AKOK+6pmQTOcw03nfwYV0=
|
||||
github.com/miekg/dns v1.1.4/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg=
|
||||
github.com/miekg/dns v1.1.25 h1:dFwPR6SfLtrSwgDcIq2bcU/gVutB4sNApq2HBdqcakg=
|
||||
github.com/miekg/dns v1.1.25/go.mod h1:bPDLeHnStXmXAq1m/Ch/hvfNHr14JKNPMBo3VZKjuso=
|
||||
github.com/mikioh/ipaddr v0.0.0-20190404000644-d465c8ab6721/go.mod h1:Ickgr2WtCLZ2MDGd4Gr0geeCH5HybhRJbonOgQpvSxc=
|
||||
@@ -755,7 +742,6 @@ golang.org/x/sys v0.0.0-20190606122018-79a91cf218c4/go.mod h1:h1NjWce9XRLGQEsW7w
|
||||
golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190830023255-19e00faab6ad/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190922100055-0a153f010e69/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
@@ -878,10 +864,6 @@ gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
|
||||
gopkg.in/fatih/set.v0 v0.2.1 h1:Xvyyp7LXu34P0ROhCyfXkmQCAoOUKb1E2JS9I7SE5CY=
|
||||
gopkg.in/fatih/set.v0 v0.2.1/go.mod h1:5eLWEndGL4zGGemXWrKuts+wTJR0y+w+auqUJZbmyBg=
|
||||
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
|
||||
gopkg.in/go-playground/assert.v1 v1.2.1 h1:xoYuJVE7KT85PYWrN730RguIQO0ePzVRfFMXadIrXTM=
|
||||
gopkg.in/go-playground/assert.v1 v1.2.1/go.mod h1:9RXL0bg/zibRAgZUYszZSwO/z8Y/a8bDuhia5mkpMnE=
|
||||
gopkg.in/go-playground/validator.v9 v9.29.1 h1:SvGtYmN60a5CVKTOzMSyfzWDeZRxRuGvRQyEAKbw1xc=
|
||||
gopkg.in/go-playground/validator.v9 v9.29.1/go.mod h1:+c9/zcJMFNgbLvly1L1V+PpxWdVbfP1avr/N00E2vyQ=
|
||||
gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc=
|
||||
gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw=
|
||||
gopkg.in/ini.v1 v1.42.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
|
||||
@@ -941,11 +923,11 @@ yunion.io/x/ovsdb v0.0.0-20200526071744-27bf0940cbc7/go.mod h1:0vLkNEhlmA64HViPB
|
||||
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 v0.0.0-20200814072949-4f1b541857d6/go.mod h1:t6rEGG2sQ4J7DhFxSZVOTjNd0YO/KlfWQyK1W4tog+E=
|
||||
yunion.io/x/pkg v0.0.0-20210721081124-55078288ca4c h1:/ejlt78/0xod4bdkEThUuYsQ7vLajd48wpL2GMMSaXs=
|
||||
yunion.io/x/pkg v0.0.0-20210721081124-55078288ca4c/go.mod h1:t6rEGG2sQ4J7DhFxSZVOTjNd0YO/KlfWQyK1W4tog+E=
|
||||
yunion.io/x/pkg v0.0.0-20210918114143-ce839f862c5f h1:maply0f3AsvoXqkpTKkb6/tZFbRAT/rdkk1Cw3FkoB8=
|
||||
yunion.io/x/pkg v0.0.0-20210918114143-ce839f862c5f/go.mod h1:t6rEGG2sQ4J7DhFxSZVOTjNd0YO/KlfWQyK1W4tog+E=
|
||||
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 v0.0.0-20210619142628-653684d2c4f8 h1:+kywPlOttXAZvbxsVqR73B5GbSVgG3Xdo4socLWRkcg=
|
||||
yunion.io/x/sqlchemy v0.0.0-20210619142628-653684d2c4f8/go.mod h1:FTdwPdGhMgh4E+UFXc9klI1Ok34fMuybTT+jLhOaIjI=
|
||||
yunion.io/x/sqlchemy v0.0.0-20210918113031-c1c107f37ada h1:ZIhSSwFHfnzPMKSyiN0nkGwvC6RUeuCIAnWuTtDS900=
|
||||
yunion.io/x/sqlchemy v0.0.0-20210918113031-c1c107f37ada/go.mod h1:FTdwPdGhMgh4E+UFXc9klI1Ok34fMuybTT+jLhOaIjI=
|
||||
yunion.io/x/structarg v0.0.0-20200720093445-9f850fa222ce h1:kU8xE7O5uZ1GSJVMZHoJ+jrNL7csUQHYGyAPW9QfNpE=
|
||||
yunion.io/x/structarg v0.0.0-20200720093445-9f850fa222ce/go.mod h1:EP6NSv2C0zzqBDTKumv8hPWLb3XvgMZDHQRfyuOrQng=
|
||||
|
||||
@@ -121,7 +121,7 @@ func (man *SAnsiblePlaybookManager) InitializeData() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (apb *SAnsiblePlaybook) ValidateDeleteCondition(ctx context.Context) error {
|
||||
func (apb *SAnsiblePlaybook) ValidateDeleteCondition(ctx context.Context, info jsonutils.JSONObject) error {
|
||||
if apb.Status == api.AnsiblePlaybookStatusRunning {
|
||||
return httperrors.NewConflictError("playbook is in running state")
|
||||
}
|
||||
|
||||
@@ -118,7 +118,7 @@ func (man *SAnsiblePlaybookV2Manager) InitializeData() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (apb *SAnsiblePlaybookV2) ValidateDeleteCondition(ctx context.Context) error {
|
||||
func (apb *SAnsiblePlaybookV2) ValidateDeleteCondition(ctx context.Context, info jsonutils.JSONObject) error {
|
||||
if apb.Status == api.AnsiblePlaybookStatusRunning {
|
||||
return httperrors.NewConflictError("playbook is in running state")
|
||||
}
|
||||
|
||||
@@ -185,7 +185,22 @@ func (h *AuthHandlers) GetRegionsResponse(ctx context.Context, w http.ResponseWr
|
||||
|
||||
resp.Add(jsonutils.NewArray(retIdps...), "idps")
|
||||
|
||||
resp.Add(jsonutils.NewString(options.Options.ApiServer), "api_server")
|
||||
// in case api_server changed but not synchronized from Keystone
|
||||
// fetch this option directly from Keystone
|
||||
var apiSrv string
|
||||
commonCfg, err := modules.ServicesV3.GetSpecific(s, "common", "config", nil)
|
||||
if err != nil {
|
||||
log.Errorf("fetch common config error: %s", err)
|
||||
} else {
|
||||
apiSrv, err = commonCfg.GetString("config", "default", "api_server")
|
||||
if err != nil {
|
||||
log.Errorf("fetch api_server fail: %s (cfg: %s)", err, commonCfg)
|
||||
}
|
||||
}
|
||||
if len(apiSrv) == 0 {
|
||||
apiSrv = options.Options.ApiServer
|
||||
}
|
||||
resp.Add(jsonutils.NewString(apiSrv), "api_server")
|
||||
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
@@ -346,8 +346,9 @@ func (mh *MiscHandler) DoBatchUserRegister(ctx context.Context, w http.ResponseW
|
||||
rowIdx := i + 2
|
||||
name := row[0]
|
||||
password := row[1]
|
||||
domain := row[2]
|
||||
allowWebConsole := strings.ToLower(row[3])
|
||||
displayname := row[2]
|
||||
domain := row[3]
|
||||
allowWebConsole := strings.ToLower(row[4])
|
||||
|
||||
// 忽略空白行
|
||||
rowStr := strings.Join(row, "")
|
||||
@@ -361,6 +362,10 @@ func (mh *MiscHandler) DoBatchUserRegister(ctx context.Context, w http.ResponseW
|
||||
return
|
||||
}
|
||||
|
||||
if len(displayname) == 0 {
|
||||
displayname = name
|
||||
}
|
||||
|
||||
if len(password) == 0 {
|
||||
e := httperrors.NewClientError("row %d password is empty", rowIdx)
|
||||
httperrors.JsonClientError(ctx, w, e)
|
||||
@@ -401,6 +406,7 @@ func (mh *MiscHandler) DoBatchUserRegister(ctx context.Context, w http.ResponseW
|
||||
|
||||
user := jsonutils.NewDict()
|
||||
user.Add(jsonutils.NewString(name), "name")
|
||||
user.Add(jsonutils.NewString(displayname), "displayname")
|
||||
user.Add(jsonutils.NewString(domainId), "domain_id")
|
||||
if len(password) > 0 {
|
||||
user.Add(jsonutils.NewString(password), "password")
|
||||
@@ -468,7 +474,7 @@ func (mh *MiscHandler) getDownloadsHandler(ctx context.Context, w http.ResponseW
|
||||
return
|
||||
}
|
||||
case "BatchUserRegister":
|
||||
records := [][]string{{"*用户名(user)", "*用户密码(password)", "*部门/域(domain)", "*是否登录控制台(allow_web_console:true、false)"}}
|
||||
records := [][]string{{"*用户名(user)", "*用户密码(password)", "*显示名(displayname)", "*部门/域(domain)", "*是否登录控制台(allow_web_console:true、false)"}}
|
||||
content, err = writeXlsx("users", records)
|
||||
if err != nil {
|
||||
httperrors.InternalServerError(ctx, w, "internal server error")
|
||||
|
||||
@@ -26,7 +26,7 @@ type GatewayOptions struct {
|
||||
|
||||
DisableModuleApiVersion bool `help:"Disable each modules default api version" default:"false"`
|
||||
|
||||
EnableTotp bool `help:"Enable two-factor authentication" default:"true"`
|
||||
EnableTotp bool `help:"Enable two-factor authentication" default:"false"`
|
||||
|
||||
SsoRedirectUrl string `help:"SSO idp redirect URL"`
|
||||
SsoAuthCallbackUrl string `help:"SSO idp auth callback URL"`
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
package apihelper
|
||||
|
||||
import (
|
||||
"yunion.io/x/jsonutils"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/cloudcommon/db"
|
||||
mcclient "yunion.io/x/onecloud/pkg/mcclient"
|
||||
mcclient_modulebase "yunion.io/x/onecloud/pkg/mcclient/modulebase"
|
||||
@@ -44,6 +46,14 @@ type IModelSetEmulatedIncluder interface {
|
||||
IncludeEmulated() bool
|
||||
}
|
||||
|
||||
type IModelSetFilter interface {
|
||||
ModelFilter() []string
|
||||
}
|
||||
|
||||
type IModelListParam interface {
|
||||
ModelParamFilter() jsonutils.JSONObject
|
||||
}
|
||||
|
||||
func SyncModelSets(mssOld IModelSets, s *mcclient.ClientSession, opt *Options) (r ModelSetsUpdateResult, err error) {
|
||||
mss := mssOld.ModelSetList()
|
||||
mssNews := mssOld.NewEmpty()
|
||||
|
||||
@@ -120,6 +120,10 @@ func GetModels(opts *GetModelsOptions) error {
|
||||
"cloud_env=onpremise",
|
||||
)
|
||||
}
|
||||
if inter, ok := opts.ModelSet.(IModelSetFilter); ok {
|
||||
filter := inter.ModelFilter()
|
||||
listOptions.Filter = append(listOptions.Filter, filter...)
|
||||
}
|
||||
if !minUpdatedAt.Equal(PseudoZeroTime) {
|
||||
// Only fetching pending deletes when we are doing incremental fetch
|
||||
listOptions.PendingDeleteAll = options.Bool(true)
|
||||
@@ -129,6 +133,10 @@ func GetModels(opts *GetModelsOptions) error {
|
||||
if err != nil {
|
||||
return fmt.Errorf("%s: making list params: %s", manKeyPlural, err)
|
||||
}
|
||||
if inter, ok := opts.ModelSet.(IModelListParam); ok {
|
||||
filter := inter.ModelParamFilter()
|
||||
params.Update(filter)
|
||||
}
|
||||
//XXX
|
||||
//params.Set(api.LBAGENT_QUERY_ORIG_KEY, jsonutils.NewString(api.LBAGENT_QUERY_ORIG_VAL))
|
||||
|
||||
|
||||
@@ -30,7 +30,8 @@ type ProxyEndpointCreateInput struct {
|
||||
}
|
||||
|
||||
type ProxyEndpointCreateFromServerInput struct {
|
||||
Name string
|
||||
Name string
|
||||
GenerateName string
|
||||
|
||||
ServerId string
|
||||
}
|
||||
|
||||
@@ -396,6 +396,10 @@ type ServerCreateInput struct {
|
||||
// emulate: BIOS, UEFI
|
||||
Bios string `json:"bios"`
|
||||
|
||||
// Machine类型
|
||||
// emulate: pc, q35
|
||||
Machine string `json:"machine"`
|
||||
|
||||
// 启动顺序
|
||||
// c: cdrome
|
||||
// d: disk
|
||||
@@ -543,19 +547,6 @@ type ServerCloneInput struct {
|
||||
PreferHostId string `json:"prefer_host_id"`
|
||||
}
|
||||
|
||||
type ServerDeployInput struct {
|
||||
apis.Meta
|
||||
|
||||
Id string
|
||||
|
||||
Keypair string `json:"keypair"`
|
||||
DeleteKeypair *bool `json:"__delete_keypair__"`
|
||||
DeployConfigs []*DeployConfig `json:"deploy_configs"`
|
||||
ResetPassword *bool `json:"reset_password"`
|
||||
Password string `json:"password"`
|
||||
AutoStart *bool `json:"auto_start"`
|
||||
}
|
||||
|
||||
type GuestBatchMigrateRequest struct {
|
||||
apis.Meta
|
||||
|
||||
|
||||
@@ -29,12 +29,13 @@ const (
|
||||
|
||||
DEFAULT_DISK_TYPE = DISK_TYPE_ROTATE
|
||||
|
||||
DISK_DRIVER_MEGARAID = "MegaRaid"
|
||||
DISK_DRIVER_LINUX = "Linux"
|
||||
DISK_DRIVER_HPSARAID = "HPSARaid"
|
||||
DISK_DRIVER_MPT2SAS = "Mpt2SAS"
|
||||
DISK_DRIVER_MARVELRAID = "MarvelRaid"
|
||||
DISK_DRIVER_PCIE = "PCIE"
|
||||
DISK_DRIVER_MEGARAID = "MegaRaid"
|
||||
DISK_DRIVER_LINUX = "Linux"
|
||||
DISK_DRIVER_HPSARAID = "HPSARaid"
|
||||
DISK_DRIVER_MPT2SAS = "Mpt2SAS"
|
||||
DISK_DRIVER_MARVELRAID = "MarvelRaid"
|
||||
DISK_DRIVER_ADAPTECRAID = "AdaptecRaid"
|
||||
DISK_DRIVER_PCIE = "PCIE"
|
||||
|
||||
HDD_DISK_SPEC_TYPE = "HDD"
|
||||
SSD_DISK_SPEC_TYPE = "SSD"
|
||||
@@ -60,6 +61,7 @@ var (
|
||||
DISK_DRIVER_HPSARAID,
|
||||
DISK_DRIVER_MPT2SAS,
|
||||
DISK_DRIVER_MARVELRAID,
|
||||
DISK_DRIVER_ADAPTECRAID,
|
||||
)
|
||||
|
||||
DISK_DRIVERS = sets.NewString(
|
||||
|
||||
22
pkg/apis/compute/cdrom.go
Normal file
22
pkg/apis/compute/cdrom.go
Normal file
@@ -0,0 +1,22 @@
|
||||
// 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 GuestcdromJsonDesc struct {
|
||||
ImageId string `json:"image_id"`
|
||||
Path string `json:"path"`
|
||||
Name string `json:"name"`
|
||||
Size int64 `json:"size"`
|
||||
}
|
||||
@@ -36,23 +36,23 @@ const (
|
||||
CLOUD_PROVIDER_SYNC_STATUS_IDLE = "idle"
|
||||
CLOUD_PROVIDER_SYNC_STATUS_ERROR = "error"
|
||||
|
||||
CLOUD_PROVIDER_ONECLOUD = "OneCloud"
|
||||
CLOUD_PROVIDER_VMWARE = "VMware"
|
||||
CLOUD_PROVIDER_ALIYUN = "Aliyun"
|
||||
CLOUD_PROVIDER_APSARA = "Apsara"
|
||||
CLOUD_PROVIDER_QCLOUD = "Qcloud"
|
||||
CLOUD_PROVIDER_AZURE = "Azure"
|
||||
CLOUD_PROVIDER_AWS = "Aws"
|
||||
CLOUD_PROVIDER_HUAWEI = "Huawei"
|
||||
CLOUD_PROVIDER_HUAWEI_CLOUD_STACK = "HuaweiCloudStack"
|
||||
CLOUD_PROVIDER_OPENSTACK = "OpenStack"
|
||||
CLOUD_PROVIDER_UCLOUD = "Ucloud"
|
||||
CLOUD_PROVIDER_ZSTACK = "ZStack"
|
||||
CLOUD_PROVIDER_GOOGLE = "Google"
|
||||
CLOUD_PROVIDER_CTYUN = "Ctyun"
|
||||
CLOUD_PROVIDER_ECLOUD = "Ecloud"
|
||||
CLOUD_PROVIDER_JDCLOUD = "JDcloud"
|
||||
CLOUD_PROVIDER_CLOUDPODS = "Cloudpods"
|
||||
CLOUD_PROVIDER_ONECLOUD = "OneCloud"
|
||||
CLOUD_PROVIDER_VMWARE = "VMware"
|
||||
CLOUD_PROVIDER_ALIYUN = "Aliyun"
|
||||
CLOUD_PROVIDER_APSARA = "Apsara"
|
||||
CLOUD_PROVIDER_QCLOUD = "Qcloud"
|
||||
CLOUD_PROVIDER_AZURE = "Azure"
|
||||
CLOUD_PROVIDER_AWS = "Aws"
|
||||
CLOUD_PROVIDER_HUAWEI = "Huawei"
|
||||
CLOUD_PROVIDER_HCSO = "HCSO"
|
||||
CLOUD_PROVIDER_OPENSTACK = "OpenStack"
|
||||
CLOUD_PROVIDER_UCLOUD = "Ucloud"
|
||||
CLOUD_PROVIDER_ZSTACK = "ZStack"
|
||||
CLOUD_PROVIDER_GOOGLE = "Google"
|
||||
CLOUD_PROVIDER_CTYUN = "Ctyun"
|
||||
CLOUD_PROVIDER_ECLOUD = "Ecloud"
|
||||
CLOUD_PROVIDER_JDCLOUD = "JDcloud"
|
||||
CLOUD_PROVIDER_CLOUDPODS = "Cloudpods"
|
||||
|
||||
CLOUD_PROVIDER_GENERICS3 = "S3"
|
||||
CLOUD_PROVIDER_CEPH = "Ceph"
|
||||
@@ -98,7 +98,7 @@ const (
|
||||
var (
|
||||
CLOUD_PROVIDER_VALID_STATUS = []string{CLOUD_PROVIDER_CONNECTED}
|
||||
CLOUD_PROVIDER_VALID_HEALTH_STATUS = []string{CLOUD_PROVIDER_HEALTH_NORMAL, CLOUD_PROVIDER_HEALTH_NO_PERMISSION}
|
||||
PRIVATE_CLOUD_PROVIDERS = []string{CLOUD_PROVIDER_ZSTACK, CLOUD_PROVIDER_OPENSTACK, CLOUD_PROVIDER_APSARA, CLOUD_PROVIDER_HUAWEI_CLOUD_STACK}
|
||||
PRIVATE_CLOUD_PROVIDERS = []string{CLOUD_PROVIDER_ZSTACK, CLOUD_PROVIDER_OPENSTACK, CLOUD_PROVIDER_APSARA, CLOUD_PROVIDER_HCSO}
|
||||
|
||||
CLOUD_PROVIDERS = []string{
|
||||
CLOUD_PROVIDER_ONECLOUD,
|
||||
@@ -109,7 +109,7 @@ var (
|
||||
CLOUD_PROVIDER_AZURE,
|
||||
CLOUD_PROVIDER_AWS,
|
||||
CLOUD_PROVIDER_HUAWEI,
|
||||
CLOUD_PROVIDER_HUAWEI_CLOUD_STACK,
|
||||
CLOUD_PROVIDER_HCSO,
|
||||
CLOUD_PROVIDER_OPENSTACK,
|
||||
CLOUD_PROVIDER_UCLOUD,
|
||||
CLOUD_PROVIDER_ZSTACK,
|
||||
@@ -147,8 +147,8 @@ var (
|
||||
CLOUD_PROVIDER_HUAWEI: []string{
|
||||
HOST_TYPE_HUAWEI,
|
||||
},
|
||||
CLOUD_PROVIDER_HUAWEI_CLOUD_STACK: {
|
||||
HOST_TYPE_HUAWEI_CLOUD_STACK,
|
||||
CLOUD_PROVIDER_HCSO: {
|
||||
HOST_TYPE_HCSO,
|
||||
},
|
||||
CLOUD_PROVIDER_OPENSTACK: []string{
|
||||
HOST_TYPE_OPENSTACK,
|
||||
|
||||
@@ -39,6 +39,9 @@ type CloudproviderregionDetails struct {
|
||||
// example: 300
|
||||
SyncIntervalSeconds int `json:"sync_interval_seconds"`
|
||||
|
||||
// 云订阅同步状态
|
||||
CloudproviderSyncStatus string `json:"cloudprovider_sync_status"`
|
||||
|
||||
// 支持服务列表
|
||||
Capabilities []string `json:"capabilities"`
|
||||
}
|
||||
|
||||
@@ -67,6 +67,7 @@ const (
|
||||
CITY_XIA_MEN = "XiaMen" //厦门
|
||||
CITY_HUAI_NAN = "HuaiNan" //淮南
|
||||
CITY_SU_QIAN = "SuQian" //宿迁
|
||||
CITY_DA_LIAN = "Dalian" //大连
|
||||
|
||||
// 日本
|
||||
CITY_TOKYO = "Tokyo" //东京
|
||||
@@ -101,6 +102,7 @@ const (
|
||||
CITY_JAKARTA = "Jakarta" //雅加达
|
||||
|
||||
// 印度
|
||||
CITY_DELHI = "Delhi" // 德里
|
||||
CITY_MUMBAI = "Mumbai" //孟买
|
||||
CITY_KANCHIPURAM = "Kanchipuram" //甘吉布勒姆
|
||||
CITY_MAHARASHTRA = "Maharashtra" //马哈拉施特拉邦
|
||||
@@ -159,6 +161,9 @@ const (
|
||||
// 瑞典
|
||||
CITY_STOCKHOLM = "Stockholm" //斯德哥尔摩
|
||||
|
||||
// 波兰
|
||||
CITY_WARSAW = "Warsaw" // 华沙
|
||||
|
||||
// 巴西
|
||||
CITY_SAO_PAULO = "Sao Paulo" //圣保罗
|
||||
CITY_RIO_DE_JANEIRO = "Rio de Janeiro" // 里约热内卢
|
||||
@@ -220,4 +225,7 @@ const (
|
||||
COUNTRY_CODE_MX = "MX" //墨西哥
|
||||
COUNTRY_CODE_CL = "CL" //智利
|
||||
COUNTRY_CODE_BH = "BH" //巴林
|
||||
COUNTRY_CODE_PL = "PL" //波兰
|
||||
COUNTRY_CODE_FI = "FI" //芬兰
|
||||
COUNTRY_CODE_BE = "BE" //比利时
|
||||
)
|
||||
|
||||
@@ -22,6 +22,7 @@ import (
|
||||
"yunion.io/x/onecloud/pkg/apis"
|
||||
"yunion.io/x/onecloud/pkg/apis/billing"
|
||||
"yunion.io/x/onecloud/pkg/httperrors"
|
||||
"yunion.io/x/onecloud/pkg/multicloud/esxi/vcenter"
|
||||
)
|
||||
|
||||
type DiskCreateInput struct {
|
||||
@@ -265,3 +266,24 @@ func (self DiskResizeInput) SizeMb() (int, error) {
|
||||
}
|
||||
return fileutils.GetSizeMb(self.Size, 'M', 1024)
|
||||
}
|
||||
|
||||
type DiskAllocateInput struct {
|
||||
Format string
|
||||
DiskSizeMb int
|
||||
ImageId string
|
||||
FsFormat string
|
||||
Encryption bool
|
||||
Rebuild bool
|
||||
BackingDiskId string
|
||||
SnapshotId string
|
||||
|
||||
SnapshotUrl string
|
||||
SnapshotOutOfChain bool
|
||||
Protocol string
|
||||
SrcDiskId string
|
||||
SrcPool string
|
||||
|
||||
// vmware
|
||||
HostIp string
|
||||
Datastore vcenter.SVCenterAccessInfo
|
||||
}
|
||||
|
||||
@@ -43,6 +43,9 @@ const (
|
||||
DISK_POST_MIGRATE = "post_migrate"
|
||||
DISK_MIGRATING = "migrating"
|
||||
|
||||
DISK_CLONE = "clone"
|
||||
DISK_CLONE_FAIL = "clone_failed"
|
||||
|
||||
DISK_START_SNAPSHOT = "start_snapshot"
|
||||
DISK_SNAPSHOTING = "snapshoting"
|
||||
DISK_APPLY_SNAPSHOT_FAIL = "apply_snapshot_failed"
|
||||
|
||||
@@ -125,7 +125,7 @@ type DnsZoneDetails struct {
|
||||
// 关联vpc数量
|
||||
VpcCount int `json:"vpc_count"`
|
||||
// Cache info
|
||||
CloudCaches []DnsZoneCacheDetails `json:"cloud_caches"`
|
||||
CloudCaches []jsonutils.JSONObject `json:"cloud_caches"`
|
||||
}
|
||||
|
||||
type DnsZoneListInput struct {
|
||||
@@ -141,7 +141,8 @@ type DnsZoneListInput struct {
|
||||
ZoneType string `json:"zone_type"`
|
||||
|
||||
// Filter dns zone By vpc
|
||||
VpcId string `json:"vpc_id"`
|
||||
VpcId string `json:"vpc_id"`
|
||||
WithCache bool `json:"with_cache"`
|
||||
}
|
||||
|
||||
type DnsZoneSyncStatusInput struct {
|
||||
|
||||
@@ -77,15 +77,17 @@ const (
|
||||
VM_REBUILD_ROOT = "rebuild_root"
|
||||
VM_REBUILD_ROOT_FAIL = "rebuild_root_fail"
|
||||
|
||||
VM_START_SNAPSHOT = "snapshot_start"
|
||||
VM_SNAPSHOT = "snapshot"
|
||||
VM_SNAPSHOT_DELETE = "snapshot_delete"
|
||||
VM_BLOCK_STREAM = "block_stream"
|
||||
VM_BLOCK_STREAM_FAIL = "block_stream_fail"
|
||||
VM_SNAPSHOT_SUCC = "snapshot_succ"
|
||||
VM_SNAPSHOT_FAILED = "snapshot_failed"
|
||||
VM_DISK_RESET = "disk_reset"
|
||||
VM_DISK_RESET_FAIL = "disk_reset_failed"
|
||||
VM_START_SNAPSHOT = "snapshot_start"
|
||||
VM_SNAPSHOT = "snapshot"
|
||||
VM_SNAPSHOT_DELETE = "snapshot_delete"
|
||||
VM_BLOCK_STREAM = "block_stream"
|
||||
VM_BLOCK_STREAM_FAIL = "block_stream_fail"
|
||||
VM_SNAPSHOT_SUCC = "snapshot_succ"
|
||||
VM_SNAPSHOT_FAILED = "snapshot_failed"
|
||||
VM_DISK_RESET = "disk_reset"
|
||||
VM_DISK_RESET_FAIL = "disk_reset_failed"
|
||||
VM_DISK_CHANGE_STORAGE = "disk_change_storage"
|
||||
VM_DISK_CHANGE_STORAGE_FAIL = "disk_change_storage_fail"
|
||||
|
||||
VM_START_INSTANCE_SNAPSHOT = "start_instance_snapshot"
|
||||
VM_INSTANCE_SNAPSHOT_FAILED = "instance_snapshot_failed"
|
||||
@@ -153,21 +155,21 @@ const (
|
||||
HYPERVISOR_HYPERV = "hyperv"
|
||||
HYPERVISOR_XEN = "xen"
|
||||
|
||||
HYPERVISOR_ALIYUN = "aliyun"
|
||||
HYPERVISOR_APSARA = "apsara"
|
||||
HYPERVISOR_QCLOUD = "qcloud"
|
||||
HYPERVISOR_AZURE = "azure"
|
||||
HYPERVISOR_AWS = "aws"
|
||||
HYPERVISOR_HUAWEI = "huawei"
|
||||
HYPERVISOR_HUAWEI_CLOUD_STACK = "huaweicloudstack"
|
||||
HYPERVISOR_OPENSTACK = "openstack"
|
||||
HYPERVISOR_UCLOUD = "ucloud"
|
||||
HYPERVISOR_ZSTACK = "zstack"
|
||||
HYPERVISOR_GOOGLE = "google"
|
||||
HYPERVISOR_CTYUN = "ctyun"
|
||||
HYPERVISOR_ECLOUD = "ecloud"
|
||||
HYPERVISOR_JDCLOUD = "jdcloud"
|
||||
HYPERVISOR_CLOUDPODS = "cloudpods"
|
||||
HYPERVISOR_ALIYUN = "aliyun"
|
||||
HYPERVISOR_APSARA = "apsara"
|
||||
HYPERVISOR_QCLOUD = "qcloud"
|
||||
HYPERVISOR_AZURE = "azure"
|
||||
HYPERVISOR_AWS = "aws"
|
||||
HYPERVISOR_HUAWEI = "huawei"
|
||||
HYPERVISOR_HCSO = "hcso"
|
||||
HYPERVISOR_OPENSTACK = "openstack"
|
||||
HYPERVISOR_UCLOUD = "ucloud"
|
||||
HYPERVISOR_ZSTACK = "zstack"
|
||||
HYPERVISOR_GOOGLE = "google"
|
||||
HYPERVISOR_CTYUN = "ctyun"
|
||||
HYPERVISOR_ECLOUD = "ecloud"
|
||||
HYPERVISOR_JDCLOUD = "jdcloud"
|
||||
HYPERVISOR_CLOUDPODS = "cloudpods"
|
||||
|
||||
// HYPERVISOR_DEFAULT = HYPERVISOR_KVM
|
||||
HYPERVISOR_DEFAULT = HYPERVISOR_KVM
|
||||
@@ -178,6 +180,11 @@ const (
|
||||
CPU_MODE_HOST = "host"
|
||||
)
|
||||
|
||||
const (
|
||||
VM_MACHINE_TYPE_PC = "pc"
|
||||
VM_MACHINE_TYPE_Q35 = "q35"
|
||||
)
|
||||
|
||||
var VM_RUNNING_STATUS = []string{VM_START_START, VM_STARTING, VM_RUNNING, VM_BLOCK_STREAM, VM_BLOCK_STREAM_FAIL}
|
||||
var VM_CREATING_STATUS = []string{VM_CREATE_NETWORK, VM_CREATE_DISK, VM_START_DEPLOY, VM_DEPLOYING}
|
||||
|
||||
@@ -192,7 +199,7 @@ var HYPERVISORS = []string{
|
||||
HYPERVISOR_AWS,
|
||||
HYPERVISOR_QCLOUD,
|
||||
HYPERVISOR_HUAWEI,
|
||||
HYPERVISOR_HUAWEI_CLOUD_STACK,
|
||||
HYPERVISOR_HCSO,
|
||||
HYPERVISOR_OPENSTACK,
|
||||
HYPERVISOR_UCLOUD,
|
||||
HYPERVISOR_ZSTACK,
|
||||
@@ -227,53 +234,53 @@ var PRIVATE_CLOUD_HYPERVISORS = []string{
|
||||
HYPERVISOR_OPENSTACK,
|
||||
HYPERVISOR_APSARA,
|
||||
HYPERVISOR_CLOUDPODS,
|
||||
HYPERVISOR_HUAWEI_CLOUD_STACK,
|
||||
HYPERVISOR_HCSO,
|
||||
}
|
||||
|
||||
// var HYPERVISORS = []string{HYPERVISOR_ALIYUN}
|
||||
|
||||
var HYPERVISOR_HOSTTYPE = map[string]string{
|
||||
HYPERVISOR_KVM: HOST_TYPE_HYPERVISOR,
|
||||
HYPERVISOR_BAREMETAL: HOST_TYPE_BAREMETAL,
|
||||
HYPERVISOR_ESXI: HOST_TYPE_ESXI,
|
||||
HYPERVISOR_CONTAINER: HOST_TYPE_KUBELET,
|
||||
HYPERVISOR_ALIYUN: HOST_TYPE_ALIYUN,
|
||||
HYPERVISOR_APSARA: HOST_TYPE_APSARA,
|
||||
HYPERVISOR_AZURE: HOST_TYPE_AZURE,
|
||||
HYPERVISOR_AWS: HOST_TYPE_AWS,
|
||||
HYPERVISOR_QCLOUD: HOST_TYPE_QCLOUD,
|
||||
HYPERVISOR_HUAWEI: HOST_TYPE_HUAWEI,
|
||||
HYPERVISOR_HUAWEI_CLOUD_STACK: HOST_TYPE_HUAWEI_CLOUD_STACK,
|
||||
HYPERVISOR_OPENSTACK: HOST_TYPE_OPENSTACK,
|
||||
HYPERVISOR_UCLOUD: HOST_TYPE_UCLOUD,
|
||||
HYPERVISOR_ZSTACK: HOST_TYPE_ZSTACK,
|
||||
HYPERVISOR_GOOGLE: HOST_TYPE_GOOGLE,
|
||||
HYPERVISOR_CTYUN: HOST_TYPE_CTYUN,
|
||||
HYPERVISOR_ECLOUD: HOST_TYPE_ECLOUD,
|
||||
HYPERVISOR_JDCLOUD: HOST_TYPE_JDCLOUD,
|
||||
HYPERVISOR_CLOUDPODS: HOST_TYPE_CLOUDPODS,
|
||||
HYPERVISOR_KVM: HOST_TYPE_HYPERVISOR,
|
||||
HYPERVISOR_BAREMETAL: HOST_TYPE_BAREMETAL,
|
||||
HYPERVISOR_ESXI: HOST_TYPE_ESXI,
|
||||
HYPERVISOR_CONTAINER: HOST_TYPE_KUBELET,
|
||||
HYPERVISOR_ALIYUN: HOST_TYPE_ALIYUN,
|
||||
HYPERVISOR_APSARA: HOST_TYPE_APSARA,
|
||||
HYPERVISOR_AZURE: HOST_TYPE_AZURE,
|
||||
HYPERVISOR_AWS: HOST_TYPE_AWS,
|
||||
HYPERVISOR_QCLOUD: HOST_TYPE_QCLOUD,
|
||||
HYPERVISOR_HUAWEI: HOST_TYPE_HUAWEI,
|
||||
HYPERVISOR_HCSO: HOST_TYPE_HCSO,
|
||||
HYPERVISOR_OPENSTACK: HOST_TYPE_OPENSTACK,
|
||||
HYPERVISOR_UCLOUD: HOST_TYPE_UCLOUD,
|
||||
HYPERVISOR_ZSTACK: HOST_TYPE_ZSTACK,
|
||||
HYPERVISOR_GOOGLE: HOST_TYPE_GOOGLE,
|
||||
HYPERVISOR_CTYUN: HOST_TYPE_CTYUN,
|
||||
HYPERVISOR_ECLOUD: HOST_TYPE_ECLOUD,
|
||||
HYPERVISOR_JDCLOUD: HOST_TYPE_JDCLOUD,
|
||||
HYPERVISOR_CLOUDPODS: HOST_TYPE_CLOUDPODS,
|
||||
}
|
||||
|
||||
var HOSTTYPE_HYPERVISOR = map[string]string{
|
||||
HOST_TYPE_HYPERVISOR: HYPERVISOR_KVM,
|
||||
HOST_TYPE_BAREMETAL: HYPERVISOR_BAREMETAL,
|
||||
HOST_TYPE_ESXI: HYPERVISOR_ESXI,
|
||||
HOST_TYPE_KUBELET: HYPERVISOR_CONTAINER,
|
||||
HOST_TYPE_ALIYUN: HYPERVISOR_ALIYUN,
|
||||
HOST_TYPE_APSARA: HYPERVISOR_APSARA,
|
||||
HOST_TYPE_AZURE: HYPERVISOR_AZURE,
|
||||
HOST_TYPE_AWS: HYPERVISOR_AWS,
|
||||
HOST_TYPE_QCLOUD: HYPERVISOR_QCLOUD,
|
||||
HOST_TYPE_HUAWEI: HYPERVISOR_HUAWEI,
|
||||
HOST_TYPE_HUAWEI_CLOUD_STACK: HYPERVISOR_HUAWEI_CLOUD_STACK,
|
||||
HOST_TYPE_OPENSTACK: HYPERVISOR_OPENSTACK,
|
||||
HOST_TYPE_UCLOUD: HYPERVISOR_UCLOUD,
|
||||
HOST_TYPE_ZSTACK: HYPERVISOR_ZSTACK,
|
||||
HOST_TYPE_GOOGLE: HYPERVISOR_GOOGLE,
|
||||
HOST_TYPE_CTYUN: HYPERVISOR_CTYUN,
|
||||
HOST_TYPE_ECLOUD: HYPERVISOR_ECLOUD,
|
||||
HOST_TYPE_JDCLOUD: HYPERVISOR_JDCLOUD,
|
||||
HOST_TYPE_CLOUDPODS: HYPERVISOR_CLOUDPODS,
|
||||
HOST_TYPE_HYPERVISOR: HYPERVISOR_KVM,
|
||||
HOST_TYPE_BAREMETAL: HYPERVISOR_BAREMETAL,
|
||||
HOST_TYPE_ESXI: HYPERVISOR_ESXI,
|
||||
HOST_TYPE_KUBELET: HYPERVISOR_CONTAINER,
|
||||
HOST_TYPE_ALIYUN: HYPERVISOR_ALIYUN,
|
||||
HOST_TYPE_APSARA: HYPERVISOR_APSARA,
|
||||
HOST_TYPE_AZURE: HYPERVISOR_AZURE,
|
||||
HOST_TYPE_AWS: HYPERVISOR_AWS,
|
||||
HOST_TYPE_QCLOUD: HYPERVISOR_QCLOUD,
|
||||
HOST_TYPE_HUAWEI: HYPERVISOR_HUAWEI,
|
||||
HOST_TYPE_HCSO: HYPERVISOR_HCSO,
|
||||
HOST_TYPE_OPENSTACK: HYPERVISOR_OPENSTACK,
|
||||
HOST_TYPE_UCLOUD: HYPERVISOR_UCLOUD,
|
||||
HOST_TYPE_ZSTACK: HYPERVISOR_ZSTACK,
|
||||
HOST_TYPE_GOOGLE: HYPERVISOR_GOOGLE,
|
||||
HOST_TYPE_CTYUN: HYPERVISOR_CTYUN,
|
||||
HOST_TYPE_ECLOUD: HYPERVISOR_ECLOUD,
|
||||
HOST_TYPE_JDCLOUD: HYPERVISOR_JDCLOUD,
|
||||
HOST_TYPE_CLOUDPODS: HYPERVISOR_CLOUDPODS,
|
||||
}
|
||||
|
||||
const (
|
||||
|
||||
@@ -66,3 +66,35 @@ type GuestdiskUpdateInput struct {
|
||||
|
||||
Index *int8 `json:"index"`
|
||||
}
|
||||
|
||||
type GuestdiskJsonDesc struct {
|
||||
DiskId string `json:"disk_id"`
|
||||
Driver string `json:"driver"`
|
||||
CacheMode string `json:"cache_mode"`
|
||||
AioMode string `json:"aio_mode"`
|
||||
Iops int `json:"iops"`
|
||||
Bps int `json:"bps"`
|
||||
Size int `json:"size"`
|
||||
TemplateId string `json:"template_id"`
|
||||
ImagePath string `json:"image_path"`
|
||||
StorageId string `json:"storage_id"`
|
||||
Migrating bool `json:"migrating"`
|
||||
Path string `json:"path"`
|
||||
Format string `json:"format"`
|
||||
Index int8 `json:"index"`
|
||||
MergeSnapshot bool `json:"merge_snapshot"`
|
||||
EsxiFlatFilePath string `json:"esxi_flat_file_path"`
|
||||
Fs string `json:"fs"`
|
||||
Mountpoint string `json:"mountpoint"`
|
||||
Dev string `json:"dev"`
|
||||
IsSSD bool `json:"is_ssd"`
|
||||
|
||||
// esxi
|
||||
ImageInfo struct {
|
||||
ImageType string `json:"image_type"`
|
||||
ImageExternalId string `json:"image_external_id"`
|
||||
StorageCacheHostIp string `json:"storage_cache_host_ip"`
|
||||
} `json:"image_info"`
|
||||
|
||||
TargetStorageId string `json:"target_storage_id"`
|
||||
}
|
||||
|
||||
@@ -18,6 +18,8 @@ const (
|
||||
MIRROR_JOB = "__mirror_job_status"
|
||||
MIRROR_JOB_READY = "ready"
|
||||
MIRROR_JOB_FAILED = "failed"
|
||||
|
||||
SSH_PORT = "__ssh_port"
|
||||
)
|
||||
|
||||
const BASE_INSTANCE_SNAPSHOT_ID = "__base_instance_snapshot_id"
|
||||
|
||||
@@ -44,10 +44,18 @@ type GuestSshableOutput struct {
|
||||
MethodTried []GuestSshableMethodData
|
||||
}
|
||||
|
||||
type GuestHaveAgentInput struct {
|
||||
}
|
||||
|
||||
type GuestHaveAgentOutput struct {
|
||||
Have bool
|
||||
}
|
||||
|
||||
type GuestMakeSshableInput struct {
|
||||
User string
|
||||
PrivateKey string
|
||||
Password string
|
||||
Port int
|
||||
}
|
||||
|
||||
type GuestMakeSshableOutput struct {
|
||||
@@ -57,3 +65,7 @@ type GuestMakeSshableOutput struct {
|
||||
type GuestMakeSshableCmdOutput struct {
|
||||
ShellCmd string
|
||||
}
|
||||
|
||||
type GuestSetSshPortInput struct {
|
||||
Port int
|
||||
}
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
|
||||
package compute
|
||||
|
||||
import "yunion.io/x/jsonutils"
|
||||
|
||||
type GuestnetworkDetails struct {
|
||||
GuestJointResourceDetails
|
||||
|
||||
@@ -70,3 +72,44 @@ type GuestnetworkUpdateInput struct {
|
||||
|
||||
Index *int8 `json:"index"`
|
||||
}
|
||||
|
||||
type GuestnetworkJsonDesc struct {
|
||||
Net string `json:"net"`
|
||||
NetId string `json:"net_id"`
|
||||
Mac string `json:"mac"`
|
||||
Virtual bool `json:"virtual"`
|
||||
Ip string `json:"ip"`
|
||||
Gateway string `json:"gateway"`
|
||||
DNS string `json:"dns"`
|
||||
Domain string `json:"domain"`
|
||||
Routes jsonutils.JSONObject `json:"routes"`
|
||||
Ifname string `json:"ifname"`
|
||||
Masklen int8 `json:"masklen"`
|
||||
Driver string `json:"driver"`
|
||||
Vlan int `json:"vlan"`
|
||||
Bw int `json:"bw"`
|
||||
Mtu int `json:"mtu"`
|
||||
Index int8 `json:"index"`
|
||||
VirtualIps []string `json:"virtual_ips"`
|
||||
ExternalId string `json:"external_id"`
|
||||
TeamWith string `json:"team_with"`
|
||||
Manual *bool `json:"manual"`
|
||||
|
||||
Vpc struct {
|
||||
Id string `json:"id"`
|
||||
Provider string `json:"provider"`
|
||||
MappedIpAddr string `json:"mapped_ip_addr"`
|
||||
} `json:"vpc"`
|
||||
|
||||
Networkaddresses jsonutils.JSONObject `json:"networkaddresses"`
|
||||
|
||||
Bridge string `json:"bridge"`
|
||||
WireId string `json:"wire_id"`
|
||||
Interface string `json:"interface"`
|
||||
|
||||
// baremetal
|
||||
Rate int `json:"rate"`
|
||||
BaremetalId string `json:"baremetal_id"`
|
||||
NicType string `json:"nic_type"`
|
||||
LinkUp bool `json:"link_up"`
|
||||
}
|
||||
|
||||
@@ -18,6 +18,8 @@ import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"yunion.io/x/jsonutils"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/apis"
|
||||
"yunion.io/x/onecloud/pkg/apis/billing"
|
||||
)
|
||||
@@ -121,12 +123,14 @@ func (input *ServerListInput) AfterUnmarshal() {
|
||||
type ServerRebuildRootInput struct {
|
||||
apis.Meta
|
||||
|
||||
// 镜像名称
|
||||
Image string `json:"image"`
|
||||
// swagger: ignore
|
||||
Image string `json:"image" yunion-deprecated-by:"image_id"`
|
||||
// 镜像 id
|
||||
// required: true
|
||||
ImageId string `json:"image_id"`
|
||||
Keypair string `json:"keypair"`
|
||||
ImageId string `json:"image_id"`
|
||||
// swagger: ignore
|
||||
Keypair string `json:"keypair" yunion-deprecated-by:"keypair_id"`
|
||||
// 秘钥Id
|
||||
KeypairId string `json:"keypair_id"`
|
||||
ResetPassword *bool `json:"reset_password"`
|
||||
Password string `json:"password"`
|
||||
@@ -134,26 +138,6 @@ type ServerRebuildRootInput struct {
|
||||
AllDisks *bool `json:"all_disks"`
|
||||
}
|
||||
|
||||
func (i ServerRebuildRootInput) GetImageName() string {
|
||||
if len(i.Image) > 0 {
|
||||
return i.Image
|
||||
}
|
||||
if len(i.ImageId) > 0 {
|
||||
return i.ImageId
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (i ServerRebuildRootInput) GetKeypairName() string {
|
||||
if len(i.Keypair) > 0 {
|
||||
return i.Keypair
|
||||
}
|
||||
if len(i.KeypairId) > 0 {
|
||||
return i.KeypairId
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type ServerResumeInput struct {
|
||||
apis.Meta
|
||||
}
|
||||
@@ -555,3 +539,164 @@ type ServerMigrateNetworkInput struct {
|
||||
// Destination network Id
|
||||
Dest string `json:"dest"`
|
||||
}
|
||||
|
||||
type ServerDeployInput struct {
|
||||
apis.Meta
|
||||
|
||||
// swagger: ignore
|
||||
Keypair string `json:"keypair" yunion-deprecated-by:"keypair_id"`
|
||||
// 秘钥Id
|
||||
KeypairId string `json:"keypair_id"`
|
||||
|
||||
// 清理指定公钥
|
||||
// 若指定的秘钥Id和虚拟机的秘钥Id不相同, 则清理旧的公钥
|
||||
DeletePublicKey string `json:"delete_public_key"`
|
||||
// 解绑当前虚拟机秘钥, 并清理公钥信息
|
||||
DeleteKeypair bool `json:"__delete_keypair__"`
|
||||
// 生成随机密码, 优先级低于password
|
||||
ResetPassword bool `json:"reset_password"`
|
||||
// 重置指定密码
|
||||
Password string `json:"password"`
|
||||
// 部署完成后是否自动启动
|
||||
// 若虚拟机重置密码后需要重启生效,并且当前虚拟机状态为running, 此参数默认为true
|
||||
// 若虚拟机状态为ready, 指定此参数后,部署完成后,虚拟机会自动启动
|
||||
AutoStart bool `json:"auto_start"`
|
||||
// swagger: ignore
|
||||
Restart bool `json:"restart"`
|
||||
|
||||
// swagger: ignore
|
||||
DeployConfigs []*DeployConfig `json:"deploy_configs"`
|
||||
}
|
||||
|
||||
type ServerUserDataInput struct {
|
||||
UserData string `json:"user_data"`
|
||||
}
|
||||
|
||||
type ServerAttachDiskInput struct {
|
||||
DiskId string `json:"disk_id"`
|
||||
}
|
||||
|
||||
type ServerDetachDiskInput struct {
|
||||
// 磁盘Id,若磁盘未挂载在虚拟机上,不返回错误
|
||||
DiskId string `json:"disk_id"`
|
||||
// 是否保留磁盘
|
||||
// default: false
|
||||
KeepDisk bool `json:"keep_disk"`
|
||||
}
|
||||
|
||||
type ServerChangeConfigInput struct {
|
||||
// 实例类型, 优先级高于vcpu_count和vmem_size
|
||||
InstanceType string `json:"instance_type"`
|
||||
// swagger: ignore
|
||||
Sku string `json:"sku" yunion-deprecated-by:"instance_type"`
|
||||
// swagger: ignore
|
||||
Flavor string `json:"flavor" yunion-deprecated-by:"instance_type"`
|
||||
|
||||
// cpu大小
|
||||
VcpuCount int `json:"vcpu_count"`
|
||||
// 内存大小, 1024M, 1G
|
||||
VmemSize string `json:"vmem_size"`
|
||||
|
||||
// 调整完配置后是否自动启动
|
||||
AutoStart bool `json:"auto_start"`
|
||||
|
||||
Disks []DiskConfig `json:"disks"`
|
||||
}
|
||||
|
||||
type ServerUpdateInput struct {
|
||||
apis.VirtualResourceBaseUpdateInput
|
||||
|
||||
// 删除保护开关
|
||||
DisableDelete *bool `json:"disable_delete"`
|
||||
// 启动顺序
|
||||
BootOrder *string `json:"boot_order"`
|
||||
// 关机执行操作
|
||||
ShutdownBehavior *string `json:"shutdown_behavior"`
|
||||
Vga *string `json:"vga"`
|
||||
Vdi *string `json:"vdi"`
|
||||
Machine *string `json:"machine"`
|
||||
Bios *string `json:"bios"`
|
||||
|
||||
SrcIpCheck *bool `json:"src_ip_check"`
|
||||
SrcMacCheck *bool `json:"src_mac_check"`
|
||||
|
||||
SshPort int `json:"ssh_port"`
|
||||
}
|
||||
|
||||
type GuestJsonDesc struct {
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description"`
|
||||
UUID string `json:"uuid"`
|
||||
Mem int `json:"mem"`
|
||||
Cpu int `json:"cpu"`
|
||||
Vga string `json:"vga"`
|
||||
Vdi string `json:"vdi"`
|
||||
Machine string `json:"machine"`
|
||||
Bios string `json:"bios"`
|
||||
BootOrder string `json:"boot_order"`
|
||||
SrcIpCheck bool `json:"src_ip_check"`
|
||||
SrcMacCheck bool `json:"src_mac_check"`
|
||||
IsMaster *bool `json:"is_master"`
|
||||
IsSlave *bool `json:"is_slave"`
|
||||
HostId string `json:"host_id"`
|
||||
|
||||
IsolatedDevices []*IsolatedDeviceJsonDesc `json:"isolated_devices"`
|
||||
|
||||
Domain string `json:"domain"`
|
||||
|
||||
Nics []*GuestnetworkJsonDesc `json:"nics"`
|
||||
Disks []*GuestdiskJsonDesc `json:"disks"`
|
||||
|
||||
Cdrom *GuestcdromJsonDesc `json:"cdrom"`
|
||||
|
||||
Tenant string `json:"tenant"`
|
||||
TenantId string `json:"tenant_id"`
|
||||
DomainId string `json:"domain_id"`
|
||||
ProjectDomain string `json:"project_domain"`
|
||||
|
||||
Keypair string `json:"keypair"`
|
||||
Pubkey string `json:"pubkey"`
|
||||
|
||||
NetworkRoles []string `json:"network_roles"`
|
||||
|
||||
Secgroups []*SecgroupJsonDesc `json:"secgroups"`
|
||||
SecurityRules string `json:"security_rules"`
|
||||
AdminSecurityRules string `json:"admin_security_rules"`
|
||||
|
||||
ExtraOptions jsonutils.JSONObject `json:"extra_options"`
|
||||
|
||||
Kvm string `json:"kvm"`
|
||||
|
||||
Zone string `json:"zone"`
|
||||
ZoneId string `json:"zone_id"`
|
||||
|
||||
OsName string `json:"os_name"`
|
||||
|
||||
Metadata map[string]string `json:"metadata"`
|
||||
UserData string `json:"user_data"`
|
||||
PendingDeleted bool `json:"pending_deleted"`
|
||||
|
||||
ScallingGroupId string `json:"scalling_group_id"`
|
||||
|
||||
// baremetal
|
||||
DiskConfig jsonutils.JSONObject `json:"disk_config"`
|
||||
NicsStandby []*GuestnetworkJsonDesc `json:"nics_standby"`
|
||||
|
||||
// esxi
|
||||
InstanceSnapshotInfo struct {
|
||||
InstanceSnapshotId string `json:"instance_snapshot_id"`
|
||||
InstanceId string `json:"instance_id"`
|
||||
} `json:"instance_snapshot_info"`
|
||||
}
|
||||
|
||||
type ServerChangeDiskStorageInput struct {
|
||||
DiskId string `json:"disk_id"`
|
||||
TargetStorageId string `json:"target_storage_id"`
|
||||
KeepOriginDisk bool `json:"keep_origin_disk"`
|
||||
}
|
||||
|
||||
type ServerChangeDiskStorageInternalInput struct {
|
||||
ServerChangeDiskStorageInput
|
||||
StorageId string `json:"storage_id"`
|
||||
TargetDiskId string `json:"target_disk_id"`
|
||||
}
|
||||
|
||||
@@ -23,21 +23,21 @@ const (
|
||||
HOST_TYPE_HYPERV = "hyperv" // # Microsoft Hyper-V
|
||||
HOST_TYPE_XEN = "xen" // # XenServer
|
||||
|
||||
HOST_TYPE_ALIYUN = "aliyun"
|
||||
HOST_TYPE_APSARA = "apsara"
|
||||
HOST_TYPE_AWS = "aws"
|
||||
HOST_TYPE_QCLOUD = "qcloud"
|
||||
HOST_TYPE_AZURE = "azure"
|
||||
HOST_TYPE_HUAWEI = "huawei"
|
||||
HOST_TYPE_HUAWEI_CLOUD_STACK = "huaweicloudstack"
|
||||
HOST_TYPE_OPENSTACK = "openstack"
|
||||
HOST_TYPE_UCLOUD = "ucloud"
|
||||
HOST_TYPE_ZSTACK = "zstack"
|
||||
HOST_TYPE_GOOGLE = "google"
|
||||
HOST_TYPE_CTYUN = "ctyun"
|
||||
HOST_TYPE_ECLOUD = "ecloud"
|
||||
HOST_TYPE_JDCLOUD = "jdcloud"
|
||||
HOST_TYPE_CLOUDPODS = "cloudpods"
|
||||
HOST_TYPE_ALIYUN = "aliyun"
|
||||
HOST_TYPE_APSARA = "apsara"
|
||||
HOST_TYPE_AWS = "aws"
|
||||
HOST_TYPE_QCLOUD = "qcloud"
|
||||
HOST_TYPE_AZURE = "azure"
|
||||
HOST_TYPE_HUAWEI = "huawei"
|
||||
HOST_TYPE_HCSO = "hcso"
|
||||
HOST_TYPE_OPENSTACK = "openstack"
|
||||
HOST_TYPE_UCLOUD = "ucloud"
|
||||
HOST_TYPE_ZSTACK = "zstack"
|
||||
HOST_TYPE_GOOGLE = "google"
|
||||
HOST_TYPE_CTYUN = "ctyun"
|
||||
HOST_TYPE_ECLOUD = "ecloud"
|
||||
HOST_TYPE_JDCLOUD = "jdcloud"
|
||||
HOST_TYPE_CLOUDPODS = "cloudpods"
|
||||
|
||||
HOST_TYPE_DEFAULT = HOST_TYPE_HYPERVISOR
|
||||
|
||||
@@ -112,7 +112,7 @@ var HOST_TYPES = []string{
|
||||
HOST_TYPE_AWS,
|
||||
HOST_TYPE_QCLOUD,
|
||||
HOST_TYPE_HUAWEI,
|
||||
HOST_TYPE_HUAWEI_CLOUD_STACK,
|
||||
HOST_TYPE_HCSO,
|
||||
HOST_TYPE_OPENSTACK,
|
||||
HOST_TYPE_UCLOUD,
|
||||
HOST_TYPE_ZSTACK,
|
||||
|
||||
@@ -16,6 +16,8 @@ package compute
|
||||
|
||||
import (
|
||||
"yunion.io/x/jsonutils"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/apis"
|
||||
)
|
||||
|
||||
type HoststorageDetails struct {
|
||||
@@ -58,3 +60,10 @@ type HoststorageListInput struct {
|
||||
|
||||
StorageFilterListInput
|
||||
}
|
||||
|
||||
type HostStorageCreateInput struct {
|
||||
apis.JoinResourceBaseCreateInput
|
||||
StorageId string `json:"storage_id"`
|
||||
HostId string `json:"host_id"`
|
||||
MountPoint string `json:"mount_point"`
|
||||
}
|
||||
|
||||
@@ -95,3 +95,12 @@ type IsolatedDeviceUpdateInput struct {
|
||||
apis.StandaloneResourceBaseUpdateInput
|
||||
IsolatedDeviceReservedResourceInput
|
||||
}
|
||||
|
||||
type IsolatedDeviceJsonDesc struct {
|
||||
Id string `json:"id"`
|
||||
DevType string `json:"dev_type"`
|
||||
Model string `json:"model"`
|
||||
Addr string `json:"addr"`
|
||||
VendorDeviceId string `json:"vendor_device_id"`
|
||||
Vendor string `json:"vendor"`
|
||||
}
|
||||
|
||||
@@ -332,6 +332,7 @@ const (
|
||||
LB_SCHEDULER_SCH = "sch" // source-ip-based consistent hash
|
||||
LB_SCHEDULER_TCH = "tch" // 4-tuple-based consistent hash
|
||||
LB_SCHEDULER_QCH = "qch"
|
||||
LB_SCHEDULER_MH = "mh" // maglev consistent hash
|
||||
)
|
||||
|
||||
var LB_SCHEDULER_TYPES = choices.NewChoices(
|
||||
|
||||
@@ -209,22 +209,11 @@ type NetworkCreateInput struct {
|
||||
BgpType string `json:"bgp_type"`
|
||||
}
|
||||
|
||||
type NetworkDetails struct {
|
||||
apis.SharableVirtualResourceDetails
|
||||
WireResourceInfo
|
||||
|
||||
SNetwork
|
||||
|
||||
// 是否是内网
|
||||
Exit bool `json:"exit"`
|
||||
// 端口数量
|
||||
Ports int `json:"ports"`
|
||||
// 已使用端口数量
|
||||
PortsUsed int `json:"ports_used"`
|
||||
// 网卡数量
|
||||
type SNetworkNics struct {
|
||||
// 虚拟机网卡数量
|
||||
Vnics int `json:"vnics"`
|
||||
// 裸金属网卡数量
|
||||
BmVnics int `json:"bm_nics"`
|
||||
BmVnics int `json:"bm_vnics"`
|
||||
// 负载均衡网卡数量
|
||||
LbVnics int `json:"lb_vnics"`
|
||||
// 浮动Ip网卡数量
|
||||
@@ -233,6 +222,48 @@ type NetworkDetails struct {
|
||||
// 预留IP数量
|
||||
ReserveVnics int `json:"reserve_vnics"`
|
||||
|
||||
// RDS网卡数量
|
||||
RdsVnics int `json:"rds_vnics"`
|
||||
// NAT网关网卡数量
|
||||
NatVnics int `json:"nat_vnics"`
|
||||
BmReusedVnics int `json:"bm_reused_vnics"`
|
||||
|
||||
// 弹性网卡数量
|
||||
NetworkinterfaceVnics int `json:"networkinterface_vnics"`
|
||||
|
||||
// 已使用端口数量
|
||||
PortsUsed int `json:"ports_used"`
|
||||
|
||||
Total int `json:"total"`
|
||||
}
|
||||
|
||||
func (self *SNetworkNics) SumTotal() {
|
||||
self.Total = self.Vnics +
|
||||
self.BmVnics +
|
||||
self.LbVnics +
|
||||
self.LbVnics +
|
||||
self.EipVnics +
|
||||
self.GroupVnics +
|
||||
self.ReserveVnics +
|
||||
self.RdsVnics +
|
||||
self.NetworkinterfaceVnics +
|
||||
self.NatVnics -
|
||||
self.BmReusedVnics
|
||||
self.PortsUsed = self.Total
|
||||
}
|
||||
|
||||
type NetworkDetails struct {
|
||||
apis.SharableVirtualResourceDetails
|
||||
WireResourceInfo
|
||||
|
||||
SNetwork
|
||||
SNetworkNics
|
||||
|
||||
// 是否是内网
|
||||
Exit bool `json:"exit"`
|
||||
// 端口数量
|
||||
Ports int `json:"ports"`
|
||||
|
||||
// 路由信息
|
||||
Routes [][]string `json:"routes"`
|
||||
Schedtags []SchedtagShortDescDetails `json:"schedtags"`
|
||||
|
||||
@@ -59,7 +59,7 @@ var (
|
||||
|
||||
REGIONAL_NETWORK_PROVIDERS = []string{
|
||||
CLOUD_PROVIDER_HUAWEI,
|
||||
CLOUD_PROVIDER_HUAWEI_CLOUD_STACK,
|
||||
CLOUD_PROVIDER_HCSO,
|
||||
CLOUD_PROVIDER_CTYUN,
|
||||
CLOUD_PROVIDER_UCLOUD,
|
||||
CLOUD_PROVIDER_GOOGLE,
|
||||
|
||||
556
pkg/apis/compute/regiondata.go
Normal file
556
pkg/apis/compute/regiondata.go
Normal file
@@ -0,0 +1,556 @@
|
||||
// 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/cloudprovider"
|
||||
)
|
||||
|
||||
var (
|
||||
// China
|
||||
RegionBeijing = cloudprovider.SGeographicInfo{
|
||||
Latitude: 39.90419989999999,
|
||||
Longitude: 116.4073963,
|
||||
City: CITY_BEI_JING,
|
||||
CountryCode: COUNTRY_CODE_CN,
|
||||
}
|
||||
RegionNingxia = cloudprovider.SGeographicInfo{
|
||||
Latitude: 37.198731,
|
||||
Longitude: 106.1580937,
|
||||
City: CITY_NING_XIA,
|
||||
CountryCode: COUNTRY_CODE_CN,
|
||||
}
|
||||
RegionShanghai = cloudprovider.SGeographicInfo{
|
||||
Latitude: 31.17,
|
||||
Longitude: 121.47,
|
||||
City: CITY_SHANG_HAI,
|
||||
CountryCode: COUNTRY_CODE_CN,
|
||||
}
|
||||
RegionGuangzhou = cloudprovider.SGeographicInfo{
|
||||
Latitude: 23.12911,
|
||||
Longitude: 113.264385,
|
||||
City: CITY_GUANG_ZHOU,
|
||||
CountryCode: COUNTRY_CODE_CN,
|
||||
}
|
||||
RegionDalian = cloudprovider.SGeographicInfo{
|
||||
Latitude: 38.91400300000001,
|
||||
Longitude: 121.614682,
|
||||
City: CITY_DA_LIAN,
|
||||
CountryCode: COUNTRY_CODE_CN,
|
||||
}
|
||||
RegionGuiyang = cloudprovider.SGeographicInfo{
|
||||
Latitude: 26.6470035286,
|
||||
Longitude: 106.6302113880,
|
||||
City: CITY_GUI_YANG,
|
||||
CountryCode: COUNTRY_CODE_CN,
|
||||
}
|
||||
RegionNeimenggu = cloudprovider.SGeographicInfo{
|
||||
Latitude: 41.0178713,
|
||||
Longitude: 113.094978,
|
||||
City: CITY_NEI_MENG_GU,
|
||||
CountryCode: COUNTRY_CODE_CN,
|
||||
}
|
||||
RegionQingdao = cloudprovider.SGeographicInfo{
|
||||
Latitude: 36.067108,
|
||||
Longitude: 120.382607,
|
||||
City: CITY_QING_DAO,
|
||||
CountryCode: COUNTRY_CODE_CN,
|
||||
}
|
||||
RegionZhangjiakou = cloudprovider.SGeographicInfo{
|
||||
Latitude: 40.767544,
|
||||
Longitude: 114.886337,
|
||||
City: CITY_ZHANG_JIA_KOU,
|
||||
CountryCode: COUNTRY_CODE_CN,
|
||||
}
|
||||
RegionHuhehaote = cloudprovider.SGeographicInfo{
|
||||
Latitude: 40.842358,
|
||||
Longitude: 111.749992,
|
||||
City: CITY_HU_HE_HAO_TE,
|
||||
CountryCode: COUNTRY_CODE_CN,
|
||||
}
|
||||
RegionHangzhou = cloudprovider.SGeographicInfo{
|
||||
Latitude: 30.274084,
|
||||
Longitude: 120.155067,
|
||||
City: CITY_HANG_ZHOU,
|
||||
CountryCode: COUNTRY_CODE_CN,
|
||||
}
|
||||
RegionShenzhen = cloudprovider.SGeographicInfo{
|
||||
Latitude: 22.543097,
|
||||
Longitude: 114.057861,
|
||||
City: CITY_SHEN_ZHEN,
|
||||
CountryCode: COUNTRY_CODE_CN,
|
||||
}
|
||||
RegionChengdu = cloudprovider.SGeographicInfo{
|
||||
Latitude: 30.572815,
|
||||
Longitude: 104.066803,
|
||||
City: CITY_CHENG_DU,
|
||||
CountryCode: COUNTRY_CODE_CN,
|
||||
}
|
||||
RegionHeyuan = cloudprovider.SGeographicInfo{
|
||||
Latitude: 23.7292717,
|
||||
Longitude: 114.6965786,
|
||||
City: CITY_HE_YUAN,
|
||||
CountryCode: COUNTRY_CODE_CN,
|
||||
}
|
||||
RegionWulanchabu = cloudprovider.SGeographicInfo{
|
||||
Latitude: 41.0178065,
|
||||
Longitude: 113.094978,
|
||||
City: CITY_WU_LAN_CHA_BU,
|
||||
CountryCode: COUNTRY_CODE_CN,
|
||||
}
|
||||
RegionChongqing = cloudprovider.SGeographicInfo{
|
||||
Latitude: 29.431585,
|
||||
Longitude: 106.912254,
|
||||
City: CITY_CHONG_QING,
|
||||
CountryCode: COUNTRY_CODE_CN,
|
||||
}
|
||||
RegionNanjing = cloudprovider.SGeographicInfo{
|
||||
Latitude: 32.0584065670,
|
||||
Longitude: 118.7964897811,
|
||||
City: CITY_NAN_JING,
|
||||
CountryCode: COUNTRY_CODE_CN,
|
||||
}
|
||||
|
||||
// Asia
|
||||
RegionTaiwan = cloudprovider.SGeographicInfo{
|
||||
Latitude: 25.0443,
|
||||
Longitude: 121.509,
|
||||
City: CITY_TAI_WAN,
|
||||
CountryCode: COUNTRY_CODE_CN,
|
||||
}
|
||||
RegionHongkong = cloudprovider.SGeographicInfo{
|
||||
Latitude: 22.396427,
|
||||
Longitude: 114.109497,
|
||||
City: CITY_HONG_KONG,
|
||||
CountryCode: COUNTRY_CODE_CN,
|
||||
}
|
||||
RegionTokyo = cloudprovider.SGeographicInfo{
|
||||
Latitude: 35.709026,
|
||||
Longitude: 139.731995,
|
||||
City: CITY_TOKYO,
|
||||
CountryCode: COUNTRY_CODE_JP,
|
||||
}
|
||||
RegionOsaka = cloudprovider.SGeographicInfo{
|
||||
Latitude: 34.6937378,
|
||||
Longitude: 135.5021651,
|
||||
City: CITY_OSAKA,
|
||||
CountryCode: COUNTRY_CODE_JP,
|
||||
}
|
||||
RegionSeoul = cloudprovider.SGeographicInfo{
|
||||
Latitude: 34.6937378,
|
||||
Longitude: 135.5021651,
|
||||
City: CITY_SEOUL,
|
||||
CountryCode: COUNTRY_CODE_KR,
|
||||
}
|
||||
RegionBusan = cloudprovider.SGeographicInfo{
|
||||
Latitude: 35.1,
|
||||
Longitude: 129.0403,
|
||||
City: CITY_BUSAN,
|
||||
CountryCode: COUNTRY_CODE_KR,
|
||||
}
|
||||
|
||||
RegionMumbai = cloudprovider.SGeographicInfo{
|
||||
Latitude: 19.07599,
|
||||
Longitude: 72.877393,
|
||||
City: CITY_MUMBAI,
|
||||
CountryCode: COUNTRY_CODE_IN,
|
||||
}
|
||||
RegionDelhi = cloudprovider.SGeographicInfo{
|
||||
Latitude: 28.61,
|
||||
Longitude: 77.23,
|
||||
City: CITY_DELHI,
|
||||
CountryCode: COUNTRY_CODE_IN,
|
||||
}
|
||||
RegionMaharashtra = cloudprovider.SGeographicInfo{
|
||||
Latitude: 18.97,
|
||||
Longitude: 72.82,
|
||||
City: CITY_MAHARASHTRA,
|
||||
CountryCode: COUNTRY_CODE_IN,
|
||||
}
|
||||
RegionKanchipuram = cloudprovider.SGeographicInfo{
|
||||
Latitude: 12.8387,
|
||||
Longitude: 79.7016,
|
||||
City: CITY_KANCHIPURAM,
|
||||
CountryCode: COUNTRY_CODE_IN,
|
||||
}
|
||||
|
||||
RegionSingapore = cloudprovider.SGeographicInfo{
|
||||
Latitude: 1.352083,
|
||||
Longitude: 103.819839,
|
||||
City: CITY_SINGAPORE,
|
||||
CountryCode: COUNTRY_CODE_SG,
|
||||
}
|
||||
RegionJakarta = cloudprovider.SGeographicInfo{
|
||||
Latitude: -6.175110,
|
||||
Longitude: 106.865036,
|
||||
City: CITY_JAKARTA,
|
||||
CountryCode: COUNTRY_CODE_ID,
|
||||
}
|
||||
RegionKualaLumpur = cloudprovider.SGeographicInfo{
|
||||
Latitude: 3.139003,
|
||||
Longitude: 101.686852,
|
||||
City: CITY_KUALA_LUMPUR,
|
||||
CountryCode: COUNTRY_CODE_MY,
|
||||
}
|
||||
RegionBangkok = cloudprovider.SGeographicInfo{
|
||||
Latitude: 13.7563309,
|
||||
Longitude: 100.5017651,
|
||||
City: CITY_BANGKOK,
|
||||
CountryCode: COUNTRY_CODE_TH,
|
||||
}
|
||||
|
||||
RegionSydney = cloudprovider.SGeographicInfo{
|
||||
Latitude: -33.8688197,
|
||||
Longitude: 151.2092955,
|
||||
City: CITY_SYDNEY,
|
||||
CountryCode: COUNTRY_CODE_AU,
|
||||
}
|
||||
RegionMelbourne = cloudprovider.SGeographicInfo{
|
||||
Latitude: -37.813611,
|
||||
Longitude: 144.963056,
|
||||
City: CITY_MELBOURNE,
|
||||
CountryCode: COUNTRY_CODE_AU,
|
||||
}
|
||||
//亚拉伦拉 澳大利亚
|
||||
RegionYarralumla = cloudprovider.SGeographicInfo{
|
||||
Latitude: -35.3016,
|
||||
Longitude: 149.078,
|
||||
City: CITY_YARRALUMLA,
|
||||
CountryCode: COUNTRY_CODE_AU,
|
||||
}
|
||||
|
||||
// Africa
|
||||
RegionCapeTown = cloudprovider.SGeographicInfo{
|
||||
Latitude: -33.9152209,
|
||||
Longitude: 18.3758904,
|
||||
City: CITY_CAPE_TOWN,
|
||||
CountryCode: COUNTRY_CODE_ZA,
|
||||
}
|
||||
// 比勒陀利亚
|
||||
RegionPretoria = cloudprovider.SGeographicInfo{
|
||||
Latitude: -25.716667,
|
||||
Longitude: 28.283333,
|
||||
City: CITY_PRETORIA,
|
||||
CountryCode: COUNTRY_CODE_ZA,
|
||||
}
|
||||
RegionJohannesburg = cloudprovider.SGeographicInfo{
|
||||
Latitude: -26.1714537,
|
||||
Longitude: 27.8999389,
|
||||
City: CITY_JOHANNESBURG,
|
||||
CountryCode: COUNTRY_CODE_ZA,
|
||||
}
|
||||
|
||||
// Middleeast
|
||||
RegionBahrain = cloudprovider.SGeographicInfo{
|
||||
Latitude: 25.9408826,
|
||||
Longitude: 50.4474957,
|
||||
City: CITY_BAHRAIN,
|
||||
CountryCode: COUNTRY_CODE_BH,
|
||||
}
|
||||
RegionDubai = cloudprovider.SGeographicInfo{
|
||||
Latitude: 25.263056,
|
||||
Longitude: 55.297222,
|
||||
City: CITY_DUBAI,
|
||||
CountryCode: COUNTRY_CODE_AE,
|
||||
}
|
||||
|
||||
// Europe
|
||||
RegionFinland = cloudprovider.SGeographicInfo{
|
||||
Latitude: 64.8255731,
|
||||
Longitude: 21.5432837,
|
||||
City: CITY_FINLAND,
|
||||
CountryCode: COUNTRY_CODE_FI,
|
||||
}
|
||||
RegionBelgium = cloudprovider.SGeographicInfo{
|
||||
Latitude: 50.499734,
|
||||
Longitude: 3.9057517,
|
||||
City: CITY_BELGIUM,
|
||||
CountryCode: COUNTRY_CODE_BE,
|
||||
}
|
||||
RegionLondon = cloudprovider.SGeographicInfo{
|
||||
Latitude: 51.507351,
|
||||
Longitude: -0.127758,
|
||||
City: CITY_LONDON,
|
||||
CountryCode: COUNTRY_CODE_GB,
|
||||
}
|
||||
RegionHalton = cloudprovider.SGeographicInfo{
|
||||
Latitude: 53.3331,
|
||||
Longitude: -2.6957,
|
||||
City: CITY_HALTON,
|
||||
CountryCode: COUNTRY_CODE_GB,
|
||||
}
|
||||
RegionSussex = cloudprovider.SGeographicInfo{
|
||||
Latitude: 51,
|
||||
Longitude: 0,
|
||||
City: CITY_WEST_SUSSEX,
|
||||
CountryCode: COUNTRY_CODE_GB,
|
||||
}
|
||||
RegionFrankfurt = cloudprovider.SGeographicInfo{
|
||||
Latitude: 51.165691,
|
||||
Longitude: 10.451526,
|
||||
City: CITY_FRANKFURT,
|
||||
CountryCode: COUNTRY_CODE_DE,
|
||||
}
|
||||
RegionHolland = cloudprovider.SGeographicInfo{
|
||||
Latitude: 52.2076831,
|
||||
Longitude: 4.1585786,
|
||||
City: CITY_HOLLAND,
|
||||
CountryCode: COUNTRY_CODE_NL,
|
||||
}
|
||||
RegionZurich = cloudprovider.SGeographicInfo{
|
||||
Latitude: 47.3774497,
|
||||
Longitude: 8.5016958,
|
||||
City: CITY_ZURICH,
|
||||
CountryCode: COUNTRY_CODE_CH,
|
||||
}
|
||||
RegionWarsaw = cloudprovider.SGeographicInfo{
|
||||
Latitude: 52.233333,
|
||||
Longitude: 21.016667,
|
||||
City: CITY_WARSAW,
|
||||
CountryCode: COUNTRY_CODE_PL,
|
||||
}
|
||||
RegionIreland = cloudprovider.SGeographicInfo{
|
||||
Latitude: 53.41291,
|
||||
Longitude: -8.24389,
|
||||
City: CITY_IRELAND,
|
||||
CountryCode: COUNTRY_CODE_IE,
|
||||
}
|
||||
RegionDublin = cloudprovider.SGeographicInfo{
|
||||
Latitude: 53.349722,
|
||||
Longitude: -6.260278,
|
||||
City: CITY_DUBLIN,
|
||||
CountryCode: COUNTRY_CODE_IE,
|
||||
}
|
||||
RegionParis = cloudprovider.SGeographicInfo{
|
||||
Latitude: 48.856614,
|
||||
Longitude: 2.3522219,
|
||||
City: CITY_PARIS,
|
||||
CountryCode: COUNTRY_CODE_FR,
|
||||
}
|
||||
RegionAllier = cloudprovider.SGeographicInfo{
|
||||
Latitude: 46.5178,
|
||||
Longitude: 3.3592,
|
||||
City: CITY_ALLIER,
|
||||
CountryCode: COUNTRY_CODE_FR,
|
||||
}
|
||||
RegionTarn = cloudprovider.SGeographicInfo{
|
||||
Latitude: 43.8656,
|
||||
Longitude: 1.505,
|
||||
City: CITY_TARN,
|
||||
CountryCode: COUNTRY_CODE_FR,
|
||||
}
|
||||
RegionStockholm = cloudprovider.SGeographicInfo{
|
||||
Latitude: 59.1946,
|
||||
Longitude: 18.47,
|
||||
City: CITY_STOCKHOLM,
|
||||
CountryCode: COUNTRY_CODE_SE,
|
||||
}
|
||||
RegionDelmenhorst = cloudprovider.SGeographicInfo{
|
||||
Latitude: 53.050556,
|
||||
Longitude: 8.631667,
|
||||
City: CITY_DELMENHORST,
|
||||
CountryCode: COUNTRY_CODE_DE,
|
||||
}
|
||||
RegionGeneva = cloudprovider.SGeographicInfo{
|
||||
Latitude: 46.201667,
|
||||
Longitude: 6.146944,
|
||||
City: CITY_GENEVA,
|
||||
CountryCode: COUNTRY_CODE_CH,
|
||||
}
|
||||
RegionStavanger = cloudprovider.SGeographicInfo{
|
||||
Latitude: 58.963333,
|
||||
Longitude: 5.718889,
|
||||
City: CITY_STAVANGER,
|
||||
CountryCode: COUNTRY_CODE_NO,
|
||||
}
|
||||
RegionOslo = cloudprovider.SGeographicInfo{
|
||||
Latitude: 59.905556,
|
||||
Longitude: 10.768333,
|
||||
City: CITY_OSLO,
|
||||
CountryCode: COUNTRY_CODE_NO,
|
||||
}
|
||||
|
||||
RegionMoscow = cloudprovider.SGeographicInfo{
|
||||
Latitude: 55.755825,
|
||||
Longitude: 37.617298,
|
||||
City: CITY_MOSCOW,
|
||||
CountryCode: COUNTRY_CODE_RU,
|
||||
}
|
||||
|
||||
// America
|
||||
RegionMontreal = cloudprovider.SGeographicInfo{
|
||||
Latitude: 45.5580206,
|
||||
Longitude: -73.8003414,
|
||||
City: CITY_MONTREAL,
|
||||
CountryCode: COUNTRY_CODE_CA,
|
||||
}
|
||||
RegionToronto = cloudprovider.SGeographicInfo{
|
||||
Latitude: 43.653225,
|
||||
Longitude: -79.383186,
|
||||
City: CITY_TORONTO,
|
||||
CountryCode: COUNTRY_CODE_CA,
|
||||
}
|
||||
RegionCanadaCentral = cloudprovider.SGeographicInfo{
|
||||
Latitude: 56.130366,
|
||||
Longitude: -106.346771,
|
||||
City: CITY_CANADA_CENTRAL,
|
||||
CountryCode: COUNTRY_CODE_CA,
|
||||
}
|
||||
RegionQuebec = cloudprovider.SGeographicInfo{
|
||||
Latitude: 52,
|
||||
Longitude: -72,
|
||||
City: CITY_QUEBEC,
|
||||
CountryCode: COUNTRY_CODE_CA,
|
||||
}
|
||||
|
||||
RegionSaoPaulo = cloudprovider.SGeographicInfo{
|
||||
Latitude: -23.5505199,
|
||||
Longitude: -46.6333094,
|
||||
City: CITY_SAO_PAULO,
|
||||
CountryCode: COUNTRY_CODE_BR,
|
||||
}
|
||||
// 里约热内卢
|
||||
RegionRioDeJaneiro = cloudprovider.SGeographicInfo{
|
||||
Latitude: -22.9083,
|
||||
Longitude: -43.1964,
|
||||
City: CITY_RIO_DE_JANEIRO,
|
||||
CountryCode: COUNTRY_CODE_BR,
|
||||
}
|
||||
|
||||
RegionMexico = cloudprovider.SGeographicInfo{
|
||||
Latitude: 55.1182908,
|
||||
Longitude: 141.0377645,
|
||||
City: CITY_MEXICO,
|
||||
CountryCode: COUNTRY_CODE_MX,
|
||||
}
|
||||
|
||||
RegionSantiago = cloudprovider.SGeographicInfo{
|
||||
Latitude: -33.45206,
|
||||
Longitude: -70.676031,
|
||||
City: CITY_SANTIAGO,
|
||||
CountryCode: COUNTRY_CODE_CL,
|
||||
}
|
||||
|
||||
RegionIowa = cloudprovider.SGeographicInfo{
|
||||
Latitude: 41.9328655,
|
||||
Longitude: -94.5106809,
|
||||
City: CITY_IOWA,
|
||||
CountryCode: COUNTRY_CODE_US,
|
||||
}
|
||||
RegionCarolina = cloudprovider.SGeographicInfo{
|
||||
Latitude: 33.6194409,
|
||||
Longitude: -82.0475635,
|
||||
City: CITY_SOUTH_CAROLINA,
|
||||
CountryCode: COUNTRY_CODE_US,
|
||||
}
|
||||
// 西雅图,华盛顿州
|
||||
RegionWashington = cloudprovider.SGeographicInfo{
|
||||
Latitude: 47.6,
|
||||
Longitude: -122.3,
|
||||
City: CITY_WASHINGTON,
|
||||
CountryCode: COUNTRY_CODE_US,
|
||||
}
|
||||
RegionVirginia = cloudprovider.SGeographicInfo{
|
||||
Latitude: 37.4315734,
|
||||
Longitude: -78.6568942,
|
||||
City: CITY_VIRGINIA,
|
||||
CountryCode: COUNTRY_CODE_US,
|
||||
}
|
||||
RegionTexas = cloudprovider.SGeographicInfo{
|
||||
Latitude: 31,
|
||||
Longitude: -100,
|
||||
City: CITY_TEXAS,
|
||||
CountryCode: COUNTRY_CODE_US,
|
||||
}
|
||||
RegionChicago = cloudprovider.SGeographicInfo{
|
||||
Latitude: 41.8819,
|
||||
Longitude: -87.6278,
|
||||
City: CITY_CHICAGO,
|
||||
CountryCode: COUNTRY_CODE_US,
|
||||
}
|
||||
RegionPhoenix = cloudprovider.SGeographicInfo{
|
||||
Latitude: 33.4483,
|
||||
Longitude: -112.0739,
|
||||
City: CITY_PHOENIX,
|
||||
CountryCode: COUNTRY_CODE_US,
|
||||
}
|
||||
RegionUtah = cloudprovider.SGeographicInfo{
|
||||
Latitude: 39.5,
|
||||
Longitude: -111.5,
|
||||
City: CITY_UTAH,
|
||||
CountryCode: COUNTRY_CODE_US,
|
||||
}
|
||||
RegionSanFrancisco = cloudprovider.SGeographicInfo{
|
||||
Latitude: 37.7775,
|
||||
Longitude: -122.4164,
|
||||
City: CITY_SAN_FRANCISCO,
|
||||
CountryCode: COUNTRY_CODE_US,
|
||||
}
|
||||
RegionSiliconValley = cloudprovider.SGeographicInfo{
|
||||
Latitude: 37.387474,
|
||||
Longitude: -122.057541,
|
||||
City: CITY_SILICONVALLEY,
|
||||
CountryCode: COUNTRY_CODE_US,
|
||||
}
|
||||
RegionNothVirginia = cloudprovider.SGeographicInfo{
|
||||
Latitude: 37.4315734,
|
||||
Longitude: -78.6568942,
|
||||
City: CITY_N_VIRGINIA,
|
||||
CountryCode: COUNTRY_CODE_US,
|
||||
}
|
||||
RegionOregon = cloudprovider.SGeographicInfo{
|
||||
Latitude: 43.8041334,
|
||||
Longitude: -120.5542012,
|
||||
City: CITY_OREGON,
|
||||
CountryCode: COUNTRY_CODE_US,
|
||||
}
|
||||
RegionLosAngeles = cloudprovider.SGeographicInfo{
|
||||
Latitude: 34.0522342,
|
||||
Longitude: -118.2436849,
|
||||
City: CITY_LOS_ANGELES,
|
||||
CountryCode: COUNTRY_CODE_US,
|
||||
}
|
||||
RegionSaltLakeCity = cloudprovider.SGeographicInfo{
|
||||
Latitude: 40.7767168,
|
||||
Longitude: -111.9905243,
|
||||
City: CITY_SALT_LAKE_CITY,
|
||||
CountryCode: COUNTRY_CODE_US,
|
||||
}
|
||||
RegionLasVegas = cloudprovider.SGeographicInfo{
|
||||
Latitude: 36.1249185,
|
||||
Longitude: -115.3150811,
|
||||
City: CITY_LAS_VEGAS,
|
||||
CountryCode: COUNTRY_CODE_US,
|
||||
}
|
||||
RegionNorthCalifornia = cloudprovider.SGeographicInfo{
|
||||
Latitude: 38.8375215,
|
||||
Longitude: -120.8958242,
|
||||
City: CITY_N_CALIFORNIA,
|
||||
CountryCode: COUNTRY_CODE_US,
|
||||
}
|
||||
RegionOhio = cloudprovider.SGeographicInfo{
|
||||
Latitude: 40.4172871,
|
||||
Longitude: -82.90712300000001,
|
||||
City: CITY_OHIO,
|
||||
CountryCode: COUNTRY_CODE_US,
|
||||
}
|
||||
|
||||
RegionUSGOVWest = cloudprovider.SGeographicInfo{
|
||||
Latitude: 37.09024,
|
||||
Longitude: -95.712891,
|
||||
City: CITY_US_GOV_WEST,
|
||||
CountryCode: COUNTRY_CODE_US,
|
||||
}
|
||||
)
|
||||
@@ -17,6 +17,7 @@ package compute
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/pkg/errors"
|
||||
"yunion.io/x/pkg/util/regutils"
|
||||
"yunion.io/x/pkg/util/secrules"
|
||||
@@ -181,6 +182,7 @@ type SecgroupListInput struct {
|
||||
RegionalFilterListInput
|
||||
|
||||
ManagedResourceListInput
|
||||
WithCache bool `json:"witch_cache"`
|
||||
}
|
||||
|
||||
type SecurityGroupCacheListInput struct {
|
||||
@@ -252,6 +254,8 @@ type SecgroupDetails struct {
|
||||
InRules []SecgroupRuleDetails `json:"in_rules"`
|
||||
// 出方向规则信息
|
||||
OutRules []SecgroupRuleDetails `json:"out_rules"`
|
||||
|
||||
CloudCaches []jsonutils.JSONObject `json:"cloud_caches"`
|
||||
}
|
||||
|
||||
type SecurityGroupResourceInfo struct {
|
||||
@@ -312,3 +316,8 @@ type SecurityGroupCloneInput struct {
|
||||
type SecgroupImportRulesInput struct {
|
||||
Rules []SSecgroupRuleCreateInput `json:"rules"`
|
||||
}
|
||||
|
||||
type SecgroupJsonDesc struct {
|
||||
Id string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
@@ -62,6 +62,9 @@ type VpcListInput struct {
|
||||
UsableResourceListInput
|
||||
UsableVpcResourceListInput
|
||||
|
||||
// 过滤vpc底下有指定zone的ip子网
|
||||
ZoneId string `json:"zone_id"`
|
||||
|
||||
// filter by globalvpc
|
||||
Globalvpc string `json:"globalvpc"`
|
||||
|
||||
|
||||
@@ -43,6 +43,9 @@ const (
|
||||
|
||||
SERVICE_TYPE_ETCD = "etcd"
|
||||
SERVICE_TYPE_INFLUXDB = "influxdb"
|
||||
|
||||
STATUS_UPDATE_TAGS = "update_tags"
|
||||
STATUS_UPDATE_TAGS_FAILED = "update_tags_fail"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -74,10 +77,20 @@ const (
|
||||
OS_ARCH_AARCH64 = "aarch64"
|
||||
)
|
||||
|
||||
func IsARM(osArch string) bool {
|
||||
return utils.IsInStringArray(osArch, []string{
|
||||
var (
|
||||
ARCH_X86 = []string{
|
||||
OS_ARCH_X86,
|
||||
OS_ARCH_I386,
|
||||
OS_ARCH_X86_32,
|
||||
OS_ARCH_X86_64,
|
||||
}
|
||||
ARCH_ARM = []string{
|
||||
OS_ARCH_ARM,
|
||||
OS_ARCH_AARCH32,
|
||||
OS_ARCH_AARCH64,
|
||||
})
|
||||
}
|
||||
)
|
||||
|
||||
func IsARM(osArch string) bool {
|
||||
return utils.IsInStringArray(osArch, ARCH_ARM)
|
||||
}
|
||||
|
||||
@@ -87,3 +87,12 @@ type SApplyInfo struct {
|
||||
ServerId string
|
||||
TryTimes int
|
||||
}
|
||||
|
||||
type DevtoolManagerServiceUrlInput struct {
|
||||
ServiceName string
|
||||
ServerId string
|
||||
}
|
||||
|
||||
type DevtoolManagerServiceUrlOutput struct {
|
||||
ServiceUrl string
|
||||
}
|
||||
|
||||
23
pkg/apis/devtool/serviceurl.go
Normal file
23
pkg/apis/devtool/serviceurl.go
Normal file
@@ -0,0 +1,23 @@
|
||||
// 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 devtool
|
||||
|
||||
const (
|
||||
SERVICEURL_STATUS_CREATING = "creating"
|
||||
SERVICEURL_STATUS_READY = "ready"
|
||||
SERVICEURL_STATUS_DELETING = "deleting"
|
||||
SERVICEURL_STATUS_CREATE_FAILED = "create_failed"
|
||||
SERVICEURL_STATUS_DELETE_FAILED = "delete_failed"
|
||||
)
|
||||
23
pkg/apis/devtool/sshinfo.go
Normal file
23
pkg/apis/devtool/sshinfo.go
Normal file
@@ -0,0 +1,23 @@
|
||||
// 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 devtool
|
||||
|
||||
const (
|
||||
SSHINFO_STATUS_CREATING = "creating"
|
||||
SSHINFO_STATUS_READY = "ready"
|
||||
SSHINFO_STATUS_DELETING = "deleting"
|
||||
SSHINFO_STATUS_CREATE_FAILED = "create_failed"
|
||||
SSHINFO_STATUS_DELETE_FAILED = "delete_failed"
|
||||
)
|
||||
20
pkg/apis/host/types.go
Normal file
20
pkg/apis/host/types.go
Normal file
@@ -0,0 +1,20 @@
|
||||
// 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 host
|
||||
|
||||
type ServerCloneDiskFromStorageResponse struct {
|
||||
TargetAccessPath string `json:"target_access_path"`
|
||||
TargetFormat string `json:"target_format"`
|
||||
}
|
||||
@@ -109,6 +109,7 @@ var (
|
||||
"customized_private_prefixes",
|
||||
"global_http_proxy",
|
||||
"global_https_proxy",
|
||||
"ignore_nonrunning_guests",
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -41,6 +41,9 @@ const (
|
||||
LocalFilePrefix = "file://"
|
||||
S3Prefix = "s3://"
|
||||
|
||||
IMAGE_STORAGE_DRIVER_LOCAL = "local"
|
||||
IMAGE_STORAGE_DRIVER_S3 = "s3"
|
||||
|
||||
// image properties
|
||||
IMAGE_OS_ARCH = "os_arch"
|
||||
IMAGE_OS_DISTRO = "os_distribution"
|
||||
|
||||
@@ -195,10 +195,13 @@ type STag struct {
|
||||
}
|
||||
|
||||
type MetadataResourceListInput struct {
|
||||
// 通过标签过滤
|
||||
// 通过标签过滤(包含这些标签)
|
||||
Tags []STag `json:"tags"`
|
||||
|
||||
// 通过标签过滤
|
||||
// 通过标签过滤(不包含这些标签)
|
||||
NoTags []STag `json:"no_tags"`
|
||||
|
||||
// 通过标签排序
|
||||
OrderByTag string `json:"order_by_tag"`
|
||||
|
||||
// deprecated
|
||||
|
||||
@@ -28,8 +28,8 @@ type AlertRecordShieldCreateInput struct {
|
||||
ResName string `json:"res_name"`
|
||||
ResId string `json:"res_id"`
|
||||
|
||||
StartTime time.Time `json:"start_time"`
|
||||
EndTime time.Time `json:"end_time"`
|
||||
StartTime string `json:"start_time"`
|
||||
EndTime string `json:"end_time"`
|
||||
}
|
||||
|
||||
type AlertRecordShieldDetails struct {
|
||||
@@ -39,6 +39,7 @@ type AlertRecordShieldDetails struct {
|
||||
CommonAlertDetails
|
||||
AlertName string `json:"alert_name"`
|
||||
ResName string `json:"res_name"`
|
||||
Expired bool `json:"expired"`
|
||||
}
|
||||
|
||||
type AlertRecordShieldListInput struct {
|
||||
@@ -48,9 +49,11 @@ type AlertRecordShieldListInput struct {
|
||||
apis.EnabledResourceBaseListInput
|
||||
apis.StatusStandaloneResourceListInput
|
||||
|
||||
AlertName string `json:"alert_name"`
|
||||
ResType string `json:"res_type"`
|
||||
ResName string `json:"res_name"`
|
||||
ResId string `json:"res_id"`
|
||||
AlertId string `json:"alert_id"`
|
||||
AlertName string `json:"alert_name"`
|
||||
ResType string `json:"res_type"`
|
||||
ResName string `json:"res_name"`
|
||||
ResId string `json:"res_id"`
|
||||
AlertId string `json:"alert_id"`
|
||||
StartTime *time.Time `json:"start_time"`
|
||||
EndTime *time.Time `json:"end_time"`
|
||||
}
|
||||
|
||||
@@ -14,7 +14,11 @@
|
||||
|
||||
package monitor
|
||||
|
||||
import "yunion.io/x/onecloud/pkg/apis"
|
||||
import (
|
||||
"time"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/apis"
|
||||
)
|
||||
|
||||
const (
|
||||
SEND_STATE_OK = "ok"
|
||||
@@ -41,8 +45,9 @@ type AlertRecordDetails struct {
|
||||
apis.StatusStandaloneResourceDetails
|
||||
apis.ScopedResourceBaseInfo
|
||||
|
||||
ResNum int64 `json:"res_num"`
|
||||
AlertName string `json:"alert_name"`
|
||||
ResNum int64 `json:"res_num"`
|
||||
AlertName string `json:"alert_name"`
|
||||
TriggerTime time.Time
|
||||
}
|
||||
|
||||
type AlertRecordCreateInput struct {
|
||||
|
||||
@@ -56,6 +56,8 @@ type CommonAlertCreateInput struct {
|
||||
Channel []string `json:"channel"`
|
||||
// 通知接受者
|
||||
Recipients []string `json:"recipients"`
|
||||
|
||||
RobotIds []string `json:"robot_ids"`
|
||||
// 静默期
|
||||
SilentPeriod string `json:"silent_period"`
|
||||
// 报警类型
|
||||
@@ -101,6 +103,7 @@ type CommonAlertListInput struct {
|
||||
Level string `json:"level"`
|
||||
ResType []string `json:"res_type"`
|
||||
UsedBy string `json:"used_by"`
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
type CommonAlertUpdateInput struct {
|
||||
@@ -132,6 +135,7 @@ type CommonAlertDetails struct {
|
||||
NotifierId string `json:"notifier_id"`
|
||||
Channel []string `json:"channel"`
|
||||
Recipients []string `json:"recipients"`
|
||||
RobotIds []string `json:"robot_ids"`
|
||||
// 静默期
|
||||
SilentPeriod string `json:"silent_period"`
|
||||
Status string `json:"status"`
|
||||
|
||||
@@ -29,6 +29,7 @@ const (
|
||||
METRIC_RES_TYPE_TENANT = "tenant"
|
||||
METRIC_RES_TYPE_DOMAIN = "domain"
|
||||
METRIC_RES_TYPE_STORAGE = "storage"
|
||||
METRIC_RES_TYPE_ELB = "elb"
|
||||
//ext is prefix!
|
||||
METRIC_RES_TYPE_JENKINS = "ext_jenkins"
|
||||
METRIC_RES_TYPE_EXT_MYSQL = "ext_mysql"
|
||||
|
||||
@@ -42,11 +42,16 @@ type MonitorResourceListInput struct {
|
||||
ResId []string `json:"res_id"`
|
||||
ResType string `json:"res_type"`
|
||||
OnlyResId bool `json:"only_res_id"`
|
||||
|
||||
ResName string `json:"res_name"`
|
||||
}
|
||||
|
||||
type MonitorResourceDetails struct {
|
||||
apis.VirtualResourceDetails
|
||||
compute.CloudregionResourceInfo
|
||||
compute.CloudaccountResourceInfo
|
||||
Ips string `json:"ips"`
|
||||
AccessIp string `json:"access_ip"`
|
||||
|
||||
AttachAlertCount int64 `json:"attach_alert_count"`
|
||||
}
|
||||
|
||||
@@ -30,6 +30,9 @@ type MonitorResourceJointListInput struct {
|
||||
Alerting bool `json:"alertinng"`
|
||||
SendState string `json:"send_state"`
|
||||
ResType string `json:"res_type"`
|
||||
ResName string `json:"res_name"`
|
||||
AlertName string `json:"alert_name"`
|
||||
Level string `json:"level"`
|
||||
}
|
||||
|
||||
type MonitorResourceJointCreateInput struct {
|
||||
@@ -44,10 +47,13 @@ type MonitorResourceJointCreateInput struct {
|
||||
}
|
||||
|
||||
type MonitorResourceJointDetails struct {
|
||||
ResName string `json:"res_name"`
|
||||
ResType string `json:"res_type"`
|
||||
AlertName string `json:"alert_name"`
|
||||
AlertRule jsonutils.JSONObject `json:"alert_rule"`
|
||||
Level string `json:"level"`
|
||||
SendState string `json:"send_state"`
|
||||
ResName string `json:"res_name"`
|
||||
ResId string `json:"res_id"`
|
||||
ResType string `json:"res_type"`
|
||||
AlertName string `json:"alert_name"`
|
||||
AlertRule jsonutils.JSONObject `json:"alert_rule"`
|
||||
Level string `json:"level"`
|
||||
SendState string `json:"send_state"`
|
||||
State string `json:"state"`
|
||||
IsSetShield bool `json:"is_set_shield"`
|
||||
}
|
||||
|
||||
@@ -78,8 +78,9 @@ type NotificationListInput struct {
|
||||
}
|
||||
|
||||
type NotificationSettingOneCloud struct {
|
||||
Channel string `json:"channel"`
|
||||
UserIds []string `json:"user_ids"`
|
||||
Channel string `json:"channel"`
|
||||
UserIds []string `json:"user_ids"`
|
||||
RobotIds []string `json:"robot_ids"`
|
||||
}
|
||||
|
||||
type SendWebhookSync struct {
|
||||
|
||||
@@ -106,6 +106,16 @@ const (
|
||||
TOPIC_RESOURCE_ELASTICCACHE = "elasticcache"
|
||||
TOPIC_RESOURCE_SCHEDULEDTASK = "scheduledtask"
|
||||
TOPIC_RESOURCE_BAREMETAL = "baremetal"
|
||||
TOPIC_RESOURCE_VPC = "vpc"
|
||||
TOPIC_RESOURCE_DNSZONE = "dns_zone"
|
||||
TOPIC_RESOURCE_NATGATEWAY = "natgateway"
|
||||
TOPIC_RESOURCE_WEBAPP = "webapp"
|
||||
TOPIC_RESOURCE_CDNDOMAIN = "cdn_domain"
|
||||
TOPIC_RESOURCE_FILESYSTEM = "file_system"
|
||||
TOPIC_RESOURCE_WAF = "waf_instance"
|
||||
TOPIC_RESOURCE_KAFKA = "kafka"
|
||||
TOPIC_RESOURCE_ELASTICSEARCH = "elastic_search"
|
||||
TOPIC_RESOURCE_MONGODB = "mongodb"
|
||||
|
||||
SUBSCRIBER_TYPE_ROLE = "role"
|
||||
SUBSCRIBER_TYPE_ROBOT = "robot"
|
||||
|
||||
@@ -40,6 +40,10 @@ var (
|
||||
ActionCreateBackupServer SAction = "add_backup_server"
|
||||
ActionDelBackupServer SAction = "delete_backup_server"
|
||||
|
||||
ActionSyncCreate SAction = "sync_create"
|
||||
ActionSyncUpdate SAction = "sync_update"
|
||||
ActionSyncDelete SAction = "sync_delete"
|
||||
|
||||
ResultFailed SResult = "failed"
|
||||
ResultSucceed SResult = "succeed"
|
||||
)
|
||||
|
||||
@@ -40,7 +40,7 @@ type ModelBaseDetails struct {
|
||||
CanUpdate bool `json:"can_update"`
|
||||
|
||||
// 资源不能更新的原因
|
||||
UpdateFailReason string `json:"update_fail_reason"`
|
||||
UpdateFailReason httperrors.Error `json:"update_fail_reason"`
|
||||
}
|
||||
|
||||
type ModelBaseShortDescDetail struct {
|
||||
@@ -238,3 +238,9 @@ type StatusStatistic struct {
|
||||
// 需要指定pending_delete=all
|
||||
PendingDeletedCount int64 `json:"pending_deleted_count"`
|
||||
}
|
||||
|
||||
type ProjectStatistic struct {
|
||||
Count int
|
||||
Id string
|
||||
Name string
|
||||
}
|
||||
|
||||
@@ -32,4 +32,5 @@ const (
|
||||
HUAWEI = "huawei"
|
||||
APSARA = "apsara"
|
||||
JDCLOUD = "jdcloud"
|
||||
CLOUDPODS = "cloudpods"
|
||||
)
|
||||
|
||||
@@ -65,6 +65,7 @@ type Application struct {
|
||||
isExiting bool
|
||||
idleConnsClosed chan struct{}
|
||||
httpServer *http.Server
|
||||
slaveHttpServer *http.Server
|
||||
}
|
||||
|
||||
const (
|
||||
@@ -490,15 +491,16 @@ func (app *Application) ListenAndServeWithoutCleanup(addr, certFile, keyFile str
|
||||
}
|
||||
|
||||
func (app *Application) ListenAndServeTLSWithCleanup2(addr string, certFile, keyFile string, onStop func(), isMaster bool) {
|
||||
httpSrv := app.initServer(addr)
|
||||
if isMaster {
|
||||
app.addDefaultHandlers()
|
||||
AddPProfHandler(app)
|
||||
}
|
||||
app.httpServer = app.initServer(addr)
|
||||
if isMaster {
|
||||
app.httpServer = httpSrv
|
||||
app.registerCleanShutdown(app.httpServer, onStop)
|
||||
} else {
|
||||
app.slaveHttpServer = httpSrv
|
||||
}
|
||||
app.listenAndServeInternal(app.httpServer, certFile, keyFile)
|
||||
app.listenAndServeInternal(httpSrv, certFile, keyFile)
|
||||
if isMaster {
|
||||
app.waitCleanShutdown()
|
||||
}
|
||||
|
||||
@@ -185,6 +185,7 @@ func (m *SBaremetalManager) CleanBaremetal(bmId string) {
|
||||
func (m *SBaremetalManager) updateBaremetal(session *mcclient.ClientSession, bmId string) (jsonutils.JSONObject, error) {
|
||||
params := jsonutils.NewDict()
|
||||
params.Add(jsonutils.JSONTrue, "is_baremetal")
|
||||
params.Add(jsonutils.JSONTrue, "not_sync_config")
|
||||
obj, err := modules.Hosts.Put(session, bmId, params)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -2448,9 +2449,7 @@ func (s *SBaremetalServer) DoDiskConfig(term *ssh.Client) error {
|
||||
}
|
||||
}
|
||||
|
||||
tool := disktool.NewSSHPartitionTool(term)
|
||||
tool.FetchDiskConfs(baremetal.GetDiskConfigurations(layouts))
|
||||
err = tool.RetrieveDiskInfo()
|
||||
tool, err := disktool.NewSSHPartitionTool(term, layouts)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -2458,6 +2457,7 @@ func (s *SBaremetalServer) DoDiskConfig(term *ssh.Client) error {
|
||||
for tried := 0; !tool.IsAllDisksReady() && tried < maxTries; tried++ {
|
||||
time.Sleep(5 * time.Second)
|
||||
tool.RetrieveDiskInfo()
|
||||
log.Warningf("disktool not ready string: %s", tool.DebugString())
|
||||
}
|
||||
|
||||
if !tool.IsAllDisksReady() {
|
||||
@@ -2528,11 +2528,9 @@ func (s *SBaremetalServer) DoPartitionDisk(term *ssh.Client) ([]*disktool.Partit
|
||||
return nil, errors.Wrapf(err, "CalculateLayout")
|
||||
}
|
||||
|
||||
tool := disktool.NewSSHPartitionTool(term)
|
||||
tool.FetchDiskConfs(baremetal.GetDiskConfigurations(layouts))
|
||||
err = tool.RetrieveDiskInfo()
|
||||
tool, err := disktool.NewSSHPartitionTool(term, layouts)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "RetrieveDiskInfo")
|
||||
return nil, errors.Wrapf(err, "NewSSHPartitionTool")
|
||||
}
|
||||
|
||||
disks, _ := s.desc.GetArray("disks")
|
||||
@@ -2605,9 +2603,7 @@ func (s *SBaremetalServer) DoRebuildRootDisk(term *ssh.Client) ([]*disktool.Part
|
||||
return nil, err
|
||||
}
|
||||
|
||||
tool := disktool.NewSSHPartitionTool(term)
|
||||
tool.FetchDiskConfs(baremetal.GetDiskConfigurations(layouts))
|
||||
err = tool.RetrieveDiskInfo()
|
||||
tool, err := disktool.NewSSHPartitionTool(term, layouts)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -2663,7 +2659,13 @@ func (s *SBaremetalServer) DoRebuildRootDisk(term *ssh.Client) ([]*disktool.Part
|
||||
|
||||
func (s *SBaremetalServer) SyncPartitionSize(term *ssh.Client, parts []*disktool.Partition) ([]jsonutils.JSONObject, error) {
|
||||
disks, _ := s.desc.GetArray("disks")
|
||||
|
||||
// calculate root partitions count
|
||||
rootPartsCnt := len(parts) - len(disks) + 1
|
||||
if len(parts) < len(disks) {
|
||||
// HACK: rebuild root disk
|
||||
rootPartsCnt = len(parts)
|
||||
}
|
||||
rootParts := parts[0:rootPartsCnt]
|
||||
dataParts := parts[rootPartsCnt:]
|
||||
idx := 0
|
||||
@@ -2722,7 +2724,58 @@ func (s *SBaremetalServer) deployFs(term *ssh.Client, deployInfo *deployapi.Depl
|
||||
if strings.ToLower(rootfs.GetOs()) == "windows" {
|
||||
return nil, fmt.Errorf("Unsupported OS: %s", rootfs.GetOs())
|
||||
}
|
||||
return guestfs.DeployGuestFs(rootfs, s.desc, deployInfo)
|
||||
desc, err := deployapi.GuestDescToDeployDesc(s.desc)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "To deploy desc fail")
|
||||
}
|
||||
desc, err = s.reIndexDescNics(term, desc)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "reIndexDescNics")
|
||||
}
|
||||
|
||||
return guestfs.DeployGuestFs(rootfs, desc, deployInfo)
|
||||
}
|
||||
|
||||
func (s *SBaremetalServer) reIndexDescNics(term *ssh.Client, desc *deployapi.GuestDesc) (*deployapi.GuestDesc, error) {
|
||||
rNics, err := tasks.GetNicsInfo(term)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "Get server %s remote nics", s.GetName())
|
||||
}
|
||||
findRemoteNic := func(mac string) (int, *types.SNicDevInfo) {
|
||||
for idx, nic := range rNics {
|
||||
if nic.Mac.String() == mac {
|
||||
return idx, rNics[idx]
|
||||
}
|
||||
}
|
||||
return -1, nil
|
||||
}
|
||||
reIndexNics := func(nics []*deployapi.Nic) ([]*deployapi.Nic, error) {
|
||||
for idx, nic := range nics {
|
||||
if nic.GetNicType() == api.NIC_TYPE_IPMI {
|
||||
continue
|
||||
}
|
||||
rIdx, rNic := findRemoteNic(nic.GetMac())
|
||||
if rNic == nil {
|
||||
return nil, errors.Errorf("Not found remote nic by mac %q", nic.GetMac())
|
||||
}
|
||||
if nics[idx].Index != int32(rIdx) {
|
||||
log.Infof("Reindex nic %s index %d to %d", nics[idx].GetMac(), nics[idx].Index, rIdx)
|
||||
nics[idx].Index = int32(rIdx)
|
||||
}
|
||||
}
|
||||
return nics, nil
|
||||
}
|
||||
nics, err := reIndexNics(desc.Nics)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "Reindex nics")
|
||||
}
|
||||
desc.Nics = nics
|
||||
sNics, err := reIndexNics(desc.NicsStandby)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "Reindex standby nics")
|
||||
}
|
||||
desc.NicsStandby = sNics
|
||||
return desc, nil
|
||||
}
|
||||
|
||||
func (s *SBaremetalServer) GetNics() []types.SServerNic {
|
||||
|
||||
@@ -36,6 +36,7 @@ type BaremetalOptions struct {
|
||||
TftpMaxTimeoutRetries int `default:"50" help:"Maximal tftp timeout retries, default is 50"`
|
||||
LengthyWorkerCount int `default:"8" help:"Parallel worker count for lengthy tasks"`
|
||||
ShortWorkerCount int `default:"8" help:"Parallel worker count for short-lived tasks"`
|
||||
TaskWorkerCount int `default:"32" help:"Parallel worker count for tasks"`
|
||||
|
||||
DefaultIpmiPassword string `help:"Default IPMI passowrd"`
|
||||
DefaultStrongIpmiPassword string `help:"Default strong IPMI passowrd"`
|
||||
|
||||
@@ -79,6 +79,7 @@ func (h *DHCPHandler) ServeDHCP(pkt dhcp.Packet, _ *net.UDPAddr, _ *net.Interfac
|
||||
if req.RelayAddr.String() == "0.0.0.0" {
|
||||
return nil, nil, fmt.Errorf("Request not from a DHCP relay, ignore mac: %s", req.ClientMac)
|
||||
}
|
||||
log.Infof("[DHCP] from relay %s packet, mac: %s", req.RelayAddr, req.ClientMac)
|
||||
conf, targets, err := req.fetchConfig(h.baremetalManager.GetClientSession())
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
@@ -188,7 +189,7 @@ func (req *dhcpRequest) fetchConfig(session *mcclient.ClientSession) (*dhcp.Resp
|
||||
if len(netConf.GuestDhcp) > 0 {
|
||||
dhcpAddrList = strings.Split(netConf.GuestDhcp, ",")
|
||||
}
|
||||
log.Debugf("dhcpAddrList %s", dhcpAddrList)
|
||||
log.Debugf("find network config %#v, dhcpAddrList %s", netConf, dhcpAddrList)
|
||||
|
||||
// TODO: set cache for netConf
|
||||
if req.isPXERequest() {
|
||||
@@ -227,6 +228,7 @@ func (req *dhcpRequest) fetchConfig(session *mcclient.ClientSession) (*dhcp.Resp
|
||||
// from guestdhcp import GuestDHCPHelperTask
|
||||
// task = GuestDHCPHelperTask(self)
|
||||
// task.start()
|
||||
log.Infof("Not found baremetal by mac: %s", req.ClientMac)
|
||||
return nil, nil, nil
|
||||
}
|
||||
req.baremetalInstance = bmInstance
|
||||
|
||||
@@ -670,6 +670,10 @@ func getDMIMemInfo(cli *ssh.Client) (*types.SDMIMemInfo, error) {
|
||||
return sysutils.ParseDMIMemInfo(ret), nil
|
||||
}
|
||||
|
||||
func GetNicsInfo(cli *ssh.Client) ([]*types.SNicDevInfo, error) {
|
||||
return getNicsInfo(cli)
|
||||
}
|
||||
|
||||
func getNicsInfo(cli *ssh.Client) ([]*types.SNicDevInfo, error) {
|
||||
ret, err := cli.Run("/lib/mos/lsnic")
|
||||
if err != nil {
|
||||
|
||||
@@ -24,16 +24,16 @@ import (
|
||||
"yunion.io/x/log"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/appsrv"
|
||||
"yunion.io/x/onecloud/pkg/baremetal/options"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules"
|
||||
)
|
||||
|
||||
var baremetalTaskWorkerMan *appsrv.SWorkerManager
|
||||
|
||||
func init() {
|
||||
baremetalTaskWorkerMan = appsrv.NewWorkerManager("BaremetalTaskWorkerManager", 8, 1024, false)
|
||||
}
|
||||
|
||||
func GetWorkManager() *appsrv.SWorkerManager {
|
||||
if baremetalTaskWorkerMan == nil {
|
||||
baremetalTaskWorkerMan = appsrv.NewWorkerManager("BaremetalTaskWorkerManager", options.Options.TaskWorkerCount, 1024, false)
|
||||
}
|
||||
return baremetalTaskWorkerMan
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ func ExecuteTask(task ITask, args interface{}) {
|
||||
task: task,
|
||||
args: args,
|
||||
}
|
||||
baremetalTaskWorkerMan.Run(t, nil, nil)
|
||||
GetWorkManager().Run(t, nil, nil)
|
||||
}
|
||||
|
||||
func executeTask(task ITask, args interface{}) {
|
||||
|
||||
@@ -18,6 +18,7 @@ import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/log"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/baremetal/utils/raid"
|
||||
@@ -91,7 +92,7 @@ func DetectStorageInfo(term raid.IExecTerm, wait bool) ([]*baremetal.BaremetalSt
|
||||
break
|
||||
}
|
||||
}
|
||||
log.Infof("RaidDiskInfo: %#v, NonRaidSCSIDiskInfo: %#v, PCIEDiskInfo: %#v", raidDiskInfo, nonRaidDiskInfo, pcieDiskInfo)
|
||||
log.Infof("RaidDiskInfo: %s, NonRaidSCSIDiskInfo: %s, PCIEDiskInfo: %s", jsonutils.Marshal(raidDiskInfo), jsonutils.Marshal(nonRaidDiskInfo), jsonutils.Marshal(pcieDiskInfo))
|
||||
if len(nonRaidDiskInfo) < len(lvDiskInfo) {
|
||||
return nil, nil, nil, fmt.Errorf("Fail to retrieve disk info")
|
||||
}
|
||||
|
||||
@@ -288,7 +288,7 @@ func (ps *DiskPartitions) String() string {
|
||||
func (ps *DiskPartitions) DebugString() string {
|
||||
partitionsStr := []string{}
|
||||
for _, p := range ps.partitions {
|
||||
partitionsStr = append(partitionsStr, fmt.Sprintf("%#v", *p))
|
||||
partitionsStr = append(partitionsStr, fmt.Sprintf("{%#v}", *p))
|
||||
}
|
||||
return fmt.Sprintf("driver: %s, dev: %s, sectors: %d, partitions: %#v", ps.driver, ps.dev, ps.sectors, partitionsStr)
|
||||
}
|
||||
@@ -599,7 +599,7 @@ func (tool *PartitionTool) DebugString() string {
|
||||
return ret
|
||||
}
|
||||
for driver, disks := range tool.diskTable {
|
||||
s := fmt.Sprintf("%s: %v", driver, disksString(disks))
|
||||
s := fmt.Sprintf("(%s: %v)", driver, disksString(disks))
|
||||
ret = append(ret, s)
|
||||
}
|
||||
return strings.Join(ret, "\n")
|
||||
@@ -753,7 +753,7 @@ type SSHPartitionTool struct {
|
||||
term *ssh.Client
|
||||
}
|
||||
|
||||
func NewSSHPartitionTool(term *ssh.Client) *SSHPartitionTool {
|
||||
func newSSHPartitionTool(term *ssh.Client) *SSHPartitionTool {
|
||||
tool := &SSHPartitionTool{
|
||||
term: term,
|
||||
}
|
||||
@@ -761,6 +761,15 @@ func NewSSHPartitionTool(term *ssh.Client) *SSHPartitionTool {
|
||||
return tool
|
||||
}
|
||||
|
||||
func NewSSHPartitionTool(term *ssh.Client, layouts []baremetal.Layout) (*SSHPartitionTool, error) {
|
||||
tool := newSSHPartitionTool(term)
|
||||
tool.FetchDiskConfs(baremetal.GetDiskConfigurations(layouts))
|
||||
if err := tool.RetrieveDiskInfo(); err != nil {
|
||||
return nil, errors.Wrapf(err, "RetrieveDiskInfo")
|
||||
}
|
||||
return tool, nil
|
||||
}
|
||||
|
||||
func (tool *SSHPartitionTool) Run(cmds ...string) ([]string, error) {
|
||||
return tool.term.Run(cmds...)
|
||||
}
|
||||
|
||||
655
pkg/baremetal/utils/raid/adaptec/adaptec.go
Normal file
655
pkg/baremetal/utils/raid/adaptec/adaptec.go
Normal file
@@ -0,0 +1,655 @@
|
||||
// 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 adaptec
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"regexp"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"yunion.io/x/log"
|
||||
"yunion.io/x/pkg/errors"
|
||||
"yunion.io/x/pkg/tristate"
|
||||
"yunion.io/x/pkg/util/stringutils"
|
||||
|
||||
api "yunion.io/x/onecloud/pkg/apis/compute"
|
||||
"yunion.io/x/onecloud/pkg/baremetal/utils/raid"
|
||||
"yunion.io/x/onecloud/pkg/compute/baremetal"
|
||||
"yunion.io/x/onecloud/pkg/util/regutils2"
|
||||
)
|
||||
|
||||
func init() {
|
||||
raid.RegisterDriver(api.DISK_DRIVER_ADAPTECRAID, NewAdaptecRaid)
|
||||
}
|
||||
|
||||
const (
|
||||
ControllerModeRaidExposeRaw = "RAID (Expose RAW)"
|
||||
ControllerModeRaidHideRaw = "RAID (Hide RAW)"
|
||||
ControllerModeMixed = "Mixed"
|
||||
)
|
||||
|
||||
type AdaptecRaid struct {
|
||||
term raid.IExecTerm
|
||||
adapters []*AdaptecRaidAdaptor
|
||||
}
|
||||
|
||||
func NewAdaptecRaid(term raid.IExecTerm) raid.IRaidDriver {
|
||||
return &AdaptecRaid{
|
||||
term: term,
|
||||
adapters: make([]*AdaptecRaidAdaptor, 0),
|
||||
}
|
||||
}
|
||||
|
||||
func GetCommand(args ...string) string {
|
||||
bin := "/opt/adaptec/arcconf"
|
||||
return raid.GetCommand(bin, args...)
|
||||
}
|
||||
|
||||
func (r *AdaptecRaid) GetName() string {
|
||||
return baremetal.DISK_DRIVER_ADAPTECRAID
|
||||
}
|
||||
|
||||
func (r *AdaptecRaid) ParsePhyDevs() error {
|
||||
cmd := GetCommand("LIST")
|
||||
ret, err := r.term.Run(cmd)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "list controllers")
|
||||
}
|
||||
if err := r.parsePhyDevs(ret); err != nil {
|
||||
return errors.Wrap(err, "parse physical device")
|
||||
}
|
||||
if len(r.adapters) == 0 {
|
||||
return errors.Errorf("Not found adaptec raid controller")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r *AdaptecRaid) CleanRaid() error {
|
||||
for _, ada := range r.adapters {
|
||||
ada.removeJBODDisks()
|
||||
ada.RemoveLogicVolumes()
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r *AdaptecRaid) GetAdapters() []raid.IRaidAdapter {
|
||||
ret := make([]raid.IRaidAdapter, 0)
|
||||
for _, a := range r.adapters {
|
||||
ret = append(ret, a)
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
||||
func (r *AdaptecRaid) PreBuildRaid(confs []*api.BaremetalDiskConfig, adapterIdx int) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
var (
|
||||
adaptorIDPatter = regexp.MustCompile(`Controller (?P<idx>[0-9]+):`)
|
||||
)
|
||||
|
||||
func getAdaptorIndex(line string) int {
|
||||
adapStr := regutils2.GetParams(adaptorIDPatter, line)["idx"]
|
||||
if adapStr == "" {
|
||||
return -1
|
||||
}
|
||||
adapInt, err := strconv.Atoi(adapStr)
|
||||
if err != nil {
|
||||
log.Errorf("Parse adapator string %q id error: %v", line, err)
|
||||
return -1
|
||||
}
|
||||
return adapInt
|
||||
}
|
||||
|
||||
func (r *AdaptecRaid) parsePhyDevs(lines []string) error {
|
||||
for _, line := range lines {
|
||||
index := getAdaptorIndex(line)
|
||||
if index == -1 {
|
||||
continue
|
||||
}
|
||||
ada, err := NewAdaptecRaidAdaptor(index, r)
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "New raid adaptor %d", index)
|
||||
}
|
||||
r.adapters = append(r.adapters, ada)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type AdaptecRaidAdaptor struct {
|
||||
*adaptorInfo
|
||||
|
||||
index int
|
||||
raid *AdaptecRaid
|
||||
devs []*AdaptecRaidPhyDev
|
||||
}
|
||||
|
||||
var (
|
||||
_ raid.IRaidAdapter = new(AdaptecRaidAdaptor)
|
||||
)
|
||||
|
||||
func NewAdaptecRaidAdaptor(index int, raid *AdaptecRaid) (*AdaptecRaidAdaptor, error) {
|
||||
adaptor := AdaptecRaidAdaptor{
|
||||
index: index,
|
||||
raid: raid,
|
||||
}
|
||||
if err := adaptor.fillInfo(); err != nil {
|
||||
return nil, errors.Wrapf(err, "fill adaptor %d info", adaptor.index)
|
||||
}
|
||||
if err := adaptor.fillDevices(); err != nil {
|
||||
return nil, errors.Wrap(err, "fill physical devices")
|
||||
}
|
||||
/*
|
||||
* if !adaptor.isRaidHideRawMode() {
|
||||
* if err := adaptor.setControllerModeRaidHideRaw(); err != nil {
|
||||
* return nil, errors.Wrap(err, "set controller mode to raid hide raw")
|
||||
* }
|
||||
* }
|
||||
*/
|
||||
return &adaptor, nil
|
||||
}
|
||||
|
||||
func (ada *AdaptecRaidAdaptor) GetIndex() int {
|
||||
return ada.index
|
||||
}
|
||||
|
||||
func (ada *AdaptecRaidAdaptor) PreBuildRaid(confs []*api.BaremetalDiskConfig) error {
|
||||
if !ada.isRaidHideRawMode() {
|
||||
if err := ada.setControllerModeRaidHideRaw(); err != nil {
|
||||
return errors.Wrapf(err, "set controller mode to raid hide raw mode")
|
||||
}
|
||||
}
|
||||
if err := ada.removeJBODDisks(); err != nil {
|
||||
log.Warningf("remove all JBOD disks: %v", err)
|
||||
}
|
||||
// uninitialize all device to ready state
|
||||
if err := ada.uninitializeAllDevice(); err != nil {
|
||||
// return errors.Wrap(err, "uninitialize all devices")
|
||||
log.Warningf("uninitializeAllDevice error: %v", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (ada *AdaptecRaidAdaptor) getInitializeCmd(args ...string) string {
|
||||
newArgs := []string{"TASK", "START", fmt.Sprintf("%d", ada.GetIndex()), "DEVICE"}
|
||||
newArgs = append(newArgs, args...)
|
||||
newArgs = append(newArgs, "INITIALIZE", "noprompt")
|
||||
return GetCommand(newArgs...)
|
||||
}
|
||||
|
||||
func (ada *AdaptecRaidAdaptor) initializeDevice(channel string, id string) error {
|
||||
cmd := ada.getInitializeCmd(channel, id)
|
||||
_, err := ada.remoteRun(fmt.Sprintf("initialize device %s:%s", channel, id), cmd)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (ada *AdaptecRaidAdaptor) initializeAllDevice() error {
|
||||
cmd := ada.getInitializeCmd("ALL")
|
||||
_, err := ada.remoteRun("initialize all device", cmd)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (ada *AdaptecRaidAdaptor) uninitializeDevice(channel string, id string) error {
|
||||
cmd := ada.getUninitializeCmd(channel, id)
|
||||
_, err := ada.remoteRun(fmt.Sprintf("uninitialize device %s:%s", channel, id), cmd)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (ada *AdaptecRaidAdaptor) getUninitializeCmd(args ...string) string {
|
||||
newArgs := []string{"TASK", "START", fmt.Sprintf("%d", ada.GetIndex()), "DEVICE"}
|
||||
newArgs = append(newArgs, args...)
|
||||
newArgs = append(newArgs, "UNINITIALIZE", "noprompt")
|
||||
return GetCommand(newArgs...)
|
||||
}
|
||||
|
||||
func (ada *AdaptecRaidAdaptor) uninitializeAllDevice() error {
|
||||
cmd := ada.getUninitializeCmd("ALL")
|
||||
_, err := ada.remoteRun("uninitialize all devices", cmd)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (ada *AdaptecRaidAdaptor) getTerm() raid.IExecTerm {
|
||||
return ada.raid.term
|
||||
}
|
||||
|
||||
func (ada *AdaptecRaidAdaptor) remoteRun(hint string, cmd string) ([]string, error) {
|
||||
out, err := ada.getTerm().Run(cmd)
|
||||
if err != nil {
|
||||
return out, errors.Wrapf(err, "%q, out: %v", hint, out)
|
||||
}
|
||||
log.Debugf("remote run cmd %s %q successfully: %v", hint, cmd, out)
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (ada *AdaptecRaidAdaptor) fillInfo() error {
|
||||
cmd := GetCommand("GETCONFIG", fmt.Sprintf("%d", ada.index), "AD")
|
||||
ret, err := ada.remoteRun("get AD config", cmd)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
info, err := getAdaptorInfo(ret)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "get adaptor info")
|
||||
}
|
||||
ada.adaptorInfo = info
|
||||
return nil
|
||||
}
|
||||
|
||||
func (ada *AdaptecRaidAdaptor) fillDevices() error {
|
||||
cmd := GetCommand("GETCONFIG", fmt.Sprintf("%d", ada.index), "PD")
|
||||
ret, err := ada.remoteRun("get PD config", cmd)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
devs := getPhyDevices(ada.GetIndex(), ret)
|
||||
ada.devs = append(ada.devs, devs...)
|
||||
return nil
|
||||
}
|
||||
|
||||
func getPhyDevices(adapter int, lines []string) []*AdaptecRaidPhyDev {
|
||||
dev := newPhyDev(adapter)
|
||||
devs := make([]*AdaptecRaidPhyDev, 0)
|
||||
for _, line := range lines {
|
||||
if dev.parseLine(line) && dev.isComplete() {
|
||||
tmpDev := dev
|
||||
devs = append(devs, tmpDev)
|
||||
dev = newPhyDev(adapter)
|
||||
}
|
||||
}
|
||||
return devs
|
||||
}
|
||||
|
||||
func (ada *AdaptecRaidAdaptor) getChannelId(storage *baremetal.BaremetalStorage) (string, string, error) {
|
||||
if storage.Addr == "" {
|
||||
return "", "", errors.Errorf("storage %#v addr is empty", storage)
|
||||
}
|
||||
parts := strings.Split(storage.Addr, ":")
|
||||
if len(parts) != 2 {
|
||||
return "", "", errors.Errorf("invalid storage %#v addr %q", storage, storage.Addr)
|
||||
}
|
||||
return parts[0], parts[1], nil
|
||||
}
|
||||
|
||||
func (ada *AdaptecRaidAdaptor) getCreateCmd(args ...string) string {
|
||||
newArgs := []string{"CREATE", fmt.Sprintf("%d", ada.GetIndex())}
|
||||
newArgs = append(newArgs, args...)
|
||||
return GetCommand(newArgs...)
|
||||
}
|
||||
|
||||
// setControllerMode change adapter controller's mode
|
||||
// Controller Modes : 0 - RAID: Expose RAW
|
||||
// : 1 - Auto Volume Mode
|
||||
// : 2 - HBA Mode
|
||||
// : 3 - RAID: Hide RAW
|
||||
// : 4 - Simple Volume Mode
|
||||
// : 5 - Mixed
|
||||
func (ada *AdaptecRaidAdaptor) setControllerMode(mode int) error {
|
||||
cmd := GetCommand("SETCONTROLLERMODE", fmt.Sprintf("%d", ada.GetIndex()), fmt.Sprintf("%d", mode), "noprompt")
|
||||
if _, err := ada.remoteRun(fmt.Sprintf("set controller mode to %d", mode), cmd); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (ada *AdaptecRaidAdaptor) setControllerModeRaidExposeRaw() error {
|
||||
if err := ada.setControllerMode(0); err != nil {
|
||||
return errors.Wrap(err, "mode raid expose raw")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (ada *AdaptecRaidAdaptor) setControllerModeRaidHideRaw() error {
|
||||
if err := ada.setControllerMode(3); err != nil {
|
||||
return errors.Wrap(err, "mode raid hide raw")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (ada *AdaptecRaidAdaptor) setControllerModeMixed() error {
|
||||
if err := ada.setControllerMode(5); err != nil {
|
||||
return errors.Wrap(err, "mode mixed")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (ada *AdaptecRaidAdaptor) buildJBOD(dev *baremetal.BaremetalStorage) error {
|
||||
channel, id, err := ada.getChannelId(dev)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "get channel and id")
|
||||
}
|
||||
cmd := ada.getCreateCmd("JBOD", channel, id, "noprompt")
|
||||
if out, err := ada.remoteRun("create JBOD", cmd); err != nil {
|
||||
return errors.Wrapf(err, "run cmd %q, out: %q", cmd, out)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (ada *AdaptecRaidAdaptor) buildNonRaid(dev *baremetal.BaremetalStorage) error {
|
||||
// set to raid expose raw mode or mixed mode
|
||||
if !ada.isRaidExposeRawMode() && !ada.isMixedMode() {
|
||||
err := func() error {
|
||||
errs := []error{}
|
||||
if err := ada.setControllerModeRaidExposeRaw(); err != nil {
|
||||
errs = append(errs, err)
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
if err := ada.setControllerModeMixed(); err != nil {
|
||||
errs = append(errs, err)
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
return errors.NewAggregate(errs)
|
||||
}()
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "set raid to expose raw or mixed mode")
|
||||
}
|
||||
}
|
||||
// try build JBOD firstly
|
||||
if err := ada.buildJBOD(dev); err != nil {
|
||||
log.Warningf("try build JBOD error: %v", err)
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
// just uninitialize device when build JBOD fail
|
||||
channel, id, err := ada.getChannelId(dev)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if err := ada.uninitializeDevice(channel, id); err != nil {
|
||||
return errors.Wrapf(err, "uninitialize device %v when build jbod fail", dev)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (ada *AdaptecRaidAdaptor) BuildNoneRaid(devs []*baremetal.BaremetalStorage) error {
|
||||
for _, dev := range devs {
|
||||
if err := ada.buildNonRaid(dev); err != nil {
|
||||
return errors.Wrap(err, "build nonraid")
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (ada *AdaptecRaidAdaptor) getBuildRaidCmd(level int, devs []*baremetal.BaremetalStorage) (string, error) {
|
||||
if len(devs) == 0 {
|
||||
return "", errors.Errorf("devices is empty")
|
||||
}
|
||||
args := []string{"LOGICALDRIVE", "MAX", fmt.Sprintf("%d", level)}
|
||||
chIds := []string{}
|
||||
for _, dev := range devs {
|
||||
ch, id, err := ada.getChannelId(dev)
|
||||
if err != nil {
|
||||
return "", errors.Wrapf(err, "get device %v channel id", dev)
|
||||
}
|
||||
chIds = append(chIds, ch, id)
|
||||
}
|
||||
args = append(args, chIds...)
|
||||
cmd := ada.getCreateCmd(args...)
|
||||
return cmd, nil
|
||||
}
|
||||
|
||||
func (ada *AdaptecRaidAdaptor) buildRaid(level int, devs []*baremetal.BaremetalStorage, conf *api.BaremetalDiskConfig) error {
|
||||
// initialize each devs
|
||||
for _, dev := range devs {
|
||||
channel, id, err := ada.getChannelId(dev)
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "get device %v channel id", dev)
|
||||
}
|
||||
if err := ada.initializeDevice(channel, id); err != nil {
|
||||
// return errors.Wrapf(err, "initialize device")
|
||||
log.Warningf("initialize device error: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: support config to build raid params
|
||||
cmd, err := ada.getBuildRaidCmd(level, devs)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
_, err = ada.remoteRun(fmt.Sprintf("build raid %d", level), cmd)
|
||||
return err
|
||||
}
|
||||
|
||||
func (ada *AdaptecRaidAdaptor) BuildRaid0(devs []*baremetal.BaremetalStorage, conf *api.BaremetalDiskConfig) error {
|
||||
return ada.buildRaid(0, devs, conf)
|
||||
}
|
||||
|
||||
func (ada *AdaptecRaidAdaptor) BuildRaid1(devs []*baremetal.BaremetalStorage, conf *api.BaremetalDiskConfig) error {
|
||||
return ada.buildRaid(1, devs, conf)
|
||||
}
|
||||
|
||||
func (ada *AdaptecRaidAdaptor) BuildRaid5(devs []*baremetal.BaremetalStorage, conf *api.BaremetalDiskConfig) error {
|
||||
return ada.buildRaid(5, devs, conf)
|
||||
}
|
||||
|
||||
func (ada *AdaptecRaidAdaptor) BuildRaid10(devs []*baremetal.BaremetalStorage, conf *api.BaremetalDiskConfig) error {
|
||||
return ada.buildRaid(10, devs, conf)
|
||||
}
|
||||
|
||||
func (ada *AdaptecRaidAdaptor) GetDevices() []*baremetal.BaremetalStorage {
|
||||
ret := []*baremetal.BaremetalStorage{}
|
||||
for idx, dev := range ada.devs {
|
||||
ret = append(ret, dev.ToBaremetalStorage(idx))
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
||||
func (ada *AdaptecRaidAdaptor) GetLogicVolumes() ([]*raid.RaidLogicalVolume, error) {
|
||||
cmd := GetCommand("GETCONFIG", fmt.Sprintf("%d", ada.index), "LD")
|
||||
ret, err := ada.remoteRun("get logic volumes", cmd)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("Get logic volumes error: %v", err)
|
||||
}
|
||||
return getLogicalVolumes(ada.index, ret)
|
||||
}
|
||||
|
||||
func getLogicalVolumes(adapter int, lines []string) ([]*raid.RaidLogicalVolume, error) {
|
||||
lvs := make([]*raid.RaidLogicalVolume, 0)
|
||||
for _, line := range lines {
|
||||
m := regutils2.SubGroupMatch(`Logical Device number\s+(?P<idx>\d+)`, line)
|
||||
if len(m) > 0 {
|
||||
idxStr := m["idx"]
|
||||
idx, err := strconv.Atoi(idxStr)
|
||||
if err != nil {
|
||||
return nil, errors.Errorf("%s index str is not digit: %v", idxStr, err)
|
||||
}
|
||||
lvs = append(lvs, &raid.RaidLogicalVolume{
|
||||
Index: idx,
|
||||
Adapter: adapter,
|
||||
})
|
||||
}
|
||||
}
|
||||
return lvs, nil
|
||||
}
|
||||
|
||||
func (ada *AdaptecRaidAdaptor) removeJBODDisks() error {
|
||||
cmd := GetCommand("DELETE", fmt.Sprintf("%d", ada.index), "JBOD", "ALL", "noprompt")
|
||||
out, err := ada.remoteRun("delete JBOD disks", cmd)
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "delete all JBOD output: %q", out)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (ada *AdaptecRaidAdaptor) RemoveLogicVolumes() error {
|
||||
lvs, err := ada.GetLogicVolumes()
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "get logic volumes")
|
||||
}
|
||||
if len(lvs) == 0 {
|
||||
return nil
|
||||
}
|
||||
cmd := GetCommand("DELETE", fmt.Sprintf("%d", ada.index), "LOGICALDRIVE", "ALL", "noprompt")
|
||||
out, err := ada.remoteRun("delete logical volumes", cmd)
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "delete all logicaldrive output: %q", out)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type adaptorInfo struct {
|
||||
status string
|
||||
mode string
|
||||
name string
|
||||
sn string
|
||||
wwn string
|
||||
slot string
|
||||
}
|
||||
|
||||
func (ada *adaptorInfo) key() string {
|
||||
return ada.name + ada.sn
|
||||
}
|
||||
|
||||
func (ada *adaptorInfo) isRaidExposeRawMode() bool {
|
||||
return ada.mode == ControllerModeRaidExposeRaw
|
||||
}
|
||||
|
||||
func (ada *adaptorInfo) isRaidHideRawMode() bool {
|
||||
return ada.mode == ControllerModeRaidHideRaw
|
||||
}
|
||||
|
||||
func (ada *adaptorInfo) isMixedMode() bool {
|
||||
return ada.mode == ControllerModeMixed
|
||||
}
|
||||
|
||||
func getAdaptorInfo(lines []string) (*adaptorInfo, error) {
|
||||
ada := new(adaptorInfo)
|
||||
for _, l := range lines {
|
||||
key, val := stringutils.SplitKeyValue(l)
|
||||
if len(key) == 0 {
|
||||
continue
|
||||
}
|
||||
switch key {
|
||||
case "Controller Status":
|
||||
ada.status = val
|
||||
case "Controller Mode":
|
||||
ada.mode = val
|
||||
case "Controller Model":
|
||||
ada.name = val
|
||||
case "Controller Serial Number":
|
||||
ada.sn = val
|
||||
case "Controller World Wide Name":
|
||||
ada.wwn = val
|
||||
case "Physical Slot":
|
||||
ada.slot = val
|
||||
}
|
||||
}
|
||||
if len(ada.key()) == 0 {
|
||||
return nil, errors.Errorf("Not found SN and model name")
|
||||
}
|
||||
return ada, nil
|
||||
}
|
||||
|
||||
type AdaptecRaidPhyDev struct {
|
||||
*raid.RaidBasePhyDev
|
||||
// channelId and deviceId is parsed by Reported Channel,Device(T:L)
|
||||
// e.g.: Reported Channel,Device(T:L) : 0,6(6:0)
|
||||
channelId string
|
||||
deviceId string
|
||||
}
|
||||
|
||||
func newPhyDev(adapter int) *AdaptecRaidPhyDev {
|
||||
dev := &AdaptecRaidPhyDev{
|
||||
RaidBasePhyDev: raid.NewRaidBasePhyDev(api.DISK_DRIVER_ADAPTECRAID),
|
||||
}
|
||||
dev.Adapter = adapter
|
||||
return dev
|
||||
}
|
||||
|
||||
func (dev *AdaptecRaidPhyDev) isComplete() bool {
|
||||
if !dev.RaidBasePhyDev.IsComplete() {
|
||||
return false
|
||||
}
|
||||
if dev.channelId == "" || dev.deviceId == "" {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
func (dev *AdaptecRaidPhyDev) ToBaremetalStorage(index int) *baremetal.BaremetalStorage {
|
||||
s := dev.RaidBasePhyDev.ToBaremetalStorage(index)
|
||||
s.Addr = fmt.Sprintf("%s:%s", dev.channelId, dev.deviceId)
|
||||
|
||||
return s
|
||||
}
|
||||
|
||||
var (
|
||||
channelDeviceRegexp = regexp.MustCompile(`Reported Channel,Device\(T:L\).*(?P<channel>\d+),(?P<device>\d+)\(\d+:\d+\)`)
|
||||
)
|
||||
|
||||
func (dev *AdaptecRaidPhyDev) parseLine(line string) bool {
|
||||
chanDevMatch := regutils2.GetParams(channelDeviceRegexp, line)
|
||||
if len(chanDevMatch) != 0 {
|
||||
channelId := chanDevMatch["channel"]
|
||||
deviceId := chanDevMatch["device"]
|
||||
dev.channelId = channelId
|
||||
dev.deviceId = deviceId
|
||||
return true
|
||||
}
|
||||
key, val := stringutils.SplitKeyValue(line)
|
||||
if key == "" {
|
||||
return false
|
||||
}
|
||||
switch key {
|
||||
case "Total Size":
|
||||
dat := strings.Split(val, " ")
|
||||
szStr, unitStr := dat[0], dat[1]
|
||||
var sz int64
|
||||
szInt, err := strconv.Atoi(szStr)
|
||||
if err != nil {
|
||||
log.Errorf("Parse size string %s: %v", szStr, err)
|
||||
return false
|
||||
}
|
||||
switch unitStr {
|
||||
case "GB":
|
||||
sz = int64(szInt * 1000 * 1000 * 100)
|
||||
case "TB":
|
||||
sz = int64(szInt * 1000 * 1000 * 1000 * 1000)
|
||||
case "MB":
|
||||
sz = int64(szInt * 1000 * 1000)
|
||||
default:
|
||||
log.Errorf("Unsupported unit: %s", unitStr)
|
||||
return false
|
||||
}
|
||||
dev.Size = sz / 1024 / 1024
|
||||
case "Model":
|
||||
dev.Model = strings.Join(regexp.MustCompile(`\s+`).Split(val, -1), " ")
|
||||
case "State":
|
||||
dev.Status = val
|
||||
case "SSD":
|
||||
if val == "No" {
|
||||
dev.Rotate = tristate.True
|
||||
} else {
|
||||
dev.Rotate = tristate.False
|
||||
}
|
||||
default:
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
422
pkg/baremetal/utils/raid/adaptec/adaptec_test.go
Normal file
422
pkg/baremetal/utils/raid/adaptec/adaptec_test.go
Normal file
@@ -0,0 +1,422 @@
|
||||
// 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 adaptec
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func Test_getAdaptorIndex(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
args string
|
||||
want int
|
||||
}{
|
||||
{
|
||||
name: "Controllers found: 1",
|
||||
args: "Controllers found: 1",
|
||||
want: -1,
|
||||
},
|
||||
{
|
||||
name: " Controller 1: : Optimal, Slot 4, RAID (Expose RAW), Adaptec ASR8805, 6A2263667CA, 50000D1701B47780",
|
||||
args: " Controller 1: : Optimal, Slot 4, RAID (Expose RAW), Adaptec ASR8805, 6A2263667CA, 50000D1701B47780",
|
||||
want: 1,
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
if got := getAdaptorIndex(tt.args); got != tt.want {
|
||||
t.Errorf("getAdaptorIndex() = %v, want %v", got, tt.want)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func Test_getAdaptorInfo(t *testing.T) {
|
||||
input := `Controllers found: 1
|
||||
----------------------------------------------------------------------
|
||||
Controller information
|
||||
----------------------------------------------------------------------
|
||||
Controller Status : Optimal
|
||||
Controller Mode : RAID (Expose RAW)
|
||||
Channel description : SAS/SATA
|
||||
Controller Model : Adaptec ASR8805
|
||||
Controller Serial Number : 6A2263667CA
|
||||
Controller World Wide Name : 50000D1701B47780
|
||||
Controller Alarm : Disabled
|
||||
Physical Slot : 4
|
||||
Temperature : 42 C/ 107 F (Normal)
|
||||
Installed memory : 1024 MB
|
||||
Host bus type : PCIe
|
||||
Host bus speed : 8000 MHz
|
||||
Host bus link width : 8 bit(s)/link(s)
|
||||
Global task priority : High
|
||||
Performance Mode : Default/Dynamic
|
||||
PCI Device ID : 653
|
||||
Stayawake period : Disabled
|
||||
Spinup limit internal drives : 0
|
||||
Spinup limit external drives : 0
|
||||
Defunct disk drive count : 0
|
||||
NCQ status : Enabled
|
||||
Statistics data collection mode : Disabled
|
||||
Monitor Log Severity Level : Informational
|
||||
Global Max SAS Phy Link Rate : 12 Gbps
|
||||
Verify Write Setting : Not Applicable
|
||||
Save Custom Defaults Setting : Disabled
|
||||
Smart Poll : Enabled
|
||||
Error Tunable Profile : Normal
|
||||
--------------------------------------------------------
|
||||
Cache Properties
|
||||
--------------------------------------------------------
|
||||
Controller Cache Preservation : Disabled
|
||||
Global Physical Device Write Cache Policy: Drive Specific
|
||||
--------------------------------------------------------
|
||||
RAID Properties
|
||||
--------------------------------------------------------
|
||||
Logical devices/Failed/Degraded : 0/0/0
|
||||
Copyback : Disabled
|
||||
Automatic Failover : Enabled
|
||||
Background consistency check : Disabled
|
||||
Background consistency check period : 0
|
||||
--------------------------------------------------------
|
||||
Controller BIOS Setting Information
|
||||
--------------------------------------------------------
|
||||
Runtime BIOS : Enabled
|
||||
Array BBS Support : Disabled
|
||||
Physical Drives Displayed during POST : Disabled
|
||||
Backplane Mode : IBPI
|
||||
BIOS Halt on Missing Drive Count : 255
|
||||
--------------------------------------------------------
|
||||
Controller Version Information
|
||||
--------------------------------------------------------
|
||||
BIOS : 7.18-0 (33556)
|
||||
Firmware : 7.18-0 (33556)
|
||||
Driver : 1.2-1 (50983)
|
||||
Boot Flash : 7.18-0 (33556)
|
||||
CPLD (Load version/ Flash version) : 8/ 11
|
||||
SEEPROM (Load version/ Flash version) : 1/ 1
|
||||
FCT Custom Init String Version : 0x0
|
||||
|
||||
--------------------------------------------------------
|
||||
Controller Cache Backup Unit Information
|
||||
--------------------------------------------------------
|
||||
|
||||
Overall Backup Unit Status : Not Present
|
||||
--------------------------------------------------------
|
||||
Connector information
|
||||
|
||||
--------------------------------------------------------
|
||||
Connector #0
|
||||
Connector Name : CN0
|
||||
|
||||
--------------------------------------
|
||||
Lane Information
|
||||
--------------------------------------
|
||||
Lane #0
|
||||
Channel ID : 0
|
||||
Device ID : 0
|
||||
SAS Address : 50000D1701B47780
|
||||
PHY Identifier : 3
|
||||
-----------------------------------
|
||||
Lane SAS Phy Information
|
||||
-----------------------------------
|
||||
SAS Address : 50000D1701B47780
|
||||
|
||||
Lane #1
|
||||
Channel ID : 0
|
||||
Device ID : 1
|
||||
SAS Address : 50000D1701B47780
|
||||
PHY Identifier : 2
|
||||
-----------------------------------
|
||||
Lane SAS Phy Information
|
||||
-----------------------------------
|
||||
SAS Address : 50000D1701B47780
|
||||
|
||||
Lane #2
|
||||
Channel ID : 0
|
||||
Device ID : 2
|
||||
SAS Address : 50000D1701B47780
|
||||
PHY Identifier : 0
|
||||
-----------------------------------
|
||||
Lane SAS Phy Information
|
||||
-----------------------------------
|
||||
SAS Address : 50000D1701B47780
|
||||
|
||||
Lane #3
|
||||
Channel ID : 0
|
||||
Device ID : 3
|
||||
SAS Address : 50000D1701B47780
|
||||
PHY Identifier : 1
|
||||
-----------------------------------
|
||||
Lane SAS Phy Information
|
||||
-----------------------------------
|
||||
SAS Address : 50000D1701B47780
|
||||
|
||||
|
||||
Connector #1
|
||||
Connector Name : CN1
|
||||
|
||||
--------------------------------------
|
||||
Lane Information
|
||||
--------------------------------------
|
||||
Lane #0
|
||||
Channel ID : 0
|
||||
Device ID : 4
|
||||
SAS Address : 50000D1701B47780
|
||||
PHY Identifier : 5
|
||||
-----------------------------------
|
||||
Lane SAS Phy Information
|
||||
-----------------------------------
|
||||
SAS Address : 50000D1701B47780
|
||||
|
||||
Lane #1
|
||||
Channel ID : 0
|
||||
Device ID : 5
|
||||
SAS Address : 50000D1701B47780
|
||||
PHY Identifier : 6
|
||||
-----------------------------------
|
||||
Lane SAS Phy Information
|
||||
-----------------------------------
|
||||
SAS Address : 50000D1701B47780
|
||||
|
||||
Lane #2
|
||||
Channel ID : 0
|
||||
Device ID : 6
|
||||
SAS Address : 50000D1701B47780
|
||||
PHY Identifier : 4
|
||||
-----------------------------------
|
||||
Lane SAS Phy Information
|
||||
-----------------------------------
|
||||
SAS Address : 50000D1701B47780
|
||||
Attached PHY Identifier : 0
|
||||
Attached SAS Address : 5000C50077893141
|
||||
Negotiated Logical Link Rate : PHY enabled - 6 Gbps
|
||||
|
||||
Lane #3
|
||||
Channel ID : 0
|
||||
Device ID : 7
|
||||
SAS Address : 50000D1701B47780
|
||||
PHY Identifier : 7
|
||||
-----------------------------------
|
||||
Lane SAS Phy Information
|
||||
-----------------------------------
|
||||
SAS Address : 50000D1701B47780
|
||||
Attached PHY Identifier : 0
|
||||
Attached SAS Address : 50000395B839D9AE
|
||||
Negotiated Logical Link Rate : PHY enabled - 6 Gbps
|
||||
|
||||
|
||||
|
||||
|
||||
Command completed successfully.`
|
||||
lines := strings.Split(input, "\n")
|
||||
info, err := getAdaptorInfo(lines)
|
||||
if err != nil {
|
||||
t.Errorf("getAdaptorInfo: %v", err)
|
||||
}
|
||||
assert := assert.New(t)
|
||||
assert.Equal("Optimal", info.status)
|
||||
assert.Equal("RAID (Expose RAW)", info.mode)
|
||||
assert.Equal(true, info.isRaidExposeRawMode(), "should be raid expose raw mode")
|
||||
assert.Equal("Adaptec ASR8805", info.name)
|
||||
assert.Equal("6A2263667CA", info.sn)
|
||||
assert.Equal("50000D1701B47780", info.wwn)
|
||||
assert.Equal("4", info.slot)
|
||||
}
|
||||
|
||||
func Test_getPhyDevices(t *testing.T) {
|
||||
input := `Controllers found: 1
|
||||
----------------------------------------------------------------------
|
||||
Physical Device information
|
||||
----------------------------------------------------------------------
|
||||
Device #0
|
||||
Device is a Hard drive
|
||||
State : Online
|
||||
Block Size : 512 Bytes
|
||||
Supported : Yes
|
||||
Programmed Max Speed : SAS 6.0 Gb/s
|
||||
Transfer Speed : SAS 6.0 Gb/s
|
||||
Reported Channel,Device(T:L) : 0,6(6:0)
|
||||
Reported Location : Connector 1, Device 2
|
||||
Vendor : SEAGATE
|
||||
Model : ST300MM0006
|
||||
Firmware : LS0A
|
||||
Serial number : S0K30A4N
|
||||
World-wide name : 5000C50077893140
|
||||
Reserved Size : 415982 KB
|
||||
Used Size : 285696 MB
|
||||
Unused Size : 64 KB
|
||||
Total Size : 286102 MB
|
||||
Write Cache : Disabled (write-through)
|
||||
FRU : None
|
||||
S.M.A.R.T. : No
|
||||
S.M.A.R.T. warnings : 0
|
||||
Power State : Full rpm
|
||||
Supported Power States : Full rpm,Powered off
|
||||
SSD : No
|
||||
Temperature : 34 C/ 93 F
|
||||
----------------------------------------------------------------
|
||||
Device Phy Information
|
||||
----------------------------------------------------------------
|
||||
Phy #0
|
||||
PHY Identifier : 0
|
||||
SAS Address : 5000C50077893141
|
||||
Attached PHY Identifier : 4
|
||||
Attached SAS Address : 50000D1701B47780
|
||||
Phy #1
|
||||
PHY Identifier : 1
|
||||
SAS Address : 5000C50077893142
|
||||
----------------------------------------------------------------
|
||||
Runtime Error Counters
|
||||
----------------------------------------------------------------
|
||||
Hardware Error Count : 0
|
||||
Medium Error Count : 0
|
||||
Parity Error Count : 0
|
||||
Link Failure Count : 0
|
||||
Aborted Command Count : 0
|
||||
SMART Warning Count : 0
|
||||
|
||||
Device #1
|
||||
Device is a Hard drive
|
||||
State : Online
|
||||
Block Size : 512 Bytes
|
||||
Supported : Yes
|
||||
Programmed Max Speed : SAS 6.0 Gb/s
|
||||
Transfer Speed : SAS 6.0 Gb/s
|
||||
Reported Channel,Device(T:L) : 0,7(7:0)
|
||||
Reported Location : Connector 1, Device 3
|
||||
Vendor : TOSHIBA
|
||||
Model : AL13SEB300
|
||||
Firmware : DE0D
|
||||
Serial number : 84T0A31SFRD6
|
||||
World-wide name : 50000395B839D9AC
|
||||
Reserved Size : 415982 KB
|
||||
Used Size : 285696 MB
|
||||
Unused Size : 64 KB
|
||||
Total Size : 286102 MB
|
||||
Write Cache : Disabled (write-through)
|
||||
FRU : None
|
||||
S.M.A.R.T. : No
|
||||
S.M.A.R.T. warnings : 0
|
||||
Power State : Full rpm
|
||||
Supported Power States : Full rpm,Powered off
|
||||
SSD : No
|
||||
Temperature : 33 C/ 91 F
|
||||
----------------------------------------------------------------
|
||||
Device Phy Information
|
||||
----------------------------------------------------------------
|
||||
Phy #0
|
||||
PHY Identifier : 0
|
||||
SAS Address : 50000395B839D9AE
|
||||
Attached PHY Identifier : 7
|
||||
Attached SAS Address : 50000D1701B47780
|
||||
Phy #1
|
||||
PHY Identifier : 1
|
||||
SAS Address : 50000395B839D9AF
|
||||
----------------------------------------------------------------
|
||||
Runtime Error Counters
|
||||
----------------------------------------------------------------
|
||||
Hardware Error Count : 0
|
||||
Medium Error Count : 0
|
||||
Parity Error Count : 0
|
||||
Link Failure Count : 0
|
||||
Aborted Command Count : 0
|
||||
SMART Warning Count : 0
|
||||
|
||||
|
||||
|
||||
Command completed successfully.`
|
||||
lines := strings.Split(input, "\n")
|
||||
devs := getPhyDevices(1, lines)
|
||||
assert := assert.New(t)
|
||||
assert.Equal(2, len(devs), "physical devices should be 2")
|
||||
dev1 := devs[0]
|
||||
assert.Equal("0", dev1.channelId)
|
||||
assert.Equal("6", dev1.deviceId)
|
||||
assert.Equal("Online", dev1.Status)
|
||||
assert.Equal("ST300MM0006", dev1.Model)
|
||||
assert.Equal(true, dev1.Rotate.Bool())
|
||||
|
||||
dev2 := devs[1]
|
||||
assert.Equal("0", dev2.channelId)
|
||||
assert.Equal("7", dev2.deviceId)
|
||||
assert.Equal("Online", dev2.Status)
|
||||
assert.Equal("AL13SEB300", dev2.Model)
|
||||
assert.Equal(true, dev2.Rotate.Bool())
|
||||
}
|
||||
|
||||
func Test_getLogicalVolums(t *testing.T) {
|
||||
input := `Controllers found: 1
|
||||
----------------------------------------------------------------------
|
||||
Logical device information
|
||||
----------------------------------------------------------------------
|
||||
Logical Device number 0
|
||||
Logical Device name : LogicalDrv 0
|
||||
Block Size of member drives : 512 Bytes
|
||||
RAID level : 1
|
||||
Unique Identifier : 7D30DCD4
|
||||
Status of Logical Device : Optimal
|
||||
Additional details : Quick initialized
|
||||
Size : 285686 MB
|
||||
Parity space : 285696 MB
|
||||
Interface Type : Serial Attached SCSI
|
||||
Device Type : HDD
|
||||
Read-cache setting : Enabled
|
||||
Read-cache status : On
|
||||
Write-cache setting : Enabled
|
||||
Write-cache status : On
|
||||
Partitioned : No
|
||||
Protected by Hot-Spare : No
|
||||
Bootable : Yes
|
||||
Failed stripes : No
|
||||
Power settings : Disabled
|
||||
--------------------------------------------------------
|
||||
Logical Device segment information
|
||||
--------------------------------------------------------
|
||||
Segment 0 : Present (286102MB, SAS, HDD, Connector:1, Device:2) S0K30A4N
|
||||
Segment 1 : Present (286102MB, SAS, HDD, Connector:1, Device:3) 84T0A31SFRD6
|
||||
|
||||
|
||||
|
||||
Command completed successfully.`
|
||||
lines := strings.Split(input, "\n")
|
||||
lvs, err := getLogicalVolumes(1, lines)
|
||||
if err != nil {
|
||||
t.Errorf("getLogicalVolumes: %v", err)
|
||||
}
|
||||
assert := assert.New(t)
|
||||
assert.Equal(1, len(lvs), "logical volume len should be 1")
|
||||
lv := lvs[0]
|
||||
assert.Equal(1, lv.Adapter)
|
||||
assert.Equal(0, lv.Index)
|
||||
|
||||
inputNoLV := `Controllers found: 1
|
||||
----------------------------------------------------------------------
|
||||
Logical device information
|
||||
----------------------------------------------------------------------
|
||||
No logical devices configured
|
||||
|
||||
|
||||
Command completed successfully.`
|
||||
lines = strings.Split(inputNoLV, "\n")
|
||||
lvs, err = getLogicalVolumes(1, lines)
|
||||
if err != nil {
|
||||
t.Errorf("getLogicalVolumes: %v", err)
|
||||
}
|
||||
assert.Equal(0, len(lvs), "logical volume len should be 0")
|
||||
}
|
||||
@@ -12,4 +12,4 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package client // import "yunion.io/x/onecloud/pkg/multicloud/huaweistack/client"
|
||||
package adaptec // import "yunion.io/x/onecloud/pkg/baremetal/utils/raid/adaptec"
|
||||
@@ -24,6 +24,7 @@ import (
|
||||
|
||||
api "yunion.io/x/onecloud/pkg/apis/compute"
|
||||
"yunion.io/x/onecloud/pkg/baremetal/utils/raid"
|
||||
_ "yunion.io/x/onecloud/pkg/baremetal/utils/raid/adaptec"
|
||||
_ "yunion.io/x/onecloud/pkg/baremetal/utils/raid/hpssactl"
|
||||
_ "yunion.io/x/onecloud/pkg/baremetal/utils/raid/megactl"
|
||||
_ "yunion.io/x/onecloud/pkg/baremetal/utils/raid/mvcli"
|
||||
@@ -64,6 +65,8 @@ func GetDriverByKernelModule(module string, term raid.IExecTerm) (raid.IRaidDriv
|
||||
name = baremetal.DISK_DRIVER_HPSARAID
|
||||
case raid.MODULE_MPT2SAS, raid.MODULE_MPT3SAS:
|
||||
name = baremetal.DISK_DRIVER_MPT2SAS
|
||||
case raid.MODULE_AACRAID, raid.MODULE_SMARTPQI:
|
||||
name = baremetal.DISK_DRIVER_ADAPTECRAID
|
||||
}
|
||||
if name == "" {
|
||||
return nil, errors.Errorf("Not support module %q", module)
|
||||
@@ -93,13 +96,13 @@ func BuildRaid(driver raid.IRaidDriver, confs []*api.BaremetalDiskConfig, adapte
|
||||
if adapter == nil {
|
||||
return fmt.Errorf("Not found adapter by index %d", adapterIdx)
|
||||
}
|
||||
if err := buildRaid(adapter, confs); err != nil {
|
||||
if err := buildRaid(driver, adapter, confs); err != nil {
|
||||
return fmt.Errorf("Driver %s, adapter %d build raid: %v", driver.GetName(), adapterIdx, err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func buildRaid(adapter raid.IRaidAdapter, confs []*api.BaremetalDiskConfig) error {
|
||||
func buildRaid(driver raid.IRaidDriver, adapter raid.IRaidAdapter, confs []*api.BaremetalDiskConfig) error {
|
||||
if err := adapter.PreBuildRaid(confs); err != nil {
|
||||
return fmt.Errorf("PreBuildRaid: %v", err)
|
||||
}
|
||||
@@ -139,6 +142,7 @@ func buildRaid(adapter raid.IRaidAdapter, confs []*api.BaremetalDiskConfig) erro
|
||||
if err != nil {
|
||||
return fmt.Errorf("Build raid %s: %v", conf.Conf, err)
|
||||
}
|
||||
log.Infof("Build %s:%d raid %s", driver.GetName(), adapter.GetIndex(), conf.Conf)
|
||||
}
|
||||
if len(nonDisks) > 0 {
|
||||
if err := adapter.BuildNoneRaid(nonDisks); err != nil {
|
||||
|
||||
@@ -36,6 +36,8 @@ const (
|
||||
MODULE_HPSA = "hpsa"
|
||||
MODULE_MPT2SAS = "mpt2sas"
|
||||
MODULE_MPT3SAS = "mpt3sas"
|
||||
MODULE_AACRAID = "aacraid"
|
||||
MODULE_SMARTPQI = "smartpqi"
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
@@ -38,7 +38,7 @@ type Mpt2SASRaidPhyDev struct {
|
||||
}
|
||||
|
||||
func newMpt2SASRaidPhyDev(adapter int) *Mpt2SASRaidPhyDev {
|
||||
b := raid.NewRaidBasePhyDev(baremetal.DISK_DRIVER_MARVELRAID)
|
||||
b := raid.NewRaidBasePhyDev(baremetal.DISK_DRIVER_MPT2SAS)
|
||||
b.Adapter = adapter
|
||||
return &Mpt2SASRaidPhyDev{
|
||||
RaidBasePhyDev: b,
|
||||
@@ -116,6 +116,7 @@ func (dev *Mpt2SASRaidPhyDev) isComplete() bool {
|
||||
|
||||
func (dev *Mpt2SASRaidPhyDev) ToBaremetalStorage(idx int) *baremetal.BaremetalStorage {
|
||||
s := dev.RaidBasePhyDev.ToBaremetalStorage(idx)
|
||||
s.Index = int64(idx)
|
||||
s.Slot = dev.slot
|
||||
s.Enclosure = dev.enclosure
|
||||
s.Block = int64(dev.block)
|
||||
@@ -296,7 +297,9 @@ func (adapter *Mpt2SASRaidAdaptor) BuildRaid10(devs []*baremetal.BaremetalStorag
|
||||
}
|
||||
|
||||
func (adapter *Mpt2SASRaidAdaptor) BuildNoneRaid(devs []*baremetal.BaremetalStorage) error {
|
||||
return fmt.Errorf("Not impl")
|
||||
// TODO: not impl
|
||||
// return fmt.Errorf("Not impl")
|
||||
return nil
|
||||
}
|
||||
|
||||
func (adapter *Mpt2SASRaidAdaptor) RemoveLogicVolumes() error {
|
||||
@@ -338,11 +341,25 @@ func (r *Mpt2SASRaid) ParsePhyDevs() error {
|
||||
return r.parseAdapters(ret)
|
||||
}
|
||||
|
||||
func getLineAdapterIndex(line string) int {
|
||||
dat := regexp.MustCompile(`\s+`).Split(strings.TrimSpace(line), -1)
|
||||
if len(dat) == 0 {
|
||||
return -1
|
||||
}
|
||||
if regexp.MustCompile(`\d+`).MatchString(dat[0]) {
|
||||
if !regexp.MustCompile(`^\d+`).MatchString(dat[0]) {
|
||||
return -1
|
||||
}
|
||||
idx, _ := strconv.Atoi(dat[0])
|
||||
return idx
|
||||
}
|
||||
return -1
|
||||
}
|
||||
|
||||
func (r *Mpt2SASRaid) parseAdapters(lines []string) error {
|
||||
for _, line := range lines {
|
||||
dat := regexp.MustCompile(`\s+`).Split(strings.TrimSpace(line), -1)
|
||||
if regexp.MustCompile(`\d+`).MatchString(dat[0]) {
|
||||
idx, _ := strconv.Atoi(dat[0])
|
||||
idx := getLineAdapterIndex(line)
|
||||
if idx >= 0 {
|
||||
adapter := newMpt2SASRaidAdaptor(idx, r)
|
||||
r.adapters = append(r.adapters, adapter)
|
||||
}
|
||||
|
||||
40
pkg/baremetal/utils/raid/sas2iru/sas2iru_test.go
Normal file
40
pkg/baremetal/utils/raid/sas2iru/sas2iru_test.go
Normal file
@@ -0,0 +1,40 @@
|
||||
// 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 sas2iru
|
||||
|
||||
import "testing"
|
||||
|
||||
func Test_getLineAdapterIndex(t *testing.T) {
|
||||
tests := []struct {
|
||||
line string
|
||||
want int
|
||||
}{
|
||||
{
|
||||
line: "0 SAS3008 100h 97h 00h:5eh:00h:00h 1000h 0097h",
|
||||
want: 0,
|
||||
},
|
||||
{
|
||||
line: "SAS3IRCU: Utility Completed Successfully.",
|
||||
want: -1,
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.line, func(t *testing.T) {
|
||||
if got := getLineAdapterIndex(tt.line); got != tt.want {
|
||||
t.Errorf("getLineAdapterIndex() = %v, want %v", got, tt.want)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -53,7 +53,7 @@ func ServeForeverExtended(app *appsrv.Application, options *common_options.BaseO
|
||||
if options.EnableSsl {
|
||||
proto = "https"
|
||||
}
|
||||
log.Infof("Start listen on %s://%s", proto, addr)
|
||||
log.Infof("Start listen on %s://%s, isMaster: %v", proto, addr, isMaster)
|
||||
var certfile string
|
||||
var sslfile string
|
||||
if options.EnableSsl {
|
||||
|
||||
@@ -19,9 +19,11 @@ import (
|
||||
"database/sql"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/log"
|
||||
"yunion.io/x/pkg/errors"
|
||||
"yunion.io/x/sqlchemy"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/appsrv"
|
||||
@@ -86,25 +88,45 @@ func InitDB(options *common_options.DBOptions) {
|
||||
}
|
||||
// lm := lockman.NewNoopLockManager()
|
||||
|
||||
if len(options.EtcdEndpoints) != 0 {
|
||||
log.Infof("using etcd as resource informer backend")
|
||||
tlsCfg, err := options.GetEtcdTLSConfig()
|
||||
if err != nil {
|
||||
log.Fatalf("get etcd informer backend tls config err: %v", err)
|
||||
startInitInformer(options)
|
||||
}
|
||||
|
||||
// startInitInformer starts goroutine init informer backend
|
||||
func startInitInformer(options *common_options.DBOptions) {
|
||||
go func() {
|
||||
if len(options.EtcdEndpoints) == 0 {
|
||||
return
|
||||
}
|
||||
informerBackend, err := informer.NewEtcdBackend(&etcd.SEtcdOptions{
|
||||
EtcdEndpoint: options.EtcdEndpoints,
|
||||
EtcdTimeoutSeconds: 5,
|
||||
EtcdRequestTimeoutSeconds: 2,
|
||||
EtcdLeaseExpireSeconds: 5,
|
||||
EtcdEnabldSsl: options.EtcdUseTLS,
|
||||
TLSConfig: tlsCfg,
|
||||
}, nil)
|
||||
if err != nil {
|
||||
log.Fatalf("new etcd informer backend error: %v", err)
|
||||
for {
|
||||
log.Infof("using etcd as resource informer backend")
|
||||
if err := initInformer(options); err != nil {
|
||||
log.Errorf("Init informer error: %v", err)
|
||||
time.Sleep(10 * time.Second)
|
||||
} else {
|
||||
break
|
||||
}
|
||||
}
|
||||
informer.Init(informerBackend)
|
||||
}()
|
||||
}
|
||||
|
||||
func initInformer(options *common_options.DBOptions) error {
|
||||
tlsCfg, err := options.GetEtcdTLSConfig()
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "get etcd informer backend tls config")
|
||||
}
|
||||
informerBackend, err := informer.NewEtcdBackend(&etcd.SEtcdOptions{
|
||||
EtcdEndpoint: options.EtcdEndpoints,
|
||||
EtcdTimeoutSeconds: 5,
|
||||
EtcdRequestTimeoutSeconds: 2,
|
||||
EtcdLeaseExpireSeconds: 5,
|
||||
EtcdEnabldSsl: options.EtcdUseTLS,
|
||||
TLSConfig: tlsCfg,
|
||||
}, nil)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "new etcd informer backend")
|
||||
}
|
||||
informer.Init(informerBackend)
|
||||
return nil
|
||||
}
|
||||
|
||||
func CloseDB() {
|
||||
|
||||
@@ -24,6 +24,7 @@ import (
|
||||
"yunion.io/x/pkg/gotypes"
|
||||
"yunion.io/x/sqlchemy"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/apis"
|
||||
"yunion.io/x/onecloud/pkg/httperrors"
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/util/stringutils2"
|
||||
@@ -284,12 +285,40 @@ func FetchCustomizeColumns(
|
||||
if ret[0].Len() != len(objs) {
|
||||
return nil, httperrors.NewInternalServerError("Invalid FetchCustomizeColumns return value, inconsistent obj count: input %d != output %d", len(objs), ret[0].Len())
|
||||
}
|
||||
|
||||
showReason := false
|
||||
if query.Contains("show_fail_reason") {
|
||||
showReason = true
|
||||
}
|
||||
|
||||
retVal := make([]*jsonutils.JSONDict, ret[0].Len())
|
||||
for i := 0; i < ret[0].Len(); i += 1 {
|
||||
jsonDict := ValueToJSONDict(ret[0].Index(i))
|
||||
// NOTE: don't use obj update jsonDict as retval
|
||||
jsonDict.Update(jsonutils.Marshal(objs[i]).(*jsonutils.JSONDict))
|
||||
out := apis.ModelBaseDetails{
|
||||
CanDelete: true,
|
||||
CanUpdate: true,
|
||||
}
|
||||
|
||||
err = ValidateDeleteCondition(objs[i].(IModel), ctx, jsonDict)
|
||||
if err != nil {
|
||||
out.CanDelete = false
|
||||
if showReason {
|
||||
out.DeleteFailReason = httperrors.NewErrorFromGeneralError(ctx, err)
|
||||
}
|
||||
}
|
||||
err = ValidateUpdateCondition(objs[i].(IModel), ctx)
|
||||
if err != nil {
|
||||
out.CanUpdate = false
|
||||
if showReason {
|
||||
out.UpdateFailReason = httperrors.NewErrorFromGeneralError(ctx, err)
|
||||
}
|
||||
}
|
||||
jsonDict.Update(jsonutils.Marshal(out))
|
||||
|
||||
retVal[i] = jsonDict
|
||||
|
||||
}
|
||||
return retVal, nil
|
||||
}
|
||||
@@ -319,3 +348,25 @@ func CustomizeDelete(model IModel, ctx context.Context, userCred mcclient.TokenC
|
||||
}
|
||||
return ValueToError(ret[0])
|
||||
}
|
||||
|
||||
func ValidateDeleteCondition(model IModel, ctx context.Context, data jsonutils.JSONObject) error {
|
||||
ret, err := call(model, "ValidateDeleteCondition", ctx, data)
|
||||
if err != nil {
|
||||
return httperrors.NewGeneralError(err)
|
||||
}
|
||||
if len(ret) != 1 {
|
||||
return httperrors.NewInternalServerError("Invald ValidateDeleteCondition return value")
|
||||
}
|
||||
return ValueToError(ret[0])
|
||||
}
|
||||
|
||||
func ValidateUpdateCondition(model IModel, ctx context.Context) error {
|
||||
ret, err := call(model, "ValidateUpdateCondition", ctx)
|
||||
if err != nil {
|
||||
return httperrors.NewGeneralError(err)
|
||||
}
|
||||
if len(ret) != 1 {
|
||||
return httperrors.NewInternalServerError("Invald ValidateUpdateCondition return value")
|
||||
}
|
||||
return ValueToError(ret[0])
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user