mirror of
https://hubproxy.babadafafafafa.cn/https://github.com/yunionio/cloudpods.git
synced 2026-09-20 16:13:56 +08:00
Compare commits
517 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3bd3dda026 | ||
|
|
a396868d6a | ||
|
|
794b2896f4 | ||
|
|
2443cc9a3c | ||
|
|
56ebaea85e | ||
|
|
37cefd0d64 | ||
|
|
8a2c03d683 | ||
|
|
ed136fb2f0 | ||
|
|
3b3cbb94d6 | ||
|
|
79614b5939 | ||
|
|
6fce123623 | ||
|
|
d9ddbb5bcf | ||
|
|
e871084a85 | ||
|
|
170b08329d | ||
|
|
a433306ba4 | ||
|
|
0737e5ed39 | ||
|
|
b9c8dc01fb | ||
|
|
748d547b88 | ||
|
|
59d979043e | ||
|
|
9f9e5eed10 | ||
|
|
e9638cc461 | ||
|
|
8f15091db1 | ||
|
|
3ee4ae370a | ||
|
|
99eb111954 | ||
|
|
d968caaa47 | ||
|
|
a5530fee10 | ||
|
|
87b4a151df | ||
|
|
1d463ed8c8 | ||
|
|
63638b15d1 | ||
|
|
5c4bf3e03c | ||
|
|
b239ca7b15 | ||
|
|
87ca98b362 | ||
|
|
04eaf773fe | ||
|
|
4aa2299b47 | ||
|
|
9c8337ae8f | ||
|
|
a8e9c3f510 | ||
|
|
290a32b9de | ||
|
|
94fe13ddc5 | ||
|
|
ad071de5a0 | ||
|
|
b570dc9d82 | ||
|
|
aa9de0f84d | ||
|
|
9285208d1c | ||
|
|
4112e7052d | ||
|
|
f33aa39eed | ||
|
|
cd2499c3b0 | ||
|
|
e2fa8d48e6 | ||
|
|
a1750c6dd0 | ||
|
|
5a93924ff2 | ||
|
|
0c32be0707 | ||
|
|
62fe7d977d | ||
|
|
fb4206d904 | ||
|
|
3afbb86fad | ||
|
|
aeaa6939c7 | ||
|
|
950e7696bc | ||
|
|
8bf5eb3321 | ||
|
|
91e558e74a | ||
|
|
d196c943eb | ||
|
|
61e6a98328 | ||
|
|
61e81748d7 | ||
|
|
51563912b0 | ||
|
|
215f9c4d1d | ||
|
|
a32021969a | ||
|
|
18e98f598e | ||
|
|
520af18f9e | ||
|
|
28fab54660 | ||
|
|
4f9bbe0674 | ||
|
|
d3fb8a60d7 | ||
|
|
3276164c8b | ||
|
|
d759c27bf6 | ||
|
|
ce827235b3 | ||
|
|
9534c153c3 | ||
|
|
e4eb798fda | ||
|
|
34cef736d3 | ||
|
|
a175ca421f | ||
|
|
03b13297e8 | ||
|
|
1b3c442407 | ||
|
|
949c202692 | ||
|
|
47be971d66 | ||
|
|
77a36234a4 | ||
|
|
2f89114413 | ||
|
|
2322118457 | ||
|
|
fa5fbccf2b | ||
|
|
c5cf45772c | ||
|
|
6daa0a1d4f | ||
|
|
a304d30020 | ||
|
|
8aed26a110 | ||
|
|
6c78e3d349 | ||
|
|
83a5574e5d | ||
|
|
f05ed6ccb6 | ||
|
|
73ca4a9ee8 | ||
|
|
144bc806b8 | ||
|
|
144ebc6e8b | ||
|
|
33fd165939 | ||
|
|
08971d413a | ||
|
|
c321c6c4b7 | ||
|
|
45d627da21 | ||
|
|
24a6b94fc8 | ||
|
|
7fd2a886b4 | ||
|
|
4a9030636b | ||
|
|
15ba242294 | ||
|
|
12b8efa2a1 | ||
|
|
715c1ba936 | ||
|
|
a50e8a797e | ||
|
|
a314b7a37b | ||
|
|
f3838108cd | ||
|
|
756e1f5570 | ||
|
|
9425460800 | ||
|
|
bebdc5532c | ||
|
|
069805fa89 | ||
|
|
eae078398b | ||
|
|
068a89b234 | ||
|
|
b27a0af647 | ||
|
|
7bc16cacad | ||
|
|
700e513595 | ||
|
|
9113050534 | ||
|
|
89c80a43f8 | ||
|
|
e2d86cc624 | ||
|
|
99e30e2dc1 | ||
|
|
110555570c | ||
|
|
7a80b316ac | ||
|
|
1445a91007 | ||
|
|
d4a81bedf9 | ||
|
|
05313e1f9a | ||
|
|
372646dd0d | ||
|
|
617adad306 | ||
|
|
8ad98ea029 | ||
|
|
869d434ce1 | ||
|
|
1b5c347408 | ||
|
|
bccdbae49d | ||
|
|
63fe793a2f | ||
|
|
e9e6ff2425 | ||
|
|
dcdcbcae11 | ||
|
|
b1d2f2e2fc | ||
|
|
0473fe6524 | ||
|
|
08bef5e63f | ||
|
|
743b4d2561 | ||
|
|
66b937acc5 | ||
|
|
0781273c26 | ||
|
|
8a619edb7a | ||
|
|
32429e54b7 | ||
|
|
28b00fc130 | ||
|
|
b42df76abd | ||
|
|
15ee6e6920 | ||
|
|
9bb48de844 | ||
|
|
e8f7ab6676 | ||
|
|
14542810a8 | ||
|
|
3175bdd0cc | ||
|
|
25003603aa | ||
|
|
74ea904e4c | ||
|
|
ae2926168c | ||
|
|
12335b8f62 | ||
|
|
b118cbe143 | ||
|
|
8b0437f988 | ||
|
|
0fdb86ecb1 | ||
|
|
254bac3ffe | ||
|
|
472721bc18 | ||
|
|
f62c00d342 | ||
|
|
b62c930289 | ||
|
|
ed583438b1 | ||
|
|
0dda6257fc | ||
|
|
9944fc1e27 | ||
|
|
86524a8574 | ||
|
|
822c972ce8 | ||
|
|
23ec7d77c7 | ||
|
|
83a30f1c7c | ||
|
|
ff287c632e | ||
|
|
e98516a94a | ||
|
|
8176d74976 | ||
|
|
59419868a0 | ||
|
|
c733a582dd | ||
|
|
6fcba7d320 | ||
|
|
0cb9db8835 | ||
|
|
7230a47ed3 | ||
|
|
c6e8eb6d10 | ||
|
|
7b9b78fed3 | ||
|
|
7a0420dc1a | ||
|
|
952879c40e | ||
|
|
2fb5c0b24e | ||
|
|
899184eb4b | ||
|
|
93330a3c2a | ||
|
|
001519224c | ||
|
|
949979fca1 | ||
|
|
5d6abcc7df | ||
|
|
498961324c | ||
|
|
916a05c9bf | ||
|
|
44b78f47d5 | ||
|
|
203284a6f9 | ||
|
|
14be39a37f | ||
|
|
05afabb69c | ||
|
|
95290a1c0d | ||
|
|
08f240762b | ||
|
|
953f235110 | ||
|
|
861f827101 | ||
|
|
7c20400bc6 | ||
|
|
070876e760 | ||
|
|
35542cb381 | ||
|
|
d0b166364a | ||
|
|
b20725656e | ||
|
|
fa6991ce94 | ||
|
|
fb39dbc772 | ||
|
|
85c21e6dbb | ||
|
|
77f0ccf889 | ||
|
|
da3383d81a | ||
|
|
5fec0b66a5 | ||
|
|
20b6277c6a | ||
|
|
3eedb00e11 | ||
|
|
d8251ce270 | ||
|
|
7d4a57cf33 | ||
|
|
562fbb2afe | ||
|
|
51f0d8448d | ||
|
|
9d479e6293 | ||
|
|
3955c45d63 | ||
|
|
49737431a2 | ||
|
|
52c76cb49c | ||
|
|
c1198af38e | ||
|
|
be56970506 | ||
|
|
c2d83b0007 | ||
|
|
080c77685c | ||
|
|
18c63a1fdc | ||
|
|
7478891d74 | ||
|
|
e336583552 | ||
|
|
c0f88cc35d | ||
|
|
f636bd4c15 | ||
|
|
eb7f0d465d | ||
|
|
fa2e55ce14 | ||
|
|
6d2c73e1bc | ||
|
|
ce542891d9 | ||
|
|
8f02b26ae3 | ||
|
|
4a3d0bef39 | ||
|
|
93c94454d5 | ||
|
|
fa7dd281e8 | ||
|
|
5f78b96dad | ||
|
|
29d428a6db | ||
|
|
d8f1cd5bf6 | ||
|
|
ead643b844 | ||
|
|
f399796852 | ||
|
|
be77084d0e | ||
|
|
61c52e6cb5 | ||
|
|
3a42c05133 | ||
|
|
5d2d5f2cb1 | ||
|
|
849756946b | ||
|
|
18ae833a5e | ||
|
|
bfb913105d | ||
|
|
d9e5df08db | ||
|
|
daeca7f7bf | ||
|
|
bd117d6d1e | ||
|
|
383b73551a | ||
|
|
71351daa59 | ||
|
|
a5b44df050 | ||
|
|
882c5ddc86 | ||
|
|
37e6b25f4a | ||
|
|
5a2d4737f3 | ||
|
|
f7b11621a7 | ||
|
|
13bef96917 | ||
|
|
cfafea78e7 | ||
|
|
e94e63d6d4 | ||
|
|
b8b8174632 | ||
|
|
59ead8ac15 | ||
|
|
0750fad9b4 | ||
|
|
09274e2574 | ||
|
|
102361dc2a | ||
|
|
a4197e96b1 | ||
|
|
ac2015d6df | ||
|
|
7dd0fcf719 | ||
|
|
aed78bbb72 | ||
|
|
ed29d7b702 | ||
|
|
2fb625c0f0 | ||
|
|
62726047e8 | ||
|
|
1c8285bbd2 | ||
|
|
0885c45f34 | ||
|
|
5e623616d0 | ||
|
|
98dbf2e10b | ||
|
|
aee280b5d7 | ||
|
|
7fb48f891d | ||
|
|
a19cdad2f4 | ||
|
|
175283c94d | ||
|
|
3245626bb7 | ||
|
|
3a18169f39 | ||
|
|
ba79c4c67b | ||
|
|
08cfb1ee71 | ||
|
|
cc38f00731 | ||
|
|
ca563a3221 | ||
|
|
affd6fb567 | ||
|
|
4a3ae9da7f | ||
|
|
d8d04512ba | ||
|
|
eac60b484b | ||
|
|
3e170f8a9b | ||
|
|
14f66686d9 | ||
|
|
a3b0b2193c | ||
|
|
af24cbfaa3 | ||
|
|
8ef6b60a42 | ||
|
|
df00cdbd04 | ||
|
|
df37a12fc2 | ||
|
|
afc653bb48 | ||
|
|
cae9564f29 | ||
|
|
2b45e26243 | ||
|
|
89f6f9985c | ||
|
|
daeb7bb144 | ||
|
|
4fc343f577 | ||
|
|
35e6f3992a | ||
|
|
b1f320bdd5 | ||
|
|
e843eecbd1 | ||
|
|
597a9d38ca | ||
|
|
03b1a0c0a1 | ||
|
|
168248ef97 | ||
|
|
a965ecf107 | ||
|
|
e46f6dc0e1 | ||
|
|
0659981e24 | ||
|
|
58db9ddf0f | ||
|
|
7e2a369fae | ||
|
|
d07d8f9652 | ||
|
|
367e92858f | ||
|
|
251639353d | ||
|
|
e8ef3ab74e | ||
|
|
6e8a97b995 | ||
|
|
721b80e2fe | ||
|
|
3d705eee3f | ||
|
|
799b7eacb7 | ||
|
|
7f9bb72ce3 | ||
|
|
860030929d | ||
|
|
1914e2b054 | ||
|
|
fdfe3bb374 | ||
|
|
b1c84895e5 | ||
|
|
e8ce6da148 | ||
|
|
b29d752647 | ||
|
|
ddda51d272 | ||
|
|
1574970148 | ||
|
|
f96e632384 | ||
|
|
41bf5a1c17 | ||
|
|
1f645f550a | ||
|
|
72bf32b8db | ||
|
|
93e7780d1d | ||
|
|
3ad7ac7e18 | ||
|
|
888c527fa9 | ||
|
|
f577998f60 | ||
|
|
57fe0a05af | ||
|
|
dcfe21a5ee | ||
|
|
0c3fe7e440 | ||
|
|
1452c4d817 | ||
|
|
d9c7f08c74 | ||
|
|
f33b779c24 | ||
|
|
05405def86 | ||
|
|
644d1a0056 | ||
|
|
5b50b77c13 | ||
|
|
9a836d37b5 | ||
|
|
cc8ca3656d | ||
|
|
6a7e1ccaf4 | ||
|
|
2423107c23 | ||
|
|
f80a0c2a2e | ||
|
|
5c38e6935e | ||
|
|
908c7c2d81 | ||
|
|
fd8ee54deb | ||
|
|
1b98d99905 | ||
|
|
f423eb9011 | ||
|
|
0ee58ec243 | ||
|
|
a3318a87c0 | ||
|
|
40bc2e3ae1 | ||
|
|
ef7674af30 | ||
|
|
fa8e8e555e | ||
|
|
2e167d8599 | ||
|
|
19f4328ed1 | ||
|
|
62d009f2f8 | ||
|
|
2718d7bf4e | ||
|
|
007566c4b5 | ||
|
|
5bcc2a4298 | ||
|
|
3913a71f5c | ||
|
|
f4fb2b55a2 | ||
|
|
071f919d1e | ||
|
|
59309efd8c | ||
|
|
7a64637e14 | ||
|
|
f4baf1761a | ||
|
|
f8dc741763 | ||
|
|
1739d4f805 | ||
|
|
c681805629 | ||
|
|
2f4e7d585e | ||
|
|
d3c3a201b8 | ||
|
|
9933db70a3 | ||
|
|
624acc21f9 | ||
|
|
f361618f06 | ||
|
|
790f9fc1a3 | ||
|
|
e86909c43a | ||
|
|
9085ee9775 | ||
|
|
34c7a31106 | ||
|
|
52bbe4d74e | ||
|
|
2190de3e77 | ||
|
|
d58e8f3b67 | ||
|
|
a431d7ca20 | ||
|
|
8fed2fc64b | ||
|
|
68900b3fab | ||
|
|
4ddb4e14a5 | ||
|
|
1c9a926247 | ||
|
|
0ac45d9ff7 | ||
|
|
45a4848808 | ||
|
|
0fb6de4d80 | ||
|
|
1bcd3dcab6 | ||
|
|
291230694d | ||
|
|
140ac46e67 | ||
|
|
0e5f5221f0 | ||
|
|
5813d64a7d | ||
|
|
6444825331 | ||
|
|
adfad567f6 | ||
|
|
cf7c63be3f | ||
|
|
1d78192a36 | ||
|
|
462b832e1a | ||
|
|
06fad05278 | ||
|
|
1695947221 | ||
|
|
4c40e3bf40 | ||
|
|
4f270a3ff0 | ||
|
|
6a7382f5be | ||
|
|
a7cff31e3c | ||
|
|
874699a1d7 | ||
|
|
c3c5b0b156 | ||
|
|
22bc479420 | ||
|
|
64387f83d8 | ||
|
|
b4438122f9 | ||
|
|
11ee270911 | ||
|
|
70b78835d3 | ||
|
|
0faa2bfb9c | ||
|
|
991b3bb5cf | ||
|
|
608a18eed4 | ||
|
|
292ca54153 | ||
|
|
a157596973 | ||
|
|
23bc582407 | ||
|
|
cfe5b990f9 | ||
|
|
58f6f37891 | ||
|
|
5ab5fbdf92 | ||
|
|
374d15b701 | ||
|
|
e57dcee3e4 | ||
|
|
01ca954399 | ||
|
|
7da2fa556c | ||
|
|
4c50f40771 | ||
|
|
85a9d51e58 | ||
|
|
8009857c8a | ||
|
|
e2826b1338 | ||
|
|
7e88a79a8d | ||
|
|
51f0ff4d9c | ||
|
|
bd922dfe14 | ||
|
|
096ce97503 | ||
|
|
336b8fa6f9 | ||
|
|
499be25fc0 | ||
|
|
4ec48d5a66 | ||
|
|
b7861f5341 | ||
|
|
c2a82bd9cd | ||
|
|
ee8b23bdc7 | ||
|
|
1b3979fb97 | ||
|
|
26ac56c1a6 | ||
|
|
1833456c45 | ||
|
|
50dc428692 | ||
|
|
d403d6d62f | ||
|
|
8fca2c7c8f | ||
|
|
5dac5a465b | ||
|
|
f3c9ad15da | ||
|
|
12040bd5aa | ||
|
|
6367d20757 | ||
|
|
4dbbb2b1b5 | ||
|
|
7a756c5766 | ||
|
|
ce7212a798 | ||
|
|
e0c6ea920d | ||
|
|
892b769d3a | ||
|
|
0f31a7d479 | ||
|
|
cafc8dedc7 | ||
|
|
5f168a76af | ||
|
|
985b56353b | ||
|
|
0570476c5c | ||
|
|
2d641b4e30 | ||
|
|
3bc58d2c8e | ||
|
|
4b472cfd30 | ||
|
|
04e79b5140 | ||
|
|
7435c8bc29 | ||
|
|
8031105ea2 | ||
|
|
d7fd2b7d8c | ||
|
|
2f50aae082 | ||
|
|
4ec8b1f523 | ||
|
|
2c97fdaf46 | ||
|
|
ed06f6ed84 | ||
|
|
6e29509da4 | ||
|
|
9a3df26dc1 | ||
|
|
9b335e2afa | ||
|
|
8ebb409ef3 | ||
|
|
61757b8e8a | ||
|
|
67b8fa74f3 | ||
|
|
bc72a0c172 | ||
|
|
49d73df622 | ||
|
|
a9c1a9c5a4 | ||
|
|
653eaf019e | ||
|
|
df443d9593 | ||
|
|
51216bdc80 | ||
|
|
3c7917425b | ||
|
|
0dd7604d6a | ||
|
|
eb72141e52 | ||
|
|
235aba14f4 | ||
|
|
e81dc6c36d | ||
|
|
5edd07e805 | ||
|
|
7139672f63 | ||
|
|
926cabd695 | ||
|
|
e28cb2edcc | ||
|
|
bf9c9251f9 | ||
|
|
4fc93016dd | ||
|
|
3b29ecb087 | ||
|
|
6b6c965299 | ||
|
|
bdb9929628 | ||
|
|
4a04405b5d | ||
|
|
ff27373bb2 | ||
|
|
9bad7f3485 | ||
|
|
0eb4468c79 | ||
|
|
d8b614bbdf | ||
|
|
776438f682 | ||
|
|
321e54def0 | ||
|
|
0f0bb35170 | ||
|
|
7b0ceddd6b | ||
|
|
e2fafe2b46 | ||
|
|
f396592d2e | ||
|
|
18fca8d90b | ||
|
|
7c85b20733 | ||
|
|
48c0c536fc | ||
|
|
188662cd51 | ||
|
|
dd01e8cf49 |
12
.github/workflows/docker.yml
vendored
12
.github/workflows/docker.yml
vendored
@@ -39,7 +39,7 @@ jobs:
|
||||
make cmd/cloudevent cmd/devtool
|
||||
make cmd/*cli
|
||||
make cmd/esxi-agent
|
||||
make docker-alpine-build F='-j4 cmd/host cmd/vpcagent'
|
||||
make docker-alpine-build F='-j4 cmd/host cmd/vpcagent cmd/region-dns'
|
||||
|
||||
- name: Image baremetal-agent
|
||||
uses: elgohr/Publish-Docker-Github-Action@master
|
||||
@@ -220,3 +220,13 @@ jobs:
|
||||
registry: registry.cn-beijing.aliyuncs.com
|
||||
snapshot: true
|
||||
dockerfile: build/docker/Dockerfile.devtool
|
||||
|
||||
- name: Image region DNS
|
||||
uses: elgohr/Publish-Docker-Github-Action@master
|
||||
with:
|
||||
name: registry.cn-beijing.aliyuncs.com/yunionio/region-dns
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
registry: registry.cn-beijing.aliyuncs.com
|
||||
snapshot: true
|
||||
dockerfile: build/docker/Dockerfile.region-dns
|
||||
|
||||
2
Makefile
2
Makefile
@@ -211,6 +211,7 @@ docker-centos-build:
|
||||
--name onecloud-ci-build \
|
||||
--rm \
|
||||
--volume $(CURDIR):/root/onecloud \
|
||||
--volume $(CURDIR)/_output/_cache:/root/.cache \
|
||||
registry.cn-beijing.aliyuncs.com/yunionio/centos-build:$(DOCKER_BUILD_IMAGE_VERSION) \
|
||||
/bin/bash -c "$$dockerCentOSBuildCmd"
|
||||
chown -R $$(id -u):$$(id -g) _output
|
||||
@@ -241,6 +242,7 @@ docker-alpine-build:
|
||||
--name onecloud-docker-alpine-build \
|
||||
-v $(CURDIR):/root/go/src/yunion.io/x/onecloud \
|
||||
-v $(CURDIR)/_output/alpine-build:/root/go/src/yunion.io/x/onecloud/_output \
|
||||
-v $(CURDIR)/_output/alpine-build/_cache:/root/.cache \
|
||||
registry.cn-beijing.aliyuncs.com/yunionio/alpine-build:1.0-1 \
|
||||
/bin/sh -c "$$dockerAlpineBuildCmd"
|
||||
ls -lh _output/alpine-build/bin
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
FROM registry.cn-beijing.aliyuncs.com/yunionio/climc-base:latest
|
||||
FROM registry.cn-beijing.aliyuncs.com/yunionio/climc-base:v20200308
|
||||
|
||||
ADD ./build/climc/root/opt /opt
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ ENV TZ Asia/Shanghai
|
||||
|
||||
RUN mkdir -p /opt/yunion/bin
|
||||
|
||||
RUN apk add --no-cache bash bash-completion tzdata ca-certificates && \
|
||||
RUN apk add --no-cache bash bash-completion tzdata ca-certificates vim && \
|
||||
rm -rf /var/cache/apk/*
|
||||
|
||||
RUN cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
FROM registry.cn-beijing.aliyuncs.com/yunionio/onecloud-base:latest
|
||||
FROM alpine:3.11.3
|
||||
|
||||
ADD ./_output/bin/region-dns /opt/yunion/bin/region-dns
|
||||
RUN mkdir -p /opt/yunion/bin
|
||||
ADD ./_output/alpine-build/bin/region-dns /opt/yunion/bin/region-dns
|
||||
|
||||
@@ -84,7 +84,11 @@ func newClient(options *BaseOptions) (*aliyun.SRegion, error) {
|
||||
return nil, fmt.Errorf("Missing secret")
|
||||
}
|
||||
|
||||
cli, err := aliyun.NewAliyunClient("", "", options.AccessKey, options.Secret, options.Debug)
|
||||
cli, err := aliyun.NewAliyunClient(
|
||||
aliyun.NewAliyunClientConfig(
|
||||
options.AccessKey, options.Secret,
|
||||
).Debug(options.Debug),
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -85,7 +85,13 @@ func newClient(options *BaseOptions) (*aws.SRegion, error) {
|
||||
return nil, fmt.Errorf("Missing secret")
|
||||
}
|
||||
|
||||
cli, err := aws.NewAwsClient("", "", options.AccessUrl, options.AccessKey, options.Secret, options.Debug)
|
||||
cli, err := aws.NewAwsClient(
|
||||
aws.NewAwsClientConfig(
|
||||
options.AccessUrl,
|
||||
options.AccessKey,
|
||||
options.Secret,
|
||||
).Debug(options.Debug),
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -100,11 +100,17 @@ func newClient(options *BaseOptions) (*azure.SRegion, error) {
|
||||
return nil, fmt.Errorf("Missing Cloud Environment")
|
||||
}
|
||||
|
||||
cli, err := azure.NewAzureClient("", "", options.CloudEnv,
|
||||
options.DirectoryID,
|
||||
options.ApplicationID, options.ApplicationKey,
|
||||
options.SubscriptionID,
|
||||
options.Debug)
|
||||
cli, err := azure.NewAzureClient(
|
||||
azure.NewAzureClientConfig(
|
||||
options.CloudEnv,
|
||||
options.DirectoryID,
|
||||
options.ApplicationID,
|
||||
options.ApplicationKey,
|
||||
).
|
||||
SubscriptionId(options.SubscriptionID).
|
||||
Debug(options.Debug),
|
||||
)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
46
cmd/climc/shell/bucket_options.go
Normal file
46
cmd/climc/shell/bucket_options.go
Normal file
@@ -0,0 +1,46 @@
|
||||
// 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 shell
|
||||
|
||||
import (
|
||||
"yunion.io/x/jsonutils"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/options"
|
||||
)
|
||||
|
||||
func init() {
|
||||
type BucketOptionsVerifyOptions struct {
|
||||
options.BaseListOptions
|
||||
CloudaccountId string `help:"cloudaccount Id" required:"true"`
|
||||
BillingReportBucket string `help:"S3 bucket that stores account billing report"`
|
||||
BillingFilePrefix string `help:"prefix of billing file name"`
|
||||
BillingBucketAccount string `help:"Id of cloudaccount that can access billing bucket"`
|
||||
UsageReportBucket string `help:"S3 bucket that stores account usage report"`
|
||||
UsageFilePrefix string `help:"prefix of usage file name"`
|
||||
UsageBucketAccount string `help:"Id of cloudaccount that can access usage bucket"`
|
||||
}
|
||||
R(&BucketOptionsVerifyOptions{}, "bucket-options-verify", "billing bucket connection test",
|
||||
func(s *mcclient.ClientSession, args *BucketOptionsVerifyOptions) error {
|
||||
params := jsonutils.Marshal(args)
|
||||
result, err := modules.BucketOptions.PerformAction(s, args.CloudaccountId, "verify", params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(result)
|
||||
return nil
|
||||
})
|
||||
}
|
||||
@@ -26,6 +26,28 @@ import (
|
||||
"yunion.io/x/onecloud/pkg/mcclient/options"
|
||||
)
|
||||
|
||||
func parseGcpCredential(filename string) (jsonutils.JSONObject, error) {
|
||||
data, err := ioutil.ReadFile(filename)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
authParams, err := jsonutils.Parse(data)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
ret := jsonutils.NewDict()
|
||||
for _, k := range []string{
|
||||
"client_email",
|
||||
"project_id",
|
||||
"private_key_id",
|
||||
"private_key",
|
||||
} {
|
||||
v, _ := authParams.Get(k)
|
||||
ret.Add(v, fmt.Sprintf("gcp_%s", k))
|
||||
}
|
||||
return ret, nil
|
||||
}
|
||||
|
||||
func init() {
|
||||
|
||||
type CloudaccountListOptions struct {
|
||||
@@ -138,11 +160,7 @@ func init() {
|
||||
R(&options.SGoogleCloudAccountCreateOptions{}, "cloud-account-create-google", "Create a Google cloud account", func(s *mcclient.ClientSession, args *options.SGoogleCloudAccountCreateOptions) error {
|
||||
params := jsonutils.Marshal(args)
|
||||
params.(*jsonutils.JSONDict).Add(jsonutils.NewString("Google"), "provider")
|
||||
data, err := ioutil.ReadFile(args.GoogleJsonFile)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
authParams, err := jsonutils.Parse(data)
|
||||
authParams, err := parseGcpCredential(args.GoogleJsonFile)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -381,6 +399,19 @@ func init() {
|
||||
return nil
|
||||
})
|
||||
|
||||
R(&options.SGoogleCloudAccountUpdateOptions{}, "cloud-account-update-google", "update a google cloud account", func(s *mcclient.ClientSession, args *options.SGoogleCloudAccountUpdateOptions) error {
|
||||
params := jsonutils.Marshal(args).(*jsonutils.JSONDict)
|
||||
if params.Size() == 0 {
|
||||
return InvalidUpdateError()
|
||||
}
|
||||
result, err := modules.Cloudaccounts.Update(s, args.ID, params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(result)
|
||||
return nil
|
||||
})
|
||||
|
||||
R(&options.SAWSCloudAccountUpdateOptions{}, "cloud-account-update-aws", "update an AWS cloud account", func(s *mcclient.ClientSession, args *options.SAWSCloudAccountUpdateOptions) error {
|
||||
params := jsonutils.Marshal(args).(*jsonutils.JSONDict)
|
||||
|
||||
@@ -422,7 +453,7 @@ func init() {
|
||||
return nil
|
||||
})
|
||||
|
||||
R(&options.SOpenStackCloudAccountUpdateOptions{}, "cloud-account-update-openstack", "update an AWS cloud account", func(s *mcclient.ClientSession, args *options.SOpenStackCloudAccountUpdateOptions) error {
|
||||
R(&options.SOpenStackCloudAccountUpdateOptions{}, "cloud-account-update-openstack", "update an OpenStack cloud account", func(s *mcclient.ClientSession, args *options.SOpenStackCloudAccountUpdateOptions) error {
|
||||
params := jsonutils.Marshal(args).(*jsonutils.JSONDict)
|
||||
if params.Size() == 0 {
|
||||
return InvalidUpdateError()
|
||||
@@ -675,11 +706,7 @@ func init() {
|
||||
})
|
||||
|
||||
R(&options.SGoogleCloudAccountUpdateCredentialOptions{}, "cloud-account-update-credential-google", "Update credential of a Google cloud account", func(s *mcclient.ClientSession, args *options.SGoogleCloudAccountUpdateCredentialOptions) error {
|
||||
data, err := ioutil.ReadFile(args.GoogleJsonFile)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
params, err := jsonutils.Parse(data)
|
||||
params, err := parseGcpCredential(args.GoogleJsonFile)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ import (
|
||||
)
|
||||
|
||||
func init() {
|
||||
R(&options.RouteCreateOptions{}, "router-route-create", "Create router", func(s *mcclient.ClientSession, opts *options.RouteCreateOptions) error {
|
||||
R(&options.RouteCreateOptions{}, "router-route-create", "Create router route", func(s *mcclient.ClientSession, opts *options.RouteCreateOptions) error {
|
||||
params, err := base_options.StructToParams(opts)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -34,7 +34,7 @@ func init() {
|
||||
printObject(router)
|
||||
return nil
|
||||
})
|
||||
R(&options.RouteGetOptions{}, "router-route-show", "Show router", func(s *mcclient.ClientSession, opts *options.RouteGetOptions) error {
|
||||
R(&options.RouteGetOptions{}, "router-route-show", "Show router route", func(s *mcclient.ClientSession, opts *options.RouteGetOptions) error {
|
||||
router, err := modules.Routes.Get(s, opts.ID, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -42,7 +42,7 @@ func init() {
|
||||
printObject(router)
|
||||
return nil
|
||||
})
|
||||
R(&options.RouteListOptions{}, "router-route-list", "List routers", func(s *mcclient.ClientSession, opts *options.RouteListOptions) error {
|
||||
R(&options.RouteListOptions{}, "router-route-list", "List router routes", func(s *mcclient.ClientSession, opts *options.RouteListOptions) error {
|
||||
params, err := base_options.ListStructToParams(opts)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -54,7 +54,7 @@ func init() {
|
||||
printList(result, modules.Routes.GetColumns(s))
|
||||
return nil
|
||||
})
|
||||
R(&options.RouteUpdateOptions{}, "router-route-update", "Update router", func(s *mcclient.ClientSession, opts *options.RouteUpdateOptions) error {
|
||||
R(&options.RouteUpdateOptions{}, "router-route-update", "Update router route", func(s *mcclient.ClientSession, opts *options.RouteUpdateOptions) error {
|
||||
params, err := base_options.StructToParams(opts)
|
||||
router, err := modules.Routes.Update(s, opts.ID, params)
|
||||
if err != nil {
|
||||
@@ -63,7 +63,7 @@ func init() {
|
||||
printObject(router)
|
||||
return nil
|
||||
})
|
||||
R(&options.RouteDeleteOptions{}, "router-route-delete", "Delete router", func(s *mcclient.ClientSession, opts *options.RouteDeleteOptions) error {
|
||||
R(&options.RouteDeleteOptions{}, "router-route-delete", "Delete router route", func(s *mcclient.ClientSession, opts *options.RouteDeleteOptions) error {
|
||||
router, err := modules.Routes.Delete(s, opts.ID, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -29,11 +29,11 @@ func init() {
|
||||
* 操作用户的通信地址(如果用户的通信地址不存在则进行添加;如果已存在则进行修改;如果设置空则进行删除。)
|
||||
*/
|
||||
type ContactsUpdateOptions struct {
|
||||
UID string `help:"The user you wanna add contact to (Keystone User ID)"`
|
||||
CONTACTTYPE string `help:"The contact type email|mobile" choices:"email|mobile|dingtalk"`
|
||||
CONTACT string `help:"The contacts details mobile number or email address or dingtalk's userid, if set it the empty str means delete"`
|
||||
Status string `help:"Enabled or disabled contact status" choices:"enable|disable"`
|
||||
Pull string `help:"pull some subcontacts(e.g., dingtalk, feishu, etc) related to mobile"`
|
||||
UID string `help:"The user you wanna add contact to (Keystone User ID)"`
|
||||
CONTACTTYPE string `help:"The contact type email|mobile" choices:"email|mobile|dingtalk"`
|
||||
CONTACT string `help:"The contacts details mobile number or email address or dingtalk's userid, if set it the empty str means delete"`
|
||||
Status string `help:"Enabled or disabled contact status" choices:"enable|disable"`
|
||||
Pull []string `help:"pull some subcontacts(e.g., dingtalk, feishu, etc) related to mobile"`
|
||||
}
|
||||
R(&ContactsUpdateOptions{}, "contact-update", "Create, delete or update contact for user", func(s *mcclient.ClientSession, args *ContactsUpdateOptions) error {
|
||||
arr := jsonutils.NewArray()
|
||||
@@ -53,7 +53,13 @@ func init() {
|
||||
params := jsonutils.NewDict()
|
||||
params.Add(arr, "contacts")
|
||||
|
||||
contact, err := modules.Contacts.CustomizedPerformAction(s, args.UID, "update-contact", args.Pull, params)
|
||||
pulls := jsonutils.NewArray()
|
||||
for _, pull := range args.Pull {
|
||||
pulls.Add(jsonutils.NewString(pull))
|
||||
}
|
||||
params.Add(pulls, "pull")
|
||||
|
||||
contact, err := modules.Contacts.CustomizedPerformAction(s, args.UID, "update-contact", params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -69,7 +75,8 @@ func init() {
|
||||
R(&ContactsPullOptions{}, "contact-pull", "Pull contact", func(s *mcclient.ClientSession, args *ContactsPullOptions) error {
|
||||
params := jsonutils.NewDict()
|
||||
params.Set("contacts", jsonutils.NewArray())
|
||||
contact, err := modules.Contacts.CustomizedPerformAction(s, args.UID, "update-contact", args.CONTACTTYPE, params)
|
||||
params.Set("pull", jsonutils.NewArray(jsonutils.NewString(args.CONTACTTYPE)))
|
||||
contact, err := modules.Contacts.CustomizedPerformAction(s, args.UID, "update-contact", params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -89,7 +96,7 @@ func init() {
|
||||
arr.Add(tmpObj)
|
||||
params := jsonutils.NewDict()
|
||||
params.Add(arr, "contacts")
|
||||
contact, err := modules.Contacts.CustomizedPerformAction(s, args.UID, "update-contact", "", params)
|
||||
contact, err := modules.Contacts.CustomizedPerformAction(s, args.UID, "update-contact", params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -180,7 +187,7 @@ func init() {
|
||||
tmpDict := jsonutils.NewDict()
|
||||
tmpDict.Add(jsonutils.NewString(args.CONTACT_TYPE), "contact_type")
|
||||
tmpDict.Add(jsonutils.NewString(args.CONTACT), "contact")
|
||||
_, err := modules.Contacts.CustomizedPerformAction(s, args.UID, "verify", "", tmpDict)
|
||||
_, err := modules.Contacts.CustomizedPerformAction(s, args.UID, "verify", tmpDict)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -15,7 +15,14 @@
|
||||
package shell
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"bytes"
|
||||
"encoding/base64"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"mime/multipart"
|
||||
"net/http"
|
||||
"path/filepath"
|
||||
|
||||
"yunion.io/x/jsonutils"
|
||||
|
||||
@@ -56,4 +63,78 @@ func init() {
|
||||
printObject(r)
|
||||
return nil
|
||||
})
|
||||
|
||||
type EnterpriseUpdateOptions struct {
|
||||
Name string `help:"Enterprise name"`
|
||||
Copyright string `help:"The Email"`
|
||||
Logo string `help:"logo file path"`
|
||||
LoginLogo string `help:"login page logo file path"`
|
||||
Favicon string `help:"favicon path"`
|
||||
}
|
||||
|
||||
R(&EnterpriseUpdateOptions{}, "infos-update", "update enterprise info", func(s *mcclient.ClientSession, args *EnterpriseUpdateOptions) error {
|
||||
var b bytes.Buffer
|
||||
w := multipart.NewWriter(&b)
|
||||
if len(args.Name) > 0 {
|
||||
w.WriteField("name", args.Name)
|
||||
}
|
||||
|
||||
if len(args.Copyright) > 0 {
|
||||
w.WriteField("copyright", args.Copyright)
|
||||
}
|
||||
|
||||
writeFile := func(filedName, filePath string) error {
|
||||
if len(filePath) == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
c, err := ioutil.ReadFile(filePath)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
var v string
|
||||
c64 := base64.StdEncoding.EncodeToString(c)
|
||||
ext := filepath.Ext(filePath)
|
||||
switch ext {
|
||||
case ".png":
|
||||
v = fmt.Sprintf("data:image/png;base64,%s", c64)
|
||||
case ".jpg":
|
||||
v = fmt.Sprintf("data:image/jpg;base64,%s", c64)
|
||||
default:
|
||||
return fmt.Errorf("only support png/jpg image")
|
||||
}
|
||||
|
||||
err = w.WriteField(filedName, v)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
if err := writeFile("logo", args.Logo); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := writeFile("login_logo", args.LoginLogo); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := writeFile("favicon", args.Favicon); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
header := make(http.Header)
|
||||
header.Set("content-type", fmt.Sprintf("multipart/form-data; boundary=%s", w.Boundary()))
|
||||
w.Close()
|
||||
|
||||
ret, err := modules.Info.Update(s, header, bufio.NewReader(&b))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
printObject(ret)
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
@@ -18,11 +18,13 @@ import (
|
||||
"fmt"
|
||||
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/log"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/options"
|
||||
"yunion.io/x/onecloud/pkg/util/fileutils2"
|
||||
"yunion.io/x/onecloud/pkg/util/ssh"
|
||||
)
|
||||
|
||||
func init() {
|
||||
@@ -664,4 +666,44 @@ func init() {
|
||||
printObject(result)
|
||||
return nil
|
||||
})
|
||||
|
||||
type HostSSHLoginOptions struct {
|
||||
ID string `help:"ID or name of host"`
|
||||
Port int `help:"SSH service port" default:"22"`
|
||||
}
|
||||
R(&HostSSHLoginOptions{}, "host-ssh", "SSH login of a host", func(s *mcclient.ClientSession, args *HostSSHLoginOptions) error {
|
||||
srvid, e := modules.Hosts.GetId(s, args.ID, nil)
|
||||
if e != nil {
|
||||
return e
|
||||
}
|
||||
i, e := modules.Hosts.GetLoginInfo(s, srvid, nil)
|
||||
if e != nil {
|
||||
return e
|
||||
}
|
||||
host, err := i.GetString("ip")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
user, err := i.GetString("username")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
passwd, err := i.GetString("password")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
port := 22
|
||||
if args.Port != 22 {
|
||||
port = args.Port
|
||||
}
|
||||
sshCli, err := ssh.NewClient(host, port, user, passwd, "")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
log.Infof("ssh %s:%d", host, port)
|
||||
if err := sshCli.RunTerminal(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
@@ -205,4 +205,70 @@ func initKubeCluster() {
|
||||
printObject(ret)
|
||||
return nil
|
||||
})
|
||||
|
||||
R(&o.IdentOptions{}, cmdN("components-status"), "Get cluster component status", func(s *mcclient.ClientSession, args *o.IdentOptions) error {
|
||||
ret, err := k8s.KubeClusters.GetSpecific(s, args.ID, "components-status", nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(ret)
|
||||
return nil
|
||||
})
|
||||
|
||||
R(&o.ClusterComponentTypeOptions{}, cmdN("component-setting"), "Get cluster component setting", func(s *mcclient.ClientSession, args *o.ClusterComponentTypeOptions) error {
|
||||
q := jsonutils.NewDict()
|
||||
q.Add(jsonutils.NewString(args.TYPE), "type")
|
||||
ret, err := k8s.KubeClusters.GetSpecific(s, args.ID, "component-setting", q)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(ret)
|
||||
return nil
|
||||
})
|
||||
|
||||
R(&o.ClusterEnableComponentCephCSIOpt{}, cmdN("component-enable-ceph-csi"), "Enable cluster component", func(s *mcclient.ClientSession, args *o.ClusterEnableComponentCephCSIOpt) error {
|
||||
params, err := args.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
ret, err := k8s.KubeClusters.PerformAction(s, args.ID, "enable-component", params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(ret)
|
||||
return nil
|
||||
})
|
||||
|
||||
R(&o.ClusterDisableComponent{}, cmdN("component-disable"), "Enable cluster component", func(s *mcclient.ClientSession, args *o.ClusterDisableComponent) error {
|
||||
params := args.Params()
|
||||
ret, err := k8s.KubeClusters.PerformAction(s, args.ID, "disable-component", params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(ret)
|
||||
return nil
|
||||
})
|
||||
|
||||
R(&o.ClusterDisableComponent{}, cmdN("component-delete"), "Delete cluster component", func(s *mcclient.ClientSession, args *o.ClusterDisableComponent) error {
|
||||
params := args.Params()
|
||||
ret, err := k8s.KubeClusters.PerformAction(s, args.ID, "delete-component", params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(ret)
|
||||
return nil
|
||||
})
|
||||
|
||||
R(&o.ClusterUpdateComponentCephCSIOpt{}, cmdN("component-update-ceph-csi"), "Update cluster component", func(s *mcclient.ClientSession, args *o.ClusterUpdateComponentCephCSIOpt) error {
|
||||
params, err := args.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
ret, err := k8s.KubeClusters.PerformAction(s, args.ID, "update-component", params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(ret)
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
9
cmd/climc/shell/k8s/event.go
Normal file
9
cmd/climc/shell/k8s/event.go
Normal file
@@ -0,0 +1,9 @@
|
||||
package k8s
|
||||
|
||||
import (
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules/k8s"
|
||||
)
|
||||
|
||||
func initEvent() {
|
||||
initK8sNamespaceResource("event", k8s.Events)
|
||||
}
|
||||
@@ -16,6 +16,11 @@ package k8s
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"os/exec"
|
||||
|
||||
"github.com/ghodss/yaml"
|
||||
|
||||
"yunion.io/x/jsonutils"
|
||||
|
||||
@@ -57,7 +62,7 @@ func init() {
|
||||
initPVC()
|
||||
initJob()
|
||||
initCronJob()
|
||||
|
||||
initEvent()
|
||||
initRbac()
|
||||
|
||||
initApp()
|
||||
@@ -217,6 +222,71 @@ func NewK8sNsResourceGetCmd(cmdN CmdNameFactory, manager modulebase.Manager) *Cm
|
||||
)
|
||||
}
|
||||
|
||||
func NewK8sNsResourceGetRawCmd(cmdN CmdNameFactory, manager k8s.IClusterResourceManager) *Cmd {
|
||||
return NewCommand(
|
||||
&o.NamespaceResourceGetOptions{},
|
||||
cmdN.Do("show-raw"),
|
||||
fmt.Sprintf("Show k8s %s raw data", cmdN.Kind),
|
||||
func(s *mcclient.ClientSession, args *o.NamespaceResourceGetOptions) error {
|
||||
ret, err := manager.GetRaw(s, args.NAME, args.Params())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObjectYAML(ret)
|
||||
return nil
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
func NewK8sResourceEditRawCmd(cmdN CmdNameFactory, manager k8s.IClusterResourceManager) *Cmd {
|
||||
return NewCommand(
|
||||
&o.NamespaceResourceGetOptions{},
|
||||
cmdN.Do("edit-raw"),
|
||||
fmt.Sprintf("Edit and update k8s %s raw data", cmdN.Kind),
|
||||
func(s *mcclient.ClientSession, args *o.NamespaceResourceGetOptions) error {
|
||||
rawData, err := manager.GetRaw(s, args.NAME, args.Params())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
yamlBytes := rawData.YAMLString()
|
||||
tempfile, err := ioutil.TempFile("", fmt.Sprintf("k8s-%s-%s*.yaml", cmdN.Kind, args.NAME))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer os.Remove(tempfile.Name())
|
||||
if _, err := tempfile.Write([]byte(yamlBytes)); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := tempfile.Close(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
cmd := exec.Command("vim", tempfile.Name())
|
||||
cmd.Stdin = os.Stdin
|
||||
cmd.Stdout = os.Stdout
|
||||
if err := cmd.Run(); err != nil {
|
||||
return err
|
||||
}
|
||||
content, err := ioutil.ReadFile(tempfile.Name())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
jsonBytes, err := yaml.YAMLToJSON(content)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
body, err := jsonutils.Parse(jsonBytes)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if _, err := manager.UpdateRaw(s, args.NAME, args.Params(), body.(*jsonutils.JSONDict)); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
func NewK8sResourceDeleteCmd(cmdN CmdNameFactory, manager modulebase.Manager) *Cmd {
|
||||
return NewCommand(
|
||||
&o.ResourceDeleteOptions{},
|
||||
@@ -244,11 +314,13 @@ func NewK8sNsResourceDeleteCmd(cmdN CmdNameFactory, manager modulebase.Manager)
|
||||
return deleteCmd
|
||||
}
|
||||
|
||||
func initK8sNamespaceResource(kind string, manager modulebase.Manager) *ShellCommands {
|
||||
func initK8sNamespaceResource(kind string, manager k8s.IClusterResourceManager) *ShellCommands {
|
||||
cmdN := NewCmdNameFactory(kind)
|
||||
return NewShellCommands(cmdN.Do).AddR(
|
||||
NewK8sNsResourceListCmd(cmdN, manager),
|
||||
NewK8sNsResourceGetCmd(cmdN, manager),
|
||||
NewK8sNsResourceDeleteCmd(cmdN, manager),
|
||||
NewK8sNsResourceGetRawCmd(cmdN, manager),
|
||||
NewK8sResourceEditRawCmd(cmdN, manager),
|
||||
)
|
||||
}
|
||||
|
||||
@@ -40,22 +40,40 @@ func initSecret() {
|
||||
})
|
||||
secretCmd.AddR(listCmd)
|
||||
|
||||
registryCmd := initK8sNamespaceResource("registrysecret", k8s.RegistrySecrets)
|
||||
createCmd := NewCommand(
|
||||
registryCmd := NewCmdNameFactory("secret-registry")
|
||||
registryCreateCmd := NewCommand(
|
||||
&o.RegistrySecretCreateOptions{},
|
||||
registryCmd.CommandNameFactory("create"),
|
||||
"Create docker registry secret resource",
|
||||
registryCmd.Do("create"),
|
||||
"Create docker registry secret secret",
|
||||
func(s *mcclient.ClientSession, args *o.RegistrySecretCreateOptions) error {
|
||||
params, err := args.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
ret, err := k8s.RegistrySecrets.Create(s, params)
|
||||
ret, err := k8s.Secrets.Create(s, params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(ret)
|
||||
return nil
|
||||
})
|
||||
registryCmd.AddR(createCmd)
|
||||
|
||||
cephCSICmd := NewCmdNameFactory("secret-ceph-csi")
|
||||
cephCSICreateCmd := NewCommand(
|
||||
&o.CephCSISecretCreateOptions{},
|
||||
cephCSICmd.Do("create"),
|
||||
"Create ceph csi user secret",
|
||||
func(s *mcclient.ClientSession, args *o.CephCSISecretCreateOptions) error {
|
||||
params, err := args.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
ret, err := k8s.Secrets.Create(s, params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(ret)
|
||||
return nil
|
||||
})
|
||||
secretCmd.AddR(cephCSICreateCmd, registryCreateCmd)
|
||||
}
|
||||
|
||||
@@ -15,9 +15,70 @@
|
||||
package k8s
|
||||
|
||||
import (
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules/k8s"
|
||||
o "yunion.io/x/onecloud/pkg/mcclient/options/k8s"
|
||||
)
|
||||
|
||||
func initStorageClass() {
|
||||
initK8sClusterResource("storageclass", k8s.Storageclass)
|
||||
cmdN := NewCmdNameFactory("storageclass")
|
||||
scCmd := initK8sClusterResource("storageclass", k8s.Storageclass)
|
||||
|
||||
setDefaultCmd := NewCommand(
|
||||
&o.ClusterResourceBaseOptions{},
|
||||
cmdN.Do("set-default"),
|
||||
"Set storageclass as default",
|
||||
func(s *mcclient.ClientSession, args *o.ClusterResourceBaseOptions) error {
|
||||
ret, err := k8s.Storageclass.PerformAction(s, args.NAME, "set-default", args.Params())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(ret)
|
||||
return nil
|
||||
},
|
||||
)
|
||||
|
||||
scCmd.AddR(setDefaultCmd)
|
||||
|
||||
addStorageClassCephCSI(scCmd)
|
||||
}
|
||||
|
||||
func addStorageClassCephCSI(cmd *ShellCommands) {
|
||||
rbdN := NewCmdNameFactory("storageclass-ceph-csi-rbd")
|
||||
rbdCreateCmd := NewCommand(
|
||||
&o.StorageClassCephCSIRBDCreateOptions{},
|
||||
rbdN.Do("create"),
|
||||
"Create ceph csi rbd",
|
||||
func(s *mcclient.ClientSession, args *o.StorageClassCephCSIRBDCreateOptions) error {
|
||||
params, err := args.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
ret, err := k8s.Storageclass.Create(s, params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(ret)
|
||||
return nil
|
||||
},
|
||||
)
|
||||
testConnCmd := NewCommand(
|
||||
&o.StorageClassCephCSIRBDTestOptions{},
|
||||
rbdN.Do("connection-test"),
|
||||
"Test storageclass connection",
|
||||
func(s *mcclient.ClientSession, args *o.StorageClassCephCSIRBDTestOptions) error {
|
||||
params, err := args.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
ret, err := k8s.Storageclass.PerformClassAction(s, "connection-test", params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(ret)
|
||||
return nil
|
||||
},
|
||||
)
|
||||
|
||||
cmd.AddR(rbdCreateCmd, testConnCmd)
|
||||
}
|
||||
|
||||
@@ -15,6 +15,9 @@
|
||||
package monitor
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
monitorapi "yunion.io/x/onecloud/pkg/apis/monitor"
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules/monitor"
|
||||
options "yunion.io/x/onecloud/pkg/mcclient/options/monitor"
|
||||
@@ -36,6 +39,20 @@ func init() {
|
||||
return nil
|
||||
})
|
||||
|
||||
R(&options.AlertCreateOptions{}, aN("create"), "Create alert rule",
|
||||
func(s *mcclient.ClientSession, args *options.AlertCreateOptions) error {
|
||||
params, err := args.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
ret, err := monitor.Alerts.DoCreate(s, params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(ret)
|
||||
return nil
|
||||
})
|
||||
|
||||
R(&options.AlertShowOptions{}, aN("show"), "Show details of a alert rule",
|
||||
func(s *mcclient.ClientSession, args *options.AlertShowOptions) error {
|
||||
ret, err := monitor.Alerts.Get(s, args.ID, nil)
|
||||
@@ -66,4 +83,34 @@ func init() {
|
||||
printBatchResults(ret, monitor.Alerts.GetColumns(s))
|
||||
return nil
|
||||
})
|
||||
|
||||
R(&options.AlertTestRunOptions{}, aN("test-run"), "Test run alert",
|
||||
func(s *mcclient.ClientSession, args *options.AlertTestRunOptions) error {
|
||||
data := new(monitorapi.AlertTestRunInput)
|
||||
if args.Debug {
|
||||
data.IsDebug = true
|
||||
}
|
||||
ret, err := monitor.Alerts.DoTestRun(s, args.ID, data)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
fmt.Println(ret.JSON(ret).YAMLString())
|
||||
return nil
|
||||
})
|
||||
|
||||
R(&options.AlertPauseOptions{}, aN("pause"), "Pause or unpause alert",
|
||||
func(s *mcclient.ClientSession, args *options.AlertPauseOptions) error {
|
||||
data := new(monitorapi.AlertPauseInput)
|
||||
if args.UnPause {
|
||||
data.Paused = false
|
||||
} else {
|
||||
data.Paused = true
|
||||
}
|
||||
ret, err := monitor.Alerts.PerformAction(s, args.ID, "pause", data.JSON(data))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(ret)
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
60
cmd/climc/shell/monitor/alertnotification.go
Normal file
60
cmd/climc/shell/monitor/alertnotification.go
Normal file
@@ -0,0 +1,60 @@
|
||||
package monitor
|
||||
|
||||
import (
|
||||
monitorapi "yunion.io/x/onecloud/pkg/apis/monitor"
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modulebase"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules/monitor"
|
||||
options "yunion.io/x/onecloud/pkg/mcclient/options/monitor"
|
||||
)
|
||||
|
||||
func init() {
|
||||
initAlertNotification()
|
||||
}
|
||||
|
||||
func initAlertNotification() {
|
||||
aN := cmdN("alert-notification")
|
||||
R(&options.AlertNotificationListOptions{}, aN("list"), "List alert notification pairs",
|
||||
func(s *mcclient.ClientSession, args *options.AlertNotificationListOptions) error {
|
||||
params, err := args.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
var result *modulebase.ListResult
|
||||
if len(args.Alert) > 0 {
|
||||
result, err = monitor.Alertnotification.ListDescendent(s, args.Alert, params)
|
||||
} else if len(args.Notification) > 0 {
|
||||
result, err = monitor.Alertnotification.ListDescendent2(s, args.Notification, params)
|
||||
} else {
|
||||
result, err = monitor.Alertnotification.List(s, params)
|
||||
}
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printList(result, monitor.Alertnotification.GetColumns(s))
|
||||
return nil
|
||||
})
|
||||
|
||||
R(&options.AlertNotificationAttachOptions{}, aN("attach"), "Attach a notification to a alert",
|
||||
func(s *mcclient.ClientSession, args *options.AlertNotificationAttachOptions) error {
|
||||
input := &monitorapi.AlertnotificationCreateInput{
|
||||
UsedBy: args.UsedBy,
|
||||
}
|
||||
ret, err := monitor.Alertnotification.Attach(s, args.ALERT, args.NOTIFICATION, input.JSON(input))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(ret)
|
||||
return nil
|
||||
})
|
||||
|
||||
R(&options.AlertNotificationAttachOptions{}, aN("detach"), "Detach a notification to a alert",
|
||||
func(s *mcclient.ClientSession, args *options.AlertNotificationAttachOptions) error {
|
||||
ret, err := monitor.Alertnotification.Detach(s, args.ALERT, args.NOTIFICATION, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(ret)
|
||||
return nil
|
||||
})
|
||||
}
|
||||
@@ -346,77 +346,6 @@ func init() {
|
||||
return nil
|
||||
})
|
||||
|
||||
type NetworkAddDnsUpdateTargetOptions struct {
|
||||
ID string `help:"Network ID or name"`
|
||||
DNS string `help:"DNS server address" metavar:"DNS_SERVER"`
|
||||
KEY string `help:"DNS update key name" metavar:"DNS_UPDATE_KEY"`
|
||||
SECRET string `help:"DNS update key secret" metavar:"DNS_UPDATE_SECRET"`
|
||||
}
|
||||
R(&NetworkAddDnsUpdateTargetOptions{}, "network-add-dns-update-target", "Add a dns update target to a network", func(s *mcclient.ClientSession, args *NetworkAddDnsUpdateTargetOptions) error {
|
||||
params := jsonutils.NewDict()
|
||||
params.Add(jsonutils.NewString(args.DNS), "server")
|
||||
params.Add(jsonutils.NewString(args.KEY), "key")
|
||||
params.Add(jsonutils.NewString(args.SECRET), "secret")
|
||||
result, err := modules.Networks.PerformAction(s, args.ID, "add-dns-update-target", params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(result)
|
||||
return nil
|
||||
})
|
||||
|
||||
type NetworkRemoveDnsUpdateTargetOptions struct {
|
||||
ID string `help:"Network ID or name"`
|
||||
DNS string `help:"DNS server address" metavar:"DNS_SERVER"`
|
||||
KEY string `help:"DNS update key name" metavar:"DNS_UPDATE_KEY"`
|
||||
}
|
||||
R(&NetworkRemoveDnsUpdateTargetOptions{}, "network-remove-dns-update-target", "Remove a dns update target from a network", func(s *mcclient.ClientSession, args *NetworkRemoveDnsUpdateTargetOptions) error {
|
||||
params := jsonutils.NewDict()
|
||||
params.Add(jsonutils.NewString(args.DNS), "server")
|
||||
params.Add(jsonutils.NewString(args.KEY), "key")
|
||||
result, err := modules.Networks.PerformAction(s, args.ID, "remove-dns-update-target", params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(result)
|
||||
return nil
|
||||
})
|
||||
|
||||
type NetworkSetDnsUpdateKeyOptions struct {
|
||||
ID string `help:"ID of virtual network to update"`
|
||||
KEY string `help:"Key name of secret" metavar:"KEYNAME"`
|
||||
SECRET string `help:"Key secret"`
|
||||
SERVER string `help:"Alternate DNS update server"`
|
||||
}
|
||||
R(&NetworkSetDnsUpdateKeyOptions{}, "network-set-dns-update-key", "Set DNS update key info for a virtual network", func(s *mcclient.ClientSession, args *NetworkSetDnsUpdateKeyOptions) error {
|
||||
params := jsonutils.NewDict()
|
||||
params.Add(jsonutils.NewString(args.KEY), "dns_update_key_name")
|
||||
params.Add(jsonutils.NewString(args.SECRET), "dns_update_key_secret")
|
||||
params.Add(jsonutils.NewString(args.SERVER), "dns_update_server")
|
||||
result, err := modules.Networks.PerformAction(s, args.ID, "metadata", params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(result)
|
||||
return nil
|
||||
})
|
||||
|
||||
type NetworkRemoveDnsUpdateKeyOptions struct {
|
||||
ID string `help:"ID of virtual network"`
|
||||
}
|
||||
R(&NetworkRemoveDnsUpdateKeyOptions{}, "network-remove-dns-update-key", "Set DNS update key info for a virtual network", func(s *mcclient.ClientSession, args *NetworkRemoveDnsUpdateKeyOptions) error {
|
||||
params := jsonutils.NewDict()
|
||||
params.Add(jsonutils.JSONNull, "dns_update_key_name")
|
||||
params.Add(jsonutils.JSONNull, "dns_update_key_secret")
|
||||
params.Add(jsonutils.JSONNull, "dns_update_server")
|
||||
result, err := modules.Networks.PerformAction(s, args.ID, "metadata", params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(result)
|
||||
return nil
|
||||
})
|
||||
|
||||
type NetworkAddressOptions struct {
|
||||
NETWORK string `help:"id or name of network to query"`
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ func init() {
|
||||
NotificationCreateOptions
|
||||
}
|
||||
|
||||
R(&NotificationCreateSingleOptions{}, "notify", "Send a notification to someones", func(s *mcclient.ClientSession,
|
||||
R(&NotificationCreateSingleOptions{}, "notify", "Send a notification to someone", func(s *mcclient.ClientSession,
|
||||
args *NotificationCreateSingleOptions) error {
|
||||
|
||||
msg := notify.SNotifyMessage{}
|
||||
|
||||
@@ -134,7 +134,7 @@ func init() {
|
||||
return nil
|
||||
}
|
||||
R(&PolicyPatchOptions{}, "policy-patch", "Patch policy", updateFunc)
|
||||
R(&PolicyPatchOptions{}, "policy-update", "Patch policy", updateFunc)
|
||||
R(&PolicyPatchOptions{}, "policy-update", "Update policy", updateFunc)
|
||||
|
||||
type PolicyPerformOptions struct {
|
||||
ID string `help:"ID of policy to update"`
|
||||
@@ -375,7 +375,7 @@ func init() {
|
||||
rbacutils.ScopeUser,
|
||||
rbacutils.ScopeNone,
|
||||
} {
|
||||
m := policy.PolicyManager.MatchedPolicies(scope, token)
|
||||
m := policy.PolicyManager.MatchedPolicyNames(scope, token)
|
||||
fmt.Println("matched", scope, "policies:", m)
|
||||
}
|
||||
|
||||
|
||||
81
cmd/climc/shell/proxysettings.go
Normal file
81
cmd/climc/shell/proxysettings.go
Normal file
@@ -0,0 +1,81 @@
|
||||
// Copyright 2019 Yunion
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package shell
|
||||
|
||||
import (
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/options"
|
||||
)
|
||||
|
||||
func init() {
|
||||
R(&options.ProxySettingCreateOptions{}, "proxysetting-create", "Create proxysetting", func(s *mcclient.ClientSession, opts *options.ProxySettingCreateOptions) error {
|
||||
params, err := options.StructToParams(opts)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
proxysetting, err := modules.ProxySettings.Create(s, params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(proxysetting)
|
||||
return nil
|
||||
})
|
||||
R(&options.ProxySettingGetOptions{}, "proxysetting-show", "Show proxysetting", func(s *mcclient.ClientSession, opts *options.ProxySettingGetOptions) error {
|
||||
proxysetting, err := modules.ProxySettings.Get(s, opts.ID, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(proxysetting)
|
||||
return nil
|
||||
})
|
||||
R(&options.ProxySettingListOptions{}, "proxysetting-list", "List proxysettings", func(s *mcclient.ClientSession, opts *options.ProxySettingListOptions) error {
|
||||
params, err := options.ListStructToParams(opts)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
result, err := modules.ProxySettings.List(s, params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printList(result, modules.ProxySettings.GetColumns(s))
|
||||
return nil
|
||||
})
|
||||
R(&options.ProxySettingUpdateOptions{}, "proxysetting-update", "Update proxysetting", func(s *mcclient.ClientSession, opts *options.ProxySettingUpdateOptions) error {
|
||||
params, err := options.StructToParams(opts)
|
||||
proxysetting, err := modules.ProxySettings.Update(s, opts.ID, params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(proxysetting)
|
||||
return nil
|
||||
})
|
||||
R(&options.ProxySettingDeleteOptions{}, "proxysetting-delete", "Delete proxysetting", func(s *mcclient.ClientSession, opts *options.ProxySettingDeleteOptions) error {
|
||||
proxysetting, err := modules.ProxySettings.Delete(s, opts.ID, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(proxysetting)
|
||||
return nil
|
||||
})
|
||||
R(&options.ProxySettingTestOptions{}, "proxysetting-test", "Test proxysetting", func(s *mcclient.ClientSession, opts *options.ProxySettingTestOptions) error {
|
||||
proxysetting, err := modules.ProxySettings.PerformAction(s, opts.ID, "test", nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(proxysetting)
|
||||
return nil
|
||||
})
|
||||
}
|
||||
@@ -34,6 +34,7 @@ import (
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/options"
|
||||
"yunion.io/x/onecloud/pkg/util/fileutils2"
|
||||
"yunion.io/x/onecloud/pkg/util/ssh"
|
||||
)
|
||||
|
||||
func init() {
|
||||
@@ -178,6 +179,19 @@ func init() {
|
||||
},
|
||||
)
|
||||
|
||||
R(&options.ServerCreateOptions{}, "server-check-create-data", "Check create server data", func(s *mcclient.ClientSession, opts *options.ServerCreateOptions) error {
|
||||
params, err := opts.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
server, err := modules.Servers.PerformClassAction(s, "check-create-data", params.JSON(params))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(server)
|
||||
return nil
|
||||
})
|
||||
|
||||
R(&options.ServerCreateOptions{}, "server-create", "Create a server", func(s *mcclient.ClientSession, opts *options.ServerCreateOptions) error {
|
||||
params, err := opts.Params()
|
||||
if err != nil {
|
||||
@@ -974,6 +988,7 @@ func init() {
|
||||
config.Hosts[i].HostIp = yamlConfig.Hosts[i].HostIp
|
||||
config.Hosts[i].XmlFilePath = yamlConfig.Hosts[i].XmlFilePath
|
||||
config.Hosts[i].Servers = make([]compute.SLibvirtServerConfig, len(yamlConfig.Hosts[i].Servers))
|
||||
config.Hosts[i].MonitorPath = yamlConfig.Hosts[i].MonitorPath
|
||||
for j := 0; j < len(yamlConfig.Hosts[i].Servers); j++ {
|
||||
config.Hosts[i].Servers[j].MacIp = make(map[string]string)
|
||||
mac := yamlConfig.Hosts[i].Servers[j].Mac
|
||||
@@ -996,11 +1011,11 @@ func init() {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
for i := 0; i < len(params); i++ {
|
||||
val := jsonutils.NewDict()
|
||||
val.Set(modules.Servers.KeywordPlural, params[i])
|
||||
params[i] = val
|
||||
}
|
||||
//for i := 0; i < len(params); i++ {
|
||||
// val := jsonutils.NewDict()
|
||||
// val.Set(modules.Servers.KeywordPlural, params[i])
|
||||
// params[i] = val
|
||||
//}
|
||||
|
||||
results := modules.Servers.BatchPerformClassAction(s, "import-from-libvirt", params)
|
||||
printBatchResults(results, modules.Servers.GetColumns(s))
|
||||
@@ -1218,4 +1233,77 @@ func init() {
|
||||
}
|
||||
return nil
|
||||
})
|
||||
|
||||
R(&options.ServerSSHLoginOptions{}, "server-ssh", "Use SSH login a server", func(s *mcclient.ClientSession, opts *options.ServerSSHLoginOptions) error {
|
||||
srv, err := modules.Servers.Get(s, opts.ID, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
srvid, err := srv.GetString("id")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
address := make([]string, 0)
|
||||
nics, err := srv.GetArray("nics")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
for _, nic := range nics {
|
||||
if addr, err := nic.GetString("ip_addr"); err == nil {
|
||||
address = append(address, addr)
|
||||
}
|
||||
}
|
||||
if len(address) == 0 {
|
||||
return fmt.Errorf("Not found ip address from server %s", opts.ID)
|
||||
}
|
||||
|
||||
params := jsonutils.NewDict()
|
||||
if len(opts.Key) > 0 {
|
||||
privateKey, e := ioutil.ReadFile(opts.Key)
|
||||
if e != nil {
|
||||
return e
|
||||
}
|
||||
params.Add(jsonutils.NewString(string(privateKey)), "private_key")
|
||||
}
|
||||
|
||||
i, e := modules.Servers.GetLoginInfo(s, srvid, params)
|
||||
if e != nil {
|
||||
return e
|
||||
}
|
||||
passwd, err := i.GetString("password")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if opts.Password != "" {
|
||||
passwd = opts.Password
|
||||
}
|
||||
user, err := i.GetString("username")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if opts.User != "" {
|
||||
user = opts.User
|
||||
}
|
||||
|
||||
host := address[0]
|
||||
if opts.Host != "" {
|
||||
host = opts.Host
|
||||
}
|
||||
port := 22
|
||||
if opts.Port != 22 {
|
||||
port = opts.Port
|
||||
}
|
||||
|
||||
sshCli, err := ssh.NewClient(host, port, user, passwd, "")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
log.Infof("ssh %s:%d", host, port)
|
||||
if err := sshCli.RunTerminal(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
@@ -84,8 +84,11 @@ func newClient(options *BaseOptions) (*ctyun.SRegion, error) {
|
||||
return nil, fmt.Errorf("Missing secret")
|
||||
}
|
||||
|
||||
cli, err := ctyun.NewSCtyunClient("", "", "",
|
||||
options.AccessKey, options.Secret, options.Debug)
|
||||
cli, err := ctyun.NewSCtyunClient(
|
||||
ctyun.NewSCtyunClientConfig(
|
||||
options.AccessKey, options.Secret,
|
||||
).Debug(options.Debug),
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -88,7 +88,14 @@ func newClient(options *BaseOptions) (*esxi.SESXiClient, error) {
|
||||
return nil, fmt.Errorf("Missing password")
|
||||
}
|
||||
|
||||
return esxi.NewESXiClient2("", "", options.Host, options.Port, options.Account, options.Password, false)
|
||||
return esxi.NewESXiClient2(
|
||||
esxi.NewESXiClientConfig(
|
||||
options.Host,
|
||||
options.Port,
|
||||
options.Account,
|
||||
options.Password,
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
func main() {
|
||||
|
||||
@@ -94,7 +94,14 @@ func newClient(options *BaseOptions) (*google.SRegion, error) {
|
||||
return nil, fmt.Errorf("Missing ProjectID")
|
||||
}
|
||||
|
||||
cli, err := google.NewGoogleClient("", "", options.ProjectID, options.ClientEmail, options.PrivateKeyID, options.PrivateKey, options.Debug)
|
||||
cli, err := google.NewGoogleClient(
|
||||
google.NewGoogleClientConfig(
|
||||
options.ProjectID,
|
||||
options.ClientEmail,
|
||||
options.PrivateKeyID,
|
||||
options.PrivateKey,
|
||||
).Debug(options.Debug),
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -86,9 +86,14 @@ func newClient(options *BaseOptions) (*huawei.SRegion, error) {
|
||||
return nil, fmt.Errorf("Missing secret")
|
||||
}
|
||||
|
||||
cli, err := huawei.NewHuaweiClient("", "", options.CloudEnv,
|
||||
options.AccessKey, options.Secret, options.ProjectId,
|
||||
options.Debug)
|
||||
cli, err := huawei.NewHuaweiClient(
|
||||
huawei.NewHuaweiClientConfig(
|
||||
options.CloudEnv,
|
||||
options.AccessKey,
|
||||
options.Secret,
|
||||
options.ProjectId,
|
||||
).Debug(options.Debug),
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -93,7 +93,18 @@ func newClient(options *BaseOptions) (*openstack.SRegion, error) {
|
||||
return nil, fmt.Errorf("Missing Password")
|
||||
}
|
||||
|
||||
cli, err := openstack.NewOpenStackClient("", "", options.AuthURL, options.Username, options.Password, options.Project, options.EndpointType, options.DomainName, options.ProjectDomain, options.Debug)
|
||||
cli, err := openstack.NewOpenStackClient(
|
||||
openstack.NewOpenstackClientConfig(
|
||||
options.AuthURL,
|
||||
options.Username,
|
||||
options.Password,
|
||||
options.Project,
|
||||
options.ProjectDomain,
|
||||
).
|
||||
EndpointType(options.EndpointType).
|
||||
DomainName(options.DomainName).
|
||||
Debug(options.Debug),
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -85,11 +85,12 @@ func newClient(options *BaseOptions) (*qcloud.SRegion, error) {
|
||||
return nil, fmt.Errorf("Missing SecretID")
|
||||
}
|
||||
|
||||
if cli, err := qcloud.NewQcloudClient("", "",
|
||||
options.SecretID,
|
||||
options.SecretKey,
|
||||
options.AppID,
|
||||
options.Debug); err != nil {
|
||||
if cli, err := qcloud.NewQcloudClient(
|
||||
qcloud.NewQcloudClientConfig(
|
||||
options.SecretID,
|
||||
options.SecretKey,
|
||||
).AppId(options.AppID).Debug(options.Debug),
|
||||
); err != nil {
|
||||
return nil, err
|
||||
} else if region := cli.GetRegion(options.RegionId); region == nil {
|
||||
return nil, fmt.Errorf("No such region %s", options.RegionId)
|
||||
|
||||
@@ -94,11 +94,23 @@ func newClient(options *BaseOptions) (cloudprovider.ICloudRegion, error) {
|
||||
}
|
||||
|
||||
if options.Backend == api.CLOUD_PROVIDER_CEPH {
|
||||
return ceph.NewCephRados("", "", options.AccessUrl, options.AccessKey, options.Secret, options.Debug)
|
||||
return ceph.NewCephRados(
|
||||
objectstore.NewObjectStoreClientConfig(
|
||||
options.AccessUrl, options.AccessKey, options.Secret,
|
||||
).Debug(options.Debug),
|
||||
)
|
||||
} else if options.Backend == api.CLOUD_PROVIDER_XSKY {
|
||||
return xsky.NewXskyClient("", "", options.AccessUrl, options.AccessKey, options.Secret, options.Debug)
|
||||
return xsky.NewXskyClient(
|
||||
objectstore.NewObjectStoreClientConfig(
|
||||
options.AccessUrl, options.AccessKey, options.Secret,
|
||||
).Debug(options.Debug),
|
||||
)
|
||||
}
|
||||
return objectstore.NewObjectStoreClient("", "", options.AccessUrl, options.AccessKey, options.Secret, options.Debug)
|
||||
return objectstore.NewObjectStoreClient(
|
||||
objectstore.NewObjectStoreClientConfig(
|
||||
options.AccessUrl, options.AccessKey, options.Secret,
|
||||
).Debug(options.Debug),
|
||||
)
|
||||
}
|
||||
|
||||
func main() {
|
||||
|
||||
@@ -86,11 +86,12 @@ func newClient(options *BaseOptions) (*ucloud.SRegion, error) {
|
||||
return nil, fmt.Errorf("Missing secret")
|
||||
}
|
||||
|
||||
cli, err := ucloud.NewUcloudClient("", "",
|
||||
options.AccessKey,
|
||||
options.Secret,
|
||||
options.ProjectId,
|
||||
options.Debug)
|
||||
cli, err := ucloud.NewUcloudClient(
|
||||
ucloud.NewUcloudClientConfig(
|
||||
options.AccessKey,
|
||||
options.Secret,
|
||||
).ProjectId(options.ProjectId).Debug(options.Debug),
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -89,7 +89,13 @@ func newClient(options *BaseOptions) (*zstack.SRegion, error) {
|
||||
return nil, fmt.Errorf("Missing Password")
|
||||
}
|
||||
|
||||
cli, err := zstack.NewZStackClient("", "", options.AuthURL, options.Username, options.Password, options.Debug)
|
||||
cli, err := zstack.NewZStackClient(
|
||||
zstack.NewZstackClientConfig(
|
||||
options.AuthURL,
|
||||
options.Username,
|
||||
options.Password,
|
||||
).Debug(options.Debug),
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
89
go.mod
89
go.mod
@@ -3,10 +3,10 @@ module yunion.io/x/onecloud
|
||||
go 1.12
|
||||
|
||||
require (
|
||||
cloud.google.com/go v0.38.0
|
||||
github.com/360EntSecGroup-Skylar/excelize v1.4.0
|
||||
github.com/Azure/azure-sdk-for-go v36.1.0+incompatible
|
||||
github.com/Azure/go-autorest v10.15.5+incompatible
|
||||
github.com/Azure/go-autorest/autorest v0.9.3
|
||||
github.com/Azure/go-autorest/autorest/azure/auth v0.4.2
|
||||
github.com/DataDog/dd-trace-go v0.6.1 // indirect
|
||||
github.com/DataDog/zstd v1.3.4 // indirect
|
||||
github.com/Microsoft/azure-vhd-utils v0.0.0-20181115010904-44cbada2ece3
|
||||
@@ -29,23 +29,18 @@ require (
|
||||
github.com/c-bata/go-prompt v0.2.1
|
||||
github.com/ceph/go-ceph v0.0.0-20181217221554-e32f9f0f2e94
|
||||
github.com/coredns/coredns v1.3.0
|
||||
github.com/coreos/go-semver v0.3.0 // indirect
|
||||
github.com/coreos/go-systemd v0.0.0-20190620071333-e64a0ec8b42a // indirect
|
||||
github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f // indirect
|
||||
github.com/denisenkom/go-mssqldb v0.0.0-20190806190131-db2462fef53b // indirect
|
||||
github.com/dimchansky/utfbom v1.1.0 // indirect
|
||||
github.com/dnaeon/go-vcr v1.0.1 // indirect
|
||||
github.com/dnstap/golang-dnstap v0.0.0-20170829151710-2cf77a2b5e11 // indirect
|
||||
github.com/edsrzf/mmap-go v1.0.0 // indirect
|
||||
github.com/erikstmartin/go-testdb v0.0.0-20160219214506-8d10e4a1bae5 // indirect
|
||||
github.com/farsightsec/golang-framestream v0.0.0-20181102145529-8a0cb8ba8710 // indirect
|
||||
github.com/fatih/color v1.7.0
|
||||
github.com/fernet/fernet-go v0.0.0-20180830025343-9eac43b88a5e
|
||||
github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568 // indirect
|
||||
github.com/fsnotify/fsnotify v1.4.7
|
||||
github.com/ghodss/yaml v1.0.0
|
||||
github.com/gin-contrib/sse v0.0.0-20170109093832-22d885f9ecc7 // indirect
|
||||
github.com/gin-gonic/gin v1.3.0
|
||||
github.com/gin-gonic/gin v1.5.0
|
||||
github.com/glycerine/go-unsnap-stream v0.0.0-20181221182339-f9677308dec2 // indirect
|
||||
github.com/go-logfmt/logfmt v0.4.0 // indirect
|
||||
github.com/go-ole/go-ole v1.2.2 // indirect
|
||||
@@ -58,14 +53,12 @@ require (
|
||||
github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef // indirect
|
||||
github.com/golang/protobuf v1.3.2
|
||||
github.com/google/gopacket v1.1.17
|
||||
github.com/google/uuid v1.1.0 // indirect
|
||||
github.com/googleapis/gnostic v0.2.0 // indirect
|
||||
github.com/googollee/go-engine.io v0.0.0-20180829091931-e2f255711dcb // indirect
|
||||
github.com/googollee/go-socket.io v0.0.0-20181214084611-0ad7206c347a
|
||||
github.com/gorilla/mux v1.6.2
|
||||
github.com/gorilla/mux v1.7.0
|
||||
github.com/gorilla/websocket v1.4.0
|
||||
github.com/gosuri/uitable v0.0.0-20160404203958-36ee7e946282
|
||||
github.com/gregjones/httpcache v0.0.0-20181110185634-c63ab54fda8f // indirect
|
||||
github.com/grpc-ecosystem/grpc-opentracing v0.0.0-20180507213350-8e809c8a8645 // indirect
|
||||
github.com/hako/durafmt v0.0.0-20180520121703-7b7ae1e72ead
|
||||
github.com/huandu/xstrings v1.2.0 // indirect
|
||||
@@ -74,7 +67,7 @@ require (
|
||||
github.com/jinzhu/inflection v1.0.0 // indirect
|
||||
github.com/jinzhu/now v1.0.1 // indirect
|
||||
github.com/koding/websocketproxy v0.0.0-20181220232114-7ed82d81a28c
|
||||
github.com/kr/pty v1.1.3
|
||||
github.com/kr/pty v1.1.5
|
||||
github.com/lib/pq v1.2.0 // indirect
|
||||
github.com/libvirt/libvirt-go-xml v5.2.0+incompatible
|
||||
github.com/mattn/go-runewidth v0.0.4 // indirect
|
||||
@@ -84,7 +77,7 @@ require (
|
||||
github.com/mdlayher/ethernet v0.0.0-20190606142754-0394541c37b7
|
||||
github.com/mdlayher/raw v0.0.0-20190606144222-a54781e5f38f
|
||||
github.com/mholt/caddy v0.10.11
|
||||
github.com/miekg/dns v1.1.1
|
||||
github.com/miekg/dns v1.1.4
|
||||
github.com/minio/minio-go v6.0.14+incompatible
|
||||
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect
|
||||
github.com/moul/http2curl v1.0.0
|
||||
@@ -92,61 +85,81 @@ require (
|
||||
github.com/opentracing-contrib/go-observer v0.0.0-20170622124052-a52f23424492 // indirect
|
||||
github.com/opentracing/opentracing-go v1.0.2 // indirect
|
||||
github.com/openzipkin/zipkin-go-opentracing v0.3.4 // indirect
|
||||
github.com/peterbourgon/diskv v2.0.1+incompatible // indirect
|
||||
github.com/pierrec/lz4 v2.0.5+incompatible
|
||||
github.com/pkg/errors v0.8.1
|
||||
github.com/pkg/term v0.0.0-20181116001808-27bbf2edb814 // indirect
|
||||
github.com/pquerna/otp v1.2.0
|
||||
github.com/satori/go.uuid v1.2.0 // indirect
|
||||
github.com/serialx/hashring v0.0.0-20180504054112-49a4782e9908
|
||||
github.com/shirou/gopsutil v2.18.10+incompatible
|
||||
github.com/shirou/w32 v0.0.0-20160930032740-bb4de0191aa4 // indirect
|
||||
github.com/skip2/go-qrcode v0.0.0-20190110000554-dc11ecdae0a9
|
||||
github.com/smartystreets/goconvey v1.6.4
|
||||
github.com/spaolacci/murmur3 v1.1.0 // indirect
|
||||
github.com/spf13/pflag v1.0.3 // indirect
|
||||
github.com/stretchr/testify v1.4.0
|
||||
github.com/tencentcloud/tencentcloud-sdk-go v0.0.0-20181108132626-805d01dd0e2e
|
||||
github.com/tencentcloud/tencentcloud-sdk-go v3.0.135+incompatible
|
||||
github.com/tencentyun/cos-go-sdk-v5 v0.0.0-20191108095731-8ca4b370cde4
|
||||
github.com/tinylib/msgp v1.1.0 // indirect
|
||||
github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5 // indirect
|
||||
github.com/tredoe/osutil v0.0.0-20161130133508-7d3ee1afa71c
|
||||
github.com/ugorji/go v0.0.0-20161130061742-9c7f9b7a2bc3 // indirect
|
||||
github.com/vishvananda/netlink v1.0.0
|
||||
github.com/vishvananda/netns v0.0.0-20191106174202-0a2b9b5464df // indirect
|
||||
github.com/vmihailenco/msgpack v4.0.4+incompatible
|
||||
github.com/vmware/govmomi v0.19.0
|
||||
github.com/vmware/govmomi v0.20.1
|
||||
go.etcd.io/etcd v0.5.0-alpha.5.0.20191023171146-3cf2f69b5738
|
||||
go.uber.org/atomic v1.4.0 // indirect
|
||||
golang.org/x/crypto v0.0.0-20191002192127-34f69633bfdc
|
||||
golang.org/x/net v0.0.0-20191007182048-72f939374954
|
||||
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45
|
||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58
|
||||
golang.org/x/sys v0.0.0-20191008105621-543471e840be
|
||||
golang.org/x/crypto v0.0.0-20191206172530-e9b2fee46413
|
||||
golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553
|
||||
golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6
|
||||
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e
|
||||
golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543
|
||||
golang.zx2c4.com/wireguard/wgctrl v0.0.0-20191008142428-8d021180e987
|
||||
google.golang.org/api v0.13.0 // indirect
|
||||
google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873
|
||||
google.golang.org/grpc v1.23.1
|
||||
gopkg.in/asn1-ber.v1 v1.0.0-20181015200546-f715ec2f112d // indirect
|
||||
gopkg.in/go-playground/assert.v1 v1.2.1 // indirect
|
||||
gopkg.in/go-playground/validator.v8 v8.18.2 // indirect
|
||||
gopkg.in/inf.v0 v0.9.1 // indirect
|
||||
gopkg.in/ini.v1 v1.44.0 // indirect
|
||||
gopkg.in/ldap.v3 v3.0.3
|
||||
gopkg.in/yaml.v2 v2.2.2
|
||||
k8s.io/api v0.0.0-20181004124137-fd83cbc87e76
|
||||
k8s.io/apimachinery v0.0.0-20181215012845-4d029f033399
|
||||
gopkg.in/yaml.v2 v2.2.8
|
||||
k8s.io/api v0.17.3
|
||||
k8s.io/apimachinery v0.17.3
|
||||
k8s.io/client-go v9.0.0+incompatible
|
||||
k8s.io/klog v0.1.0 // indirect
|
||||
k8s.io/kubernetes v1.12.3
|
||||
k8s.io/cluster-bootstrap v0.17.3
|
||||
k8s.io/kubernetes v1.16.0
|
||||
yunion.io/x/executor v0.0.0-20200227030256-a18417815e74
|
||||
yunion.io/x/jsonutils v0.0.0-20200113074440-9297fd00ba07
|
||||
yunion.io/x/log v0.0.0-20190629062853-9f6483a7103d
|
||||
yunion.io/x/pkg v0.0.0-20200302034534-fdf44d54b070
|
||||
yunion.io/x/jsonutils v0.0.0-20200415132054-2bf8a5e94501
|
||||
yunion.io/x/log v0.0.0-20200313080802-57a4ce5966b3
|
||||
yunion.io/x/pkg v0.0.0-20200516092703-0a53bc9270aa
|
||||
yunion.io/x/s3cli v0.0.0-20190917004522-13ac36d8687e
|
||||
yunion.io/x/sqlchemy v0.0.0-20200221103553-6a98f7f8ab92
|
||||
yunion.io/x/structarg v0.0.0-20190809075558-115bed041de3
|
||||
yunion.io/x/sqlchemy v0.0.0-20200312002602-1177cd8fbc57
|
||||
yunion.io/x/structarg v0.0.0-20200423163001-168d0687be7e
|
||||
)
|
||||
|
||||
replace github.com/ceph/go-ceph v0.0.0-20181217221554-e32f9f0f2e94 => github.com/yunionio/go-ceph v0.0.0-20190912101231-6f05a06b3859
|
||||
replace (
|
||||
github.com/ceph/go-ceph v0.0.0-20181217221554-e32f9f0f2e94 => github.com/yunionio/go-ceph v0.0.0-20190912101231-6f05a06b3859
|
||||
|
||||
k8s.io/api => k8s.io/api v0.0.0-20190918155943-95b840bb6a1f
|
||||
k8s.io/apiextensions-apiserver => k8s.io/apiextensions-apiserver v0.0.0-20190918161926-8f644eb6e783
|
||||
k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20190913080033-27d36303b655
|
||||
k8s.io/apiserver => k8s.io/apiserver v0.0.0-20190918160949-bfa5e2e684ad
|
||||
k8s.io/cli-runtime => k8s.io/cli-runtime v0.0.0-20190918162238-f783a3654da8
|
||||
k8s.io/client-go => k8s.io/client-go v0.0.0-20190918160344-1fbdaa4c8d90
|
||||
k8s.io/cloud-provider => k8s.io/cloud-provider v0.0.0-20190918163234-a9c1f33e9fb9
|
||||
k8s.io/cluster-bootstrap => k8s.io/cluster-bootstrap v0.0.0-20190918163108-da9fdfce26bb
|
||||
k8s.io/code-generator => k8s.io/code-generator v0.0.0-20190912054826-cd179ad6a269
|
||||
k8s.io/component-base => k8s.io/component-base v0.0.0-20190918160511-547f6c5d7090
|
||||
k8s.io/cri-api => k8s.io/cri-api v0.0.0-20190828162817-608eb1dad4ac
|
||||
k8s.io/csi-translation-lib => k8s.io/csi-translation-lib v0.0.0-20190918163402-db86a8c7bb21
|
||||
k8s.io/kube-aggregator => k8s.io/kube-aggregator v0.0.0-20190918161219-8c8f079fddc3
|
||||
k8s.io/kube-controller-manager => k8s.io/kube-controller-manager v0.0.0-20190918162944-7a93a0ddadd8
|
||||
k8s.io/kube-proxy => k8s.io/kube-proxy v0.0.0-20190918162534-de037b596c1e
|
||||
k8s.io/kube-scheduler => k8s.io/kube-scheduler v0.0.0-20190918162820-3b5c1246eb18
|
||||
k8s.io/kubectl => k8s.io/kubectl v0.0.0-20190918164019-21692a0861df
|
||||
k8s.io/kubelet => k8s.io/kubelet v0.0.0-20190918162654-250a1838aa2c
|
||||
k8s.io/legacy-cloud-providers => k8s.io/legacy-cloud-providers v0.0.0-20190918163543-cfa506e53441
|
||||
k8s.io/metrics => k8s.io/metrics v0.0.0-20190918162108-227c654b2546
|
||||
k8s.io/node-api => k8s.io/node-api v0.0.0-20190918163711-2299658ad911
|
||||
k8s.io/sample-apiserver => k8s.io/sample-apiserver v0.0.0-20190918161442-d4c9c65c82af
|
||||
k8s.io/sample-cli-plugin => k8s.io/sample-cli-plugin v0.0.0-20190918162410-e45c26d066f2
|
||||
k8s.io/sample-controller => k8s.io/sample-controller v0.0.0-20190918161628-92eb3cb7496c
|
||||
)
|
||||
|
||||
@@ -29,6 +29,7 @@ import (
|
||||
"yunion.io/x/onecloud/pkg/apigateway/constants"
|
||||
"yunion.io/x/onecloud/pkg/apigateway/options"
|
||||
policytool "yunion.io/x/onecloud/pkg/apigateway/policy"
|
||||
"yunion.io/x/onecloud/pkg/apis/compute"
|
||||
"yunion.io/x/onecloud/pkg/appctx"
|
||||
"yunion.io/x/onecloud/pkg/appsrv"
|
||||
"yunion.io/x/onecloud/pkg/cloudcommon/policy"
|
||||
@@ -569,6 +570,7 @@ func (this *projectRoles) add(roleId, roleName string) {
|
||||
|
||||
func (this *projectRoles) getToken(scope rbacutils.TRbacScope, user, userId, domain, domainId string, ip string) mcclient.TokenCredential {
|
||||
return &mcclient.SSimpleToken{
|
||||
Token: "faketoken",
|
||||
Domain: domain,
|
||||
DomainId: domainId,
|
||||
User: user,
|
||||
@@ -608,12 +610,12 @@ func (this *projectRoles) json(user, userId, domain, domainId string, ip string)
|
||||
}
|
||||
obj.Add(roles, "roles")
|
||||
for _, scope := range []rbacutils.TRbacScope{
|
||||
rbacutils.ScopeSystem,
|
||||
rbacutils.ScopeDomain,
|
||||
rbacutils.ScopeProject,
|
||||
rbacutils.ScopeDomain,
|
||||
rbacutils.ScopeSystem,
|
||||
} {
|
||||
token := this.getToken(scope, user, userId, domain, domainId, ip)
|
||||
matches := policy.PolicyManager.MatchedPolicies(scope, token)
|
||||
matches := policy.PolicyManager.MatchedPolicyNames(scope, token)
|
||||
obj.Add(jsonutils.NewStringArray(matches), fmt.Sprintf("%s_policies", scope))
|
||||
if len(matches) > 0 {
|
||||
obj.Add(jsonutils.JSONTrue, fmt.Sprintf("%s_capable", scope))
|
||||
@@ -646,8 +648,11 @@ func getUserAuthCookie(ctx context.Context, s *mcclient.ClientSession, token mcc
|
||||
}
|
||||
|
||||
func getLBAgentInfo(s *mcclient.ClientSession, token mcclient.TokenCredential) (*jsonutils.JSONDict, error) {
|
||||
|
||||
lbagents, err := modules.LoadbalancerAgents.List(s, nil)
|
||||
params := jsonutils.NewDict()
|
||||
params.Add(jsonutils.NewString("hb_last_seen.isnotempty()"), "filter.0")
|
||||
params.Add(jsonutils.NewInt(1), "limit")
|
||||
params.Add(jsonutils.JSONFalse, "details")
|
||||
lbagents, err := modules.LoadbalancerAgents.List(s, params)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "user %s get lbagent", token.GetUserName())
|
||||
}
|
||||
@@ -665,6 +670,7 @@ func getLBAgentInfo(s *mcclient.ClientSession, token mcclient.TokenCredential) (
|
||||
}
|
||||
|
||||
func getUserInfo(ctx context.Context, s *mcclient.ClientSession, token mcclient.TokenCredential, req *http.Request) (*jsonutils.JSONDict, error) {
|
||||
log.Infof("getUserInfo modules.UsersV3.Get")
|
||||
usr, err := modules.UsersV3.Get(s, token.GetUserId(), nil)
|
||||
if err != nil {
|
||||
log.Errorf("modules.UsersV3.Get fail %s", err)
|
||||
@@ -693,6 +699,7 @@ func getUserInfo(ctx context.Context, s *mcclient.ClientSession, token mcclient.
|
||||
data.Add(jsonutils.NewString(token.GetProjectDomain()), "projectDomain")
|
||||
data.Add(jsonutils.NewString(token.GetProjectDomainId()), "projectDomainId")
|
||||
|
||||
log.Infof("getUserInfo modules.RoleAssignments.List")
|
||||
query := jsonutils.NewDict()
|
||||
query.Add(jsonutils.JSONNull, "effective")
|
||||
query.Add(jsonutils.JSONNull, "include_names")
|
||||
@@ -735,7 +742,7 @@ func getUserInfo(ctx context.Context, s *mcclient.ClientSession, token mcclient.
|
||||
rbacutils.ScopeDomain,
|
||||
rbacutils.ScopeProject,
|
||||
} {
|
||||
p := policy.PolicyManager.MatchedPolicies(scope, token)
|
||||
p := policy.PolicyManager.MatchedPolicyNames(scope, token)
|
||||
data.Add(jsonutils.NewStringArray(p), fmt.Sprintf("%s_policies", scope))
|
||||
if scope == rbacutils.ScopeSystem {
|
||||
data.Add(jsonutils.NewStringArray(p), "admin_policies")
|
||||
@@ -772,6 +779,7 @@ func getUserInfo(ctx context.Context, s *mcclient.ClientSession, token mcclient.
|
||||
log.Errorf("fail to find services????: %#v %s", adminToken, curReg)
|
||||
}
|
||||
|
||||
log.Infof("getUserInfo getLBAgentInfo")
|
||||
lb, err := getLBAgentInfo(s, adminToken)
|
||||
if err != nil {
|
||||
log.Errorf("getLBAgentInfo fail %s", err)
|
||||
@@ -788,13 +796,23 @@ func getUserInfo(ctx context.Context, s *mcclient.ClientSession, token mcclient.
|
||||
}
|
||||
}
|
||||
|
||||
log.Infof("getUserInfo modules.Hosts.Get")
|
||||
s2 := auth.GetSession(ctx, token, FetchRegion(req), "v2")
|
||||
cap, err := modules.Capabilities.List(s2, nil)
|
||||
params := jsonutils.NewDict()
|
||||
params.Add(jsonutils.NewString("host_type"), "field")
|
||||
params.Add(jsonutils.NewString("system"), "scope")
|
||||
params.Add(jsonutils.JSONTrue, "usable")
|
||||
params.Add(jsonutils.JSONTrue, "show_emulated")
|
||||
cap, err := modules.Hosts.Get(s2, "distinct-field", params)
|
||||
if err != nil {
|
||||
log.Errorf("modules.Capabilities.List fail %s", err)
|
||||
log.Errorf("modules.Servers.Get distinct-field fail %s", err)
|
||||
} else {
|
||||
hypervisors, _ := cap.Data[0].Get("hypervisors")
|
||||
data.Add(hypervisors, "hypervisors")
|
||||
hostTypes, _ := jsonutils.GetStringArray(cap, "host_type")
|
||||
hypervisors := make([]string, len(hostTypes))
|
||||
for i, hostType := range hostTypes {
|
||||
hypervisors[i] = compute.HOSTTYPE_HYPERVISOR[hostType]
|
||||
}
|
||||
data.Add(jsonutils.NewStringArray(hypervisors), "hypervisors")
|
||||
}
|
||||
|
||||
data.Add(menus, "menus")
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2018, OpenCensus Authors
|
||||
// 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.
|
||||
@@ -12,14 +12,8 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
// +build !go1.11
|
||||
|
||||
package trace
|
||||
package handler
|
||||
|
||||
import (
|
||||
"context"
|
||||
_ "yunion.io/x/onecloud/pkg/mcclient/modules/cloudnet"
|
||||
)
|
||||
|
||||
func startExecutionTracerTask(ctx context.Context, name string) (context.Context, func()) {
|
||||
return ctx, func() {}
|
||||
}
|
||||
@@ -606,28 +606,45 @@ func (f *ResourceHandlers) patchJointHandler(ctx context.Context, w http.Respons
|
||||
}
|
||||
}
|
||||
|
||||
// batch update Joint
|
||||
// * batch update Joint
|
||||
// * put specific
|
||||
// /<resname>/<resid>/<resname2>
|
||||
// /<resname>/<resid>/<spec>
|
||||
func (f *ResourceHandlers) batchUpdateJointHandler(ctx context.Context, w http.ResponseWriter, r *http.Request) {
|
||||
req := newRequest(ctx, w, r).WithMod1().WithMod2()
|
||||
req := newRequest(ctx, w, r).WithMod1()
|
||||
if err := req.Error(); err != nil {
|
||||
httperrors.GeneralServerError(w, err)
|
||||
return
|
||||
}
|
||||
session := req.Session()
|
||||
module := req.Mod1()
|
||||
module2 := req.Mod2()
|
||||
body := req.Body()
|
||||
query := req.Query()
|
||||
|
||||
idlist := fetchIdList(query, w)
|
||||
if idlist == nil {
|
||||
if idlist, _ := query.GetArray("id"); len(idlist) == 0 {
|
||||
// do put specific
|
||||
spec := req.ResName2()
|
||||
obj, e := module.PutSpecific(session, req.ResID(), spec, query, body)
|
||||
if e != nil {
|
||||
httperrors.GeneralServerError(w, e)
|
||||
} else {
|
||||
appsrv.SendJSON(w, obj)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
req = req.WithMod2()
|
||||
if err := req.Error(); err != nil {
|
||||
httperrors.GeneralServerError(w, err)
|
||||
return
|
||||
}
|
||||
module2 := req.Mod2()
|
||||
jmod, e := modulebase.GetJointModule2(session, module, module2)
|
||||
if e != nil { // update joint
|
||||
httperrors.GeneralServerError(w, e)
|
||||
return
|
||||
}
|
||||
idlist := fetchIdList(query, w)
|
||||
ret := jmod.BatchUpdate(session, req.ResID(), idlist, query, body)
|
||||
w.WriteHeader(207)
|
||||
appsrv.SendJSON(w, modulebase.SubmitResults2JSON(ret))
|
||||
|
||||
@@ -29,7 +29,7 @@ type GatewayOptions struct {
|
||||
|
||||
SqlitePath string `help:"sqlite db path" default:"/etc/yunion/data/yunionapi.db"`
|
||||
|
||||
common_options.CommonOptions
|
||||
common_options.CommonOptions `"request_worker_count->default":"32"`
|
||||
}
|
||||
|
||||
var (
|
||||
@@ -40,9 +40,10 @@ func OnOptionsChange(oldO, newO interface{}) bool {
|
||||
oldOpts := oldO.(*GatewayOptions)
|
||||
newOpts := newO.(*GatewayOptions)
|
||||
|
||||
changed := false
|
||||
if common_options.OnCommonOptionsChange(&oldOpts.CommonOptions, &newOpts.CommonOptions) {
|
||||
return true
|
||||
changed = true
|
||||
}
|
||||
|
||||
return false
|
||||
return changed
|
||||
}
|
||||
|
||||
1
pkg/apis/cloudcommon/proxy/doc.go
Normal file
1
pkg/apis/cloudcommon/proxy/doc.go
Normal file
@@ -0,0 +1 @@
|
||||
package proxy // import "yunion.io/x/onecloud/pkg/apis/cloudcommon/proxy"
|
||||
55
pkg/apis/cloudcommon/proxy/proxy.go
Normal file
55
pkg/apis/cloudcommon/proxy/proxy.go
Normal file
@@ -0,0 +1,55 @@
|
||||
package proxy
|
||||
|
||||
import (
|
||||
"yunion.io/x/jsonutils"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/apis"
|
||||
)
|
||||
|
||||
const (
|
||||
ProxySettingId_DIRECT = "DIRECT"
|
||||
)
|
||||
|
||||
type ProxySettingCreateInput struct {
|
||||
apis.StandaloneResourceCreateInput
|
||||
|
||||
ProxySetting
|
||||
}
|
||||
|
||||
type ProxySettingUpdateInput struct {
|
||||
// 资源名称
|
||||
Name string `json:"name"`
|
||||
// 资源描述
|
||||
Description string `json:"description"`
|
||||
|
||||
ProxySetting
|
||||
}
|
||||
|
||||
// String implements ISerializable interface
|
||||
func (ps *SProxySetting) String() string {
|
||||
return jsonutils.Marshal(ps).String()
|
||||
}
|
||||
|
||||
// IsZero implements ISerializable interface
|
||||
func (ps *SProxySetting) IsZero() bool {
|
||||
if ps.HTTPProxy == "" &&
|
||||
ps.HTTPSProxy == "" &&
|
||||
ps.NoProxy == "" {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
type ProxySettingResourceInput struct {
|
||||
// 代理配置
|
||||
ProxySetting string `json:"proxy_setting"`
|
||||
|
||||
// swagger:ignore
|
||||
// Deprecated
|
||||
ProxySettingId string `json:"proxy_setting_id" "yunion:deprecated-by":"proxy_setting"`
|
||||
}
|
||||
|
||||
type ProxySettingTestInput struct {
|
||||
HttpProxy string
|
||||
HttpsProxy string
|
||||
}
|
||||
111
pkg/apis/cloudcommon/proxy/setting.go
Normal file
111
pkg/apis/cloudcommon/proxy/setting.go
Normal file
@@ -0,0 +1,111 @@
|
||||
package proxy
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net"
|
||||
"net/url"
|
||||
"strings"
|
||||
|
||||
"yunion.io/x/pkg/errors"
|
||||
)
|
||||
|
||||
type ProxySetting struct {
|
||||
HttpProxy string
|
||||
HttpsProxy string
|
||||
NoProxy string
|
||||
}
|
||||
|
||||
func (v *ProxySetting) Sanitize() error {
|
||||
v.HttpProxy = strings.TrimSpace(v.HttpProxy)
|
||||
if u, err := parseProxy(v.HttpProxy); err != nil {
|
||||
return errors.Wrap(err, "invalid https_proxy url")
|
||||
} else if u != nil {
|
||||
v.HttpProxy = u.String()
|
||||
}
|
||||
|
||||
v.HttpsProxy = strings.TrimSpace(v.HttpsProxy)
|
||||
if u, err := parseProxy(v.HttpsProxy); err != nil {
|
||||
return errors.Wrap(err, "invalid http_proxy url")
|
||||
} else if u != nil {
|
||||
v.HttpsProxy = u.String()
|
||||
}
|
||||
|
||||
if noProxy, err := parseNoProxy(v.NoProxy); err == nil {
|
||||
v.NoProxy = strings.Join(noProxy, ",")
|
||||
} else {
|
||||
return errors.Wrap(err, "invalid no_proxy")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func parseProxy(proxy string) (*url.URL, error) {
|
||||
if proxy == "" {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
proxyURL, err := url.Parse(proxy)
|
||||
if err != nil ||
|
||||
(proxyURL.Scheme != "http" &&
|
||||
proxyURL.Scheme != "https" &&
|
||||
proxyURL.Scheme != "socks5") {
|
||||
// proxy was bogus. Try prepending "http://" to it and
|
||||
// see if that parses correctly. If not, we fall
|
||||
// through and complain about the original one.
|
||||
if proxyURL, err := url.Parse("http://" + proxy); err == nil {
|
||||
return proxyURL, nil
|
||||
}
|
||||
}
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "invalid proxy address %q", proxy)
|
||||
}
|
||||
return proxyURL, nil
|
||||
}
|
||||
|
||||
func parseNoProxy(noProxy string) ([]string, error) {
|
||||
var r []string
|
||||
for _, p := range strings.Split(noProxy, ",") {
|
||||
p = strings.ToLower(strings.TrimSpace(p))
|
||||
if len(p) == 0 {
|
||||
continue
|
||||
}
|
||||
|
||||
if p == "*" {
|
||||
r = append(r, p)
|
||||
// let it go
|
||||
//return r, nil
|
||||
}
|
||||
|
||||
// IPv4/CIDR, IPv6/CIDR
|
||||
if _, _, err := net.ParseCIDR(p); err == nil {
|
||||
r = append(r, p)
|
||||
continue
|
||||
}
|
||||
|
||||
// IPv4:port, [IPv6]:port
|
||||
phost, _, err := net.SplitHostPort(p)
|
||||
if err == nil {
|
||||
if len(phost) == 0 {
|
||||
// There is no host part, likely the entry is malformed; ignore.
|
||||
return nil, fmt.Errorf("host part must not be empty: %s", p)
|
||||
}
|
||||
if phost[0] == '[' && phost[len(phost)-1] == ']' {
|
||||
phost = phost[1 : len(phost)-1]
|
||||
}
|
||||
} else {
|
||||
phost = p
|
||||
}
|
||||
// IPv4, IPv6
|
||||
if pip := net.ParseIP(phost); pip != nil {
|
||||
r = append(r, p)
|
||||
continue
|
||||
}
|
||||
|
||||
if len(phost) == 0 {
|
||||
// There is no host part, likely the entry is malformed; ignore.
|
||||
continue
|
||||
}
|
||||
|
||||
r = append(r, p)
|
||||
}
|
||||
return r, nil
|
||||
}
|
||||
@@ -1,5 +1,3 @@
|
||||
// Copyright 2018, OpenCensus Authors
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
@@ -12,21 +10,18 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
// +build go1.11
|
||||
// Code generated by model-api-gen. DO NOT EDIT.
|
||||
|
||||
package trace
|
||||
package proxy
|
||||
|
||||
import (
|
||||
"context"
|
||||
t "runtime/trace"
|
||||
"yunion.io/x/onecloud/pkg/apis"
|
||||
)
|
||||
|
||||
func startExecutionTracerTask(ctx context.Context, name string) (context.Context, func()) {
|
||||
if !t.IsEnabled() {
|
||||
// Avoid additional overhead if
|
||||
// runtime/trace is not enabled.
|
||||
return ctx, func() {}
|
||||
}
|
||||
nctx, task := t.NewTask(ctx, name)
|
||||
return nctx, task.End
|
||||
// SProxySetting is an autogenerated struct via yunion.io/x/onecloud/pkg/cloudcommon/db/proxy.SProxySetting.
|
||||
type SProxySetting struct {
|
||||
apis.SStandaloneResourceBase
|
||||
HTTPProxy string `json:"http_proxy"`
|
||||
HTTPSProxy string `json:"https_proxy"`
|
||||
NoProxy string `json:"no_proxy"`
|
||||
}
|
||||
@@ -18,13 +18,59 @@ import (
|
||||
"time"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/apis"
|
||||
"yunion.io/x/onecloud/pkg/apis/compute"
|
||||
)
|
||||
|
||||
type CloudeventListInput struct {
|
||||
apis.VirtualResourceListInput
|
||||
apis.ModelBaseListInput
|
||||
|
||||
compute.ManagedResourceListInput
|
||||
// 列出指定云平台的资源,支持的云平台如下
|
||||
//
|
||||
// | Provider | 开始支持版本 | 平台 |
|
||||
// |-----------|------------|-------------------------------------|
|
||||
// | OneCloud | 0.0 | OneCloud内置私有云,包括KVM和裸金属管理 |
|
||||
// | VMware | 1.2 | VMware vCenter |
|
||||
// | OpenStack | 2.6 | OpenStack M版本以上私有云 |
|
||||
// | ZStack | 2.10 | ZStack私有云 |
|
||||
// | Aliyun | 2.0 | 阿里云 |
|
||||
// | Aws | 2.3 | Amazon AWS |
|
||||
// | Azure | 2.2 | Microsoft Azure |
|
||||
// | Google | 2.13 | Google Cloud Platform |
|
||||
// | Qcloud | 2.3 | 腾讯云 |
|
||||
// | Huawei | 2.5 | 华为公有云 |
|
||||
// | Ucloud | 2.7 | UCLOUD |
|
||||
// | Ctyun | 2.13 | 天翼云 |
|
||||
// | S3 | 2.11 | 通用s3对象存储 |
|
||||
// | Ceph | 2.11 | Ceph对象存储 |
|
||||
// | Xsky | 2.11 | XSKY启明星辰Ceph对象存储 |
|
||||
//
|
||||
// enum: OneCloud,VMware,Aliyun,Qcloud,Azure,Aws,Huawei,OpenStack,Ucloud,ZStack,Google,Ctyun,S3,Ceph,Xsky"
|
||||
Providers []string `json:"providers"`
|
||||
// swagger:ignore
|
||||
// Deprecated
|
||||
Provider []string `json:"provider" "yunion:deprecated-by":"providers"`
|
||||
|
||||
// 列出指定云平台品牌的资源,一般来说brand和provider相同,除了以上支持的provider之外,还支持以下band
|
||||
//
|
||||
// | Brand | Provider | 说明 |
|
||||
// |----------|----------|------------|
|
||||
// | DStack | ZStack | 滴滴云私有云 |
|
||||
//
|
||||
Brands []string `json:"brands"`
|
||||
// swagger:ignore
|
||||
// Deprecated
|
||||
Brand []string `json:"brand" "yunion:deprecated-by":"brands"`
|
||||
|
||||
// 服务类型
|
||||
Service []string `json:"service"`
|
||||
|
||||
// 订阅
|
||||
Manager []string `json:"manager"`
|
||||
|
||||
// 账号
|
||||
Account []string `json:"account"`
|
||||
|
||||
// 操作类型
|
||||
Action []string `json:"action"`
|
||||
|
||||
// 操作日志起始时间
|
||||
Since time.Time `json:"since"`
|
||||
|
||||
@@ -285,7 +285,7 @@ type ServerConfigs struct {
|
||||
// swagger:ignore
|
||||
// Deprecated
|
||||
// alias for InstanceType
|
||||
Sku string `json:"sku" deprecated-by:"instance_type"`
|
||||
Sku string `json:"sku" "yunion:deprecated-by":"instance_type"`
|
||||
|
||||
// 虚拟机高可用(创建备机)
|
||||
// default: false
|
||||
@@ -357,12 +357,13 @@ type ServerCreateInput struct {
|
||||
// required: false
|
||||
UserData string `json:"user_data"`
|
||||
|
||||
// Deprecated
|
||||
// swagger:ignore
|
||||
Keypair string `json:"keypair" deprecated-by:"keypair_id"`
|
||||
KeypairId string `json:"keypair_id" "yunion:deprecated-by":"keypair"`
|
||||
|
||||
// 秘钥对Id
|
||||
// required: false
|
||||
KeypairId string `json:"keypair_id"`
|
||||
Keypair string `json:"keypair"`
|
||||
|
||||
// 密码
|
||||
// 要求: 密码长度 >= 20, 至少包含一个数字一个小写字母一个大小字母及特殊字符~`!@#$%^&*()-_=+[]{}|:';\",./<>?中的一个
|
||||
|
||||
@@ -19,6 +19,7 @@ import (
|
||||
"yunion.io/x/pkg/utils"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/apis"
|
||||
proxyapi "yunion.io/x/onecloud/pkg/apis/cloudcommon/proxy"
|
||||
"yunion.io/x/onecloud/pkg/cloudprovider"
|
||||
"yunion.io/x/onecloud/pkg/httperrors"
|
||||
)
|
||||
@@ -79,6 +80,8 @@ type CloudaccountCreateInput struct {
|
||||
// 额外信息,例如账单的access key
|
||||
Options *jsonutils.JSONObject `json:"options"`
|
||||
|
||||
proxyapi.ProxySettingResourceInput
|
||||
|
||||
cloudprovider.SCloudaccount
|
||||
cloudprovider.SCloudaccountCredential
|
||||
}
|
||||
@@ -177,4 +180,6 @@ type CloudaccountDetail struct {
|
||||
// 存储缓存数量
|
||||
// example: 10
|
||||
StoragecacheCount int `json:"storagecache_count,allowempty"`
|
||||
|
||||
ProxySetting proxyapi.SProxySetting `json:"proxy_setting"`
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ import (
|
||||
"yunion.io/x/pkg/utils"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/apis"
|
||||
proxyapi "yunion.io/x/onecloud/pkg/apis/cloudcommon/proxy"
|
||||
"yunion.io/x/onecloud/pkg/cloudprovider"
|
||||
)
|
||||
|
||||
@@ -96,6 +97,8 @@ type CloudproviderDetails struct {
|
||||
apis.StandaloneResourceDetails
|
||||
SCloudprovider
|
||||
|
||||
ProxySetting proxyapi.SProxySetting `json:"proxy_setting"`
|
||||
|
||||
// 云账号名称
|
||||
// example: google-account
|
||||
Cloudaccount string `json:"cloudaccount"`
|
||||
@@ -144,30 +147,30 @@ type ManagedResourceListInput struct {
|
||||
// swagger:ignore
|
||||
// Deprecated
|
||||
// description: this param will be deprecate at 3.0
|
||||
Manager string `json:"manager" deprecated-by:"cloudprovider"`
|
||||
Manager string `json:"manager" "yunion:deprecated-by":"cloudprovider"`
|
||||
// swagger:ignore
|
||||
// Deprecated
|
||||
// description: this param will be deprecate at 3.0
|
||||
ManagerId string `json:"manager_id" deprecated-by:"cloudprovider"`
|
||||
ManagerId string `json:"manager_id" "yunion:deprecated-by":"cloudprovider"`
|
||||
// swagger:ignore
|
||||
// Deprecated
|
||||
// description: this param will be deprecate at 3.0
|
||||
CloudproviderId string `json:"cloudprovider_id" deprecated-by:"cloudprovider"`
|
||||
CloudproviderId string `json:"cloudprovider_id" "yunion:deprecated-by":"cloudprovider"`
|
||||
|
||||
// 列出关联指定云账号(ID或Name)的资源
|
||||
Cloudaccount string `json:"cloudaccount"`
|
||||
// swagger:ignore
|
||||
// Deprecated
|
||||
// description: this param will be deprecate at 3.0
|
||||
CloudaccountId string `json:"cloudaccount_id" deprecated-by:"cloudaccount"`
|
||||
CloudaccountId string `json:"cloudaccount_id" "yunion:deprecated-by":"cloudaccount"`
|
||||
// swagger:ignore
|
||||
// Deprecated
|
||||
// description: this param will be deprecate at 3.0
|
||||
Account string `json:"account" deprecated-by:"cloudaccount"`
|
||||
Account string `json:"account" "yunion:deprecated-by":"cloudaccount"`
|
||||
// swagger:ignore
|
||||
// Deprecated
|
||||
// description: this param will be deprecate at 3.0
|
||||
AccountId string `json:"account_id" deprecated-by:"cloudaccount"`
|
||||
AccountId string `json:"account_id" "yunion:deprecated-by":"cloudaccount"`
|
||||
|
||||
// 列出指定云平台的资源,支持的云平台如下
|
||||
//
|
||||
@@ -193,7 +196,7 @@ type ManagedResourceListInput struct {
|
||||
Providers []string `json:"providers"`
|
||||
// swagger:ignore
|
||||
// Deprecated
|
||||
Provider []string `json:"provider" deprecated-by:"providers"`
|
||||
Provider []string `json:"provider" "yunion:deprecated-by":"providers"`
|
||||
|
||||
// 列出指定云平台品牌的资源,一般来说brand和provider相同,除了以上支持的provider之外,还支持以下band
|
||||
//
|
||||
@@ -204,7 +207,7 @@ type ManagedResourceListInput struct {
|
||||
Brands []string `json:"brands"`
|
||||
// swagger:ignore
|
||||
// Deprecated
|
||||
Brand []string `json:"brand" deprecated-by:"brands"`
|
||||
Brand []string `json:"brand" "yunion:deprecated-by":"brands"`
|
||||
|
||||
// 列出指定云环境的资源,支持云环境如下:
|
||||
//
|
||||
|
||||
@@ -56,6 +56,7 @@ const (
|
||||
CITY_NAN_JING = "Nanjing" //南京
|
||||
CITY_FO_SHAN = "Foshan" //佛山
|
||||
CITY_QUAN_ZHOU = "Quanzhou" //泉州
|
||||
CITY_NEI_MENG_GU = "Neimenggu" //内蒙古
|
||||
|
||||
// 日本
|
||||
CITY_TOKYO = "Tokyo" //东京
|
||||
@@ -111,6 +112,7 @@ const (
|
||||
CITY_US_GOV_WEST = "us-gov-west" //???
|
||||
CITY_SOUTH_CAROLINA = "South Carolina" //南卡罗来纳州
|
||||
CITY_SALT_LAKE_CITY = "Salt Lake City" //盐湖城
|
||||
CITY_LAS_VEGAS = "Las Vegas" //拉斯维加斯
|
||||
|
||||
// 英国
|
||||
CITY_LONDON = "London" //伦敦
|
||||
@@ -149,6 +151,12 @@ const (
|
||||
// 巴西
|
||||
CITY_SAO_PAULO = "Sao Paulo" //圣保罗
|
||||
|
||||
// 智利
|
||||
CITY_SANTIAGO = "Santiago" // 圣地亚哥
|
||||
|
||||
// 墨西哥
|
||||
CITY_MEXICO = "Mexico" // 墨西哥
|
||||
|
||||
// 荷兰
|
||||
CITY_HOLLAND = "Holland" //荷兰
|
||||
|
||||
@@ -194,4 +202,6 @@ const (
|
||||
COUNTRY_CODE_VN = "VN" //越南
|
||||
COUNTRY_CODE_CH = "CH" //瑞士
|
||||
COUNTRY_CODE_NO = "NO" //挪威
|
||||
COUNTRY_CODE_MX = "MX" //墨西哥
|
||||
COUNTRY_CODE_CL = "CL" //智利
|
||||
)
|
||||
|
||||
@@ -212,7 +212,7 @@ type DbinstanceFilterListInput struct {
|
||||
// swagger:ignore
|
||||
// Deprecated
|
||||
// filter by dbinstance_id
|
||||
DbinstanceId string `json:"dbinstance_id" deprecated-by:"dbinstance"`
|
||||
DbinstanceId string `json:"dbinstance_id" "yunion:deprecated-by":"dbinstance"`
|
||||
}
|
||||
|
||||
type DBInstanceDetails struct {
|
||||
|
||||
@@ -108,10 +108,10 @@ const (
|
||||
ALIYUN_DBINSTANCE_STORAGE_TYPE_CLOUD_SSD = "cloud_ssd" //SSD云盘
|
||||
|
||||
//华为云存储类型
|
||||
HUAWEI_DBINSTANCE_STORAGE_TYPE_SSD = "SSD" //超高IO云硬盘
|
||||
HUAWEI_DBINSTANCE_STORAGE_TYPE_SAS = "SAS" //高IO云硬盘
|
||||
HUAWEI_DBINSTANCE_STORAGE_TYPE_SATA = "SATA" //普通IO云硬盘
|
||||
|
||||
HUAWEI_DBINSTANCE_STORAGE_TYPE_ULTRAHIGH = "ULTRAHIGH" //超高IO云硬盘
|
||||
HUAWEI_DBINSTANCE_STORAGE_TYPE_ULTRAHIGHPRO = "ULTRAHIGHPRO"
|
||||
HUAWEI_DBINSTANCE_STORAGE_TYPE_COMMON = "COMMON"
|
||||
HUAWEI_DBINSTANCE_STORAGE_TYPE_HIGH = "HIGH"
|
||||
)
|
||||
|
||||
var (
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2018, OpenCensus Authors
|
||||
// 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.
|
||||
@@ -12,11 +12,12 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
// Package internal provides trace internals.
|
||||
package internal
|
||||
package compute
|
||||
|
||||
// IDGenerator allows custom generators for TraceId and SpanId.
|
||||
type IDGenerator interface {
|
||||
NewTraceID() [16]byte
|
||||
NewSpanID() [8]byte
|
||||
import "yunion.io/x/onecloud/pkg/apis"
|
||||
|
||||
type DBInstanceSkuDetails struct {
|
||||
apis.StandaloneResourceDetails
|
||||
|
||||
CloudregionInfo
|
||||
}
|
||||
@@ -89,7 +89,7 @@ type SnapshotPolicyFilterListInput struct {
|
||||
// swagger:ignore
|
||||
// Deprecated
|
||||
// filter disk by snapshotpolicy_id
|
||||
SnapshotpolicyId string `json:"snapshotpolicy_id" deprecated-by:"snapshotpolicy"`
|
||||
SnapshotpolicyId string `json:"snapshotpolicy_id" "yunion:deprecated-by":"snapshotpolicy"`
|
||||
}
|
||||
|
||||
type DiskListInput struct {
|
||||
@@ -109,7 +109,7 @@ type DiskListInput struct {
|
||||
// swagger:ignore
|
||||
// Deprecated
|
||||
// filter by disk type
|
||||
Type string `json:"type" deprecated-by:"disk_type"`
|
||||
Type string `json:"type" "yunion:deprecated-by":"disk_type"`
|
||||
// 过滤指定disk_type的磁盘列表,可能的值为:sys, data, swap. volume
|
||||
//
|
||||
// | disk_type值 | 说明 |
|
||||
@@ -128,7 +128,7 @@ type DiskFilterListInput struct {
|
||||
// swagger:ignore
|
||||
// Deprecated
|
||||
// filter by disk_id
|
||||
DiskId string `json:"disk_id" deprecated-by:"disk"`
|
||||
DiskId string `json:"disk_id" "yunion:deprecated-by":"disk"`
|
||||
}
|
||||
|
||||
type SimpleGuest struct {
|
||||
@@ -138,8 +138,10 @@ type SimpleGuest struct {
|
||||
}
|
||||
|
||||
type SimpleSnapshotPolicy struct {
|
||||
RepeatWeekdays []int `json:"repeat_weekdays"`
|
||||
TimePoints []int `json:"time_points"`
|
||||
Id string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
RepeatWeekdays []int `json:"repeat_weekdays"`
|
||||
TimePoints []int `json:"time_points"`
|
||||
}
|
||||
|
||||
type DiskDetails struct {
|
||||
|
||||
@@ -43,10 +43,6 @@ const (
|
||||
EIP_CHARGE_TYPE_BY_TRAFFIC = "traffic"
|
||||
EIP_CHARGE_TYPE_BY_BANDWIDTH = "bandwidth"
|
||||
EIP_CHARGE_TYPE_DEFAULT = EIP_CHARGE_TYPE_BY_TRAFFIC
|
||||
|
||||
// EIP associate resource type
|
||||
EIP_ASSOCIATE_TYPE_VM = "server"
|
||||
EIP_ASSOCIATE_TYPE_ELB = "elb"
|
||||
)
|
||||
|
||||
var (
|
||||
|
||||
@@ -27,15 +27,15 @@ type RegionalFilterListInput struct {
|
||||
// swagger:ignore
|
||||
// Deprecated
|
||||
// description: this param will be deprecate at 3.0
|
||||
CloudregionId string `json:"cloudregion_id" deprecated-by:"cloudregion"`
|
||||
CloudregionId string `json:"cloudregion_id" "yunion:deprecated-by":"cloudregion"`
|
||||
// swagger:ignore
|
||||
// Deprecated
|
||||
// description: this param will be deprecate at 3.0
|
||||
Region string `json:"region" deprecated-by:"cloudregion"`
|
||||
Region string `json:"region" "yunion:deprecated-by":"cloudregion"`
|
||||
// swagger:ignore
|
||||
// Deprecated
|
||||
// description: this param will be deprecate at 3.0
|
||||
RegionId string `json:"region_id" deprecated-by:"cloudregion"`
|
||||
RegionId string `json:"region_id" "yunion:deprecated-by":"cloudregion"`
|
||||
}
|
||||
|
||||
type ZonalFilterListInput struct {
|
||||
@@ -46,7 +46,7 @@ type ZonalFilterListInput struct {
|
||||
// swagger:ignore
|
||||
// Deprecated
|
||||
// filter by zone_id
|
||||
ZoneId string `json:"zone_id" deprecated-by:"zone"`
|
||||
ZoneId string `json:"zone_id" "yunion:deprecated-by":"zone"`
|
||||
// 过滤处于多个指定可用区内的资源
|
||||
Zones []string `json:"zones"`
|
||||
}
|
||||
@@ -67,7 +67,7 @@ type HostFilterListInput struct {
|
||||
// swagger:ignore
|
||||
// Deprecated
|
||||
// filter by host_id
|
||||
HostId string `json:"host_id" deprecated-by:"host"`
|
||||
HostId string `json:"host_id" "yunion:deprecated-by":"host"`
|
||||
}
|
||||
|
||||
type CloudregionListInput struct {
|
||||
|
||||
@@ -150,6 +150,11 @@ const (
|
||||
HYPERVISOR_DEFAULT = HYPERVISOR_KVM
|
||||
)
|
||||
|
||||
const (
|
||||
CPU_MODE_QEMU = "qemu"
|
||||
CPU_MODE_HOST = "host"
|
||||
)
|
||||
|
||||
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}
|
||||
|
||||
|
||||
@@ -28,15 +28,15 @@ type ServerFilterListInput struct {
|
||||
// swagger:ignore
|
||||
// Deprecated
|
||||
// Filter by guest Id
|
||||
ServerId string `json:"server_id" deprecated-by:"server"`
|
||||
ServerId string `json:"server_id" "yunion:deprecated-by":"server"`
|
||||
// swagger:ignore
|
||||
// Deprecated
|
||||
// Filter by guest Id
|
||||
Guest string `json:"guest" deprecated-by:"server"`
|
||||
Guest string `json:"guest" "yunion:deprecated-by":"server"`
|
||||
// swagger:ignore
|
||||
// Deprecated
|
||||
// Filter by guest Id
|
||||
GuestId string `json:"guest_id" deprecated-by:"server"`
|
||||
GuestId string `json:"guest_id" "yunion:deprecated-by":"server"`
|
||||
}
|
||||
|
||||
type ServerListInput struct {
|
||||
|
||||
@@ -124,3 +124,10 @@ type HostDetails struct {
|
||||
// 标签
|
||||
Metadata map[string]string `json:"metadata"`
|
||||
}
|
||||
|
||||
type HostRegisterMetadata struct {
|
||||
apis.Meta
|
||||
|
||||
OnKubernetes bool `json:"on_kubernetes"`
|
||||
Hostname string `json:"hostname"`
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ type HoststorageDetails struct {
|
||||
// 镜像缓存路径
|
||||
ImagecachePath string `json:"imagecache_path"`
|
||||
// 存储缓存Id
|
||||
StoragecacheId string `json:"storagecached_id"`
|
||||
StoragecacheId string `json:"storagecache_id"`
|
||||
|
||||
GuestDiskCount int `json:"guest_disk_count,allowempty"`
|
||||
}
|
||||
|
||||
@@ -41,5 +41,5 @@ type GroupFilterListInput struct {
|
||||
// swagger:ignore
|
||||
// deprecated: true
|
||||
// Filter by instance group Id
|
||||
GroupId string `json:"group_id" deprecated-by:"group"`
|
||||
GroupId string `json:"group_id" "yunion:deprecated-by":"group"`
|
||||
}
|
||||
|
||||
@@ -29,6 +29,10 @@ type SimpleSnapshot struct {
|
||||
CloudregionId string `json:"cloudregion_id"`
|
||||
// 快照大小
|
||||
Size int `json:"size"`
|
||||
// 快照状态
|
||||
Status string `json:"status"`
|
||||
// 存储类型
|
||||
StorageType string `json:"storage_type"`
|
||||
}
|
||||
|
||||
type InstnaceSnapshotDetails struct {
|
||||
|
||||
@@ -24,7 +24,7 @@ type VpcFilterListInput struct {
|
||||
// swagger:ignore
|
||||
// Deprecated
|
||||
// filter by vpc Id
|
||||
VpcId string `json:"vpc_id" deprecated-by:"vpc"`
|
||||
VpcId string `json:"vpc_id" "yunion:deprecated-by":"vpc"`
|
||||
}
|
||||
|
||||
type WireFilterListInput struct {
|
||||
@@ -35,7 +35,7 @@ type WireFilterListInput struct {
|
||||
// swagger:ignore
|
||||
// Deprecated
|
||||
// fitler by wire id
|
||||
WireId string `json:"wire_id" deprecated-by:"wire"`
|
||||
WireId string `json:"wire_id" "yunion:deprecated-by":"wire"`
|
||||
}
|
||||
|
||||
type NetworkFilterListInput struct {
|
||||
@@ -46,7 +46,7 @@ type NetworkFilterListInput struct {
|
||||
// swagger:ignore
|
||||
// Deprecated
|
||||
// filter by networkId
|
||||
NetworkId string `json:"network_id" deprecated-by:"network"`
|
||||
NetworkId string `json:"network_id" "yunion:deprecated-by":"network"`
|
||||
}
|
||||
|
||||
type NetworkListInput struct {
|
||||
@@ -60,9 +60,13 @@ type NetworkListInput struct {
|
||||
|
||||
WireFilterListInput
|
||||
|
||||
// description: search ip address in network.
|
||||
// description: Exact matching ip address in network.
|
||||
// example: 10.168.222.1
|
||||
Ip string `json:"ip"`
|
||||
|
||||
// description: Fuzzy matching ip address in network.
|
||||
// example: 10.168.222.1
|
||||
IpMatch string `json:"ip_match"`
|
||||
}
|
||||
|
||||
type NetworkCreateInput struct {
|
||||
|
||||
@@ -45,7 +45,7 @@ type SchedtagFilterListInput struct {
|
||||
// swagger:ignore
|
||||
// Deprecated
|
||||
// filter by schedtag_id
|
||||
SchedtagId string `json:"schedtag_id" deprecated-by:"schedtag"`
|
||||
SchedtagId string `json:"schedtag_id" "yunion:deprecated-by":"schedtag"`
|
||||
}
|
||||
|
||||
type SchedtagListInput struct {
|
||||
@@ -56,7 +56,7 @@ type SchedtagListInput struct {
|
||||
// swagger:ignore
|
||||
// Deprecated
|
||||
// filter by type, alias for resource_type
|
||||
Type string `json:"type" deprecated-by:"resource_type"`
|
||||
Type string `json:"type" "yunion:deprecated-by":"resource_type"`
|
||||
}
|
||||
|
||||
type SchedtagDetails struct {
|
||||
|
||||
@@ -162,7 +162,7 @@ type SecgroupFilterListInput struct {
|
||||
// swagger:ignore
|
||||
// Deprecated
|
||||
// filter by secgroup_id
|
||||
SecgroupId string `json:"secgroup_id" deprecated-by:"secgroup"`
|
||||
SecgroupId string `json:"secgroup_id" "yunion:deprecated-by":"secgroup"`
|
||||
}
|
||||
|
||||
type SecgroupDetails struct {
|
||||
|
||||
@@ -112,22 +112,27 @@ type StorageCreateInput struct {
|
||||
NfsSharedDir string `json:"nfs_shared_dir"`
|
||||
}
|
||||
|
||||
type StorageDetails struct {
|
||||
apis.StandaloneResourceDetails
|
||||
SStorage
|
||||
|
||||
type SStorageCapacityInfo struct {
|
||||
// 容量大小, 单位Mb
|
||||
Capacity int64 `json:"capacity"`
|
||||
// 已使用容量大小
|
||||
Used int64 `json:"used"`
|
||||
UsedCapacity int64 `json:"used_capacity"`
|
||||
// 浪费容量大小(异常磁盘大小总和)
|
||||
Wasted int64 `json:"wasted"`
|
||||
WasteCapacity int64 `json:"waste_capacity"`
|
||||
// 虚拟容量大小
|
||||
VCapacity int64 `json:"vcapacity"`
|
||||
VirtualCapacity int64 `json:"virtual_capacity"`
|
||||
// 超分率
|
||||
CommitRate float64 `json:"commit_rate"`
|
||||
// 可使用容量
|
||||
FreeCapacity int64 `json:"free_capacity"`
|
||||
}
|
||||
|
||||
type StorageDetails struct {
|
||||
apis.StandaloneResourceDetails
|
||||
|
||||
SStorageCapacityInfo
|
||||
|
||||
SStorage
|
||||
|
||||
CloudproviderInfo
|
||||
Schedtags []SchedtagShortDescDetails `json:"schedtags"`
|
||||
|
||||
@@ -144,7 +144,7 @@ type StorageFilterListInput struct {
|
||||
// swagger:ignore
|
||||
// Deprecated
|
||||
// filter by storage_id
|
||||
StorageId string `json:"storage_id" deprecated-by:"storage"`
|
||||
StorageId string `json:"storage_id" "yunion:deprecated-by":"storage"`
|
||||
}
|
||||
|
||||
type StorageShareFilterListInput struct {
|
||||
|
||||
@@ -53,7 +53,7 @@ type WireDetails struct {
|
||||
// example: 1
|
||||
Networks int `json:"networks"`
|
||||
// VPC名称
|
||||
Vpc string `json:"vpc'`
|
||||
Vpc string `json:"vpc"`
|
||||
// VPC外部Id
|
||||
VpcExtId string `json:"vpc_ext_id"`
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ type ZoneDetails struct {
|
||||
|
||||
// 可用区底下启用的宿主机数量
|
||||
// example: 2
|
||||
HostsEnabled int `json:"host_enabled"`
|
||||
HostsEnabled int `json:"hosts_enabled"`
|
||||
|
||||
// 可用区底下的裸金属服务器数量
|
||||
// example: 1
|
||||
|
||||
@@ -195,6 +195,8 @@ type SCloudaccount struct {
|
||||
IsPublic bool `json:"is_public"`
|
||||
// add share_mode field to indicate the share range of this account
|
||||
ShareMode string `json:"share_mode"`
|
||||
// 默认值proxyapi.ProxySettingId_DIRECT
|
||||
ProxySettingId string `json:"proxy_setting_id"`
|
||||
}
|
||||
|
||||
// SCloudprovider is an autogenerated struct via yunion.io/x/onecloud/pkg/compute/models.SCloudprovider.
|
||||
@@ -215,6 +217,7 @@ type SCloudprovider struct {
|
||||
type SCloudproviderCapability struct {
|
||||
apis.SResourceBase
|
||||
CloudproviderId string `json:"cloudprovider_id"`
|
||||
CloudregionId string `json:"cloudregion_id"`
|
||||
Capability string `json:"capability"`
|
||||
}
|
||||
|
||||
|
||||
@@ -62,3 +62,7 @@ func (ra *SRoleAssignment) GetRoles() []string {
|
||||
func (ra *SRoleAssignment) GetLoginIp() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
func (ra *SRoleAssignment) GetTokenString() string {
|
||||
return "faketoken"
|
||||
}
|
||||
|
||||
@@ -14,8 +14,20 @@
|
||||
|
||||
package identity
|
||||
|
||||
import "yunion.io/x/pkg/tristate"
|
||||
|
||||
type SCASIdpConfigOptions struct {
|
||||
// https://cas.example.org/cas/
|
||||
CASServerURL string `json:"cas_server_url"`
|
||||
Service string `json:"service"`
|
||||
|
||||
CasProjectAttribute string `json:"cas_project_attribute"`
|
||||
|
||||
AutoCreateCasProject tristate.TriState `json:"auto_create_cas_project"`
|
||||
|
||||
DefaultCasProjectId string `json:"default_cas_project_id"`
|
||||
|
||||
CasRoleAttribute string `json:"cas_role_attribute"`
|
||||
|
||||
DefaultCasRoleId string `json:"default_cas_role_id"`
|
||||
}
|
||||
|
||||
@@ -93,3 +93,19 @@ var (
|
||||
IdpTemplateOpenLDAPSingleDomain: IdentityDriverLDAP,
|
||||
}
|
||||
)
|
||||
|
||||
type PerformConfigInput struct {
|
||||
// 更新配置的方式
|
||||
// example: update
|
||||
//
|
||||
// | action | 含义 |
|
||||
// |---------|-----------------------------------------------|
|
||||
// | update | 增量更新配置 |
|
||||
// | remove | 删除指定配置 |
|
||||
// | replace | 全量替换配置,如果action为空,则默认为replace |
|
||||
//
|
||||
Action string `json:"action"`
|
||||
|
||||
// 配置信息
|
||||
Config TConfigs `json:"config"`
|
||||
}
|
||||
|
||||
@@ -144,6 +144,10 @@ var (
|
||||
"etcd_cacert",
|
||||
"etcd_cert",
|
||||
"etcd_key",
|
||||
|
||||
"bootstrap_admin_user_password",
|
||||
"reset_admin_user_password",
|
||||
"fernet_key_repository",
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
@@ -29,3 +29,28 @@ type IdentityProviderDetails struct {
|
||||
ProjectCount int `json:"project_count,allowempty"`
|
||||
GroupCount int `json:"group_count,allowempty"`
|
||||
}
|
||||
|
||||
type IdentityProviderCreateInput struct {
|
||||
apis.EnabledStatusStandaloneResourceCreateInput
|
||||
|
||||
// 后端驱动名称
|
||||
Driver string `json:"driver"`
|
||||
|
||||
// 模板名称
|
||||
Template string `json:"template"`
|
||||
|
||||
// 默认导入用户和组的域
|
||||
TargetDomain string `json:"target_domain"`
|
||||
// swagger:ignore
|
||||
// Deprecated
|
||||
TargetDomainId string `json:"target_domain_id" "yunion:deprecated-by":"target_domain"`
|
||||
|
||||
// 新建域的时候是否自动新建第一个项目
|
||||
AutoCreateProject *bool `json:"auto_create_project"`
|
||||
|
||||
// 自动同步间隔,单位:秒
|
||||
SyncIntervalSeconds *int `json:"sync_interval_seconds"`
|
||||
|
||||
// 配置信息
|
||||
Config TConfigs `json:"config"`
|
||||
}
|
||||
|
||||
@@ -48,15 +48,15 @@ type ProjectFilterListInput struct {
|
||||
// swagger:ignore
|
||||
// Deprecated
|
||||
// filter by project_id
|
||||
ProjectId string `json:"project_id" deprecated-by:"project"`
|
||||
ProjectId string `json:"project_id" "yunion:deprecated-by":"project"`
|
||||
// swagger:ignore
|
||||
// Deprecated
|
||||
// filter by tenant
|
||||
Tenant string `json:"tenant" deprecated-by:"project"`
|
||||
Tenant string `json:"tenant" "yunion:deprecated-by":"project"`
|
||||
// swagger:ignore
|
||||
// Deprecated
|
||||
// filter by tenant_id
|
||||
TenantId string `json:"tenant_id" deprecated-by:"project"`
|
||||
TenantId string `json:"tenant_id" "yunion:deprecated-by":"project"`
|
||||
}
|
||||
|
||||
type UserFilterListInput struct {
|
||||
@@ -65,7 +65,7 @@ type UserFilterListInput struct {
|
||||
// swagger:ignore
|
||||
// Deprecated
|
||||
// filter by user_id
|
||||
UserId string `json:"user_id" deprecated-by:"user"`
|
||||
UserId string `json:"user_id" "yunion:deprecated-by":"user"`
|
||||
}
|
||||
|
||||
type GroupFilterListInput struct {
|
||||
@@ -74,7 +74,7 @@ type GroupFilterListInput struct {
|
||||
// swagger:ignore
|
||||
// Deprecated
|
||||
// filter by group_id
|
||||
GroupId string `json:"group_id" deprecated-by:"group"`
|
||||
GroupId string `json:"group_id" "yunion:deprecated-by":"group"`
|
||||
}
|
||||
|
||||
type RoleFilterListInput struct {
|
||||
@@ -83,7 +83,7 @@ type RoleFilterListInput struct {
|
||||
// swagger:ignore
|
||||
// Deprecated
|
||||
// filter by role_id
|
||||
RoleId string `json:"role_id" deprecated-by:"role"`
|
||||
RoleId string `json:"role_id" "yunion:deprecated-by":"role"`
|
||||
}
|
||||
|
||||
type ServiceFilterListInput struct {
|
||||
@@ -92,7 +92,7 @@ type ServiceFilterListInput struct {
|
||||
// swagger:ignore
|
||||
// Deprecated
|
||||
// filter by service_id
|
||||
ServiceId string `json:"service_id" deprecated-by:"service"`
|
||||
ServiceId string `json:"service_id" "yunion:deprecated-by":"service"`
|
||||
}
|
||||
|
||||
type RoleListInput struct {
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
package image
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"yunion.io/x/jsonutils"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/apis"
|
||||
@@ -27,13 +29,23 @@ type GuestImageDetails struct {
|
||||
ImageIds jsonutils.JSONObject `json:"image_ids"`
|
||||
|
||||
//Status string `json:"status"`
|
||||
Size int64 `json:"size"`
|
||||
MinRamMb int32 `json:"min_ram_mb"`
|
||||
DiskFormat string `json:"disk_format"`
|
||||
RootImage jsonutils.JSONObject `json:"root_image"`
|
||||
DataImages jsonutils.JSONObject `json:"data_images"`
|
||||
Size int64 `json:"size"`
|
||||
MinRamMb int32 `json:"min_ram_mb"`
|
||||
DiskFormat string `json:"disk_format"`
|
||||
RootImage SubImageInfo `json:"root_image"`
|
||||
DataImages []SubImageInfo `json:"data_images"`
|
||||
|
||||
Properties *jsonutils.JSONDict `json:"properties"`
|
||||
|
||||
DisableDelete bool `json:"disable_delete"`
|
||||
}
|
||||
|
||||
type SubImageInfo struct {
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
MinDiskMB int32 `json:"min_disk_mb"`
|
||||
DiskFormat string `json:"disk_format"`
|
||||
Size int64 `json:"size"`
|
||||
Status string `json:"status"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
}
|
||||
|
||||
@@ -28,11 +28,11 @@ type DomainizedResourceListInput struct {
|
||||
// swagger:ignore
|
||||
// Deprecated
|
||||
// Project domain Id filter, alias for project_domain
|
||||
ProjectDomainId string `json:"project_domain_id" deprecated-by:"project_domain"`
|
||||
ProjectDomainId string `json:"project_domain_id" "yunion:deprecated-by":"project_domain"`
|
||||
// swagger:ignore
|
||||
// Deprecated
|
||||
// Domain Id filter, alias for project_domain
|
||||
DomainId string `json:"domain_id" deprecated-by:"project_domain"`
|
||||
DomainId string `json:"domain_id" "yunion:deprecated-by":"project_domain"`
|
||||
}
|
||||
|
||||
type DomainizedResourceCreateInput struct {
|
||||
@@ -53,15 +53,15 @@ type ProjectizedResourceListInput struct {
|
||||
// swagger:ignore
|
||||
// Deprecated
|
||||
// Filter by project_id, alias for project
|
||||
ProjectId string `json:"project_id" deprecated-by:"project"`
|
||||
ProjectId string `json:"project_id" "yunion:deprecated-by":"project"`
|
||||
// swagger:ignore
|
||||
// Deprecated
|
||||
// Filter by tenant ID or Name, alias for project
|
||||
Tenant string `json:"tenant" deprecated-by:"project"`
|
||||
Tenant string `json:"tenant" "yunion:deprecated-by":"project"`
|
||||
// swagger:ignore
|
||||
// Deprecated
|
||||
// Filter by tenant_id, alias for project
|
||||
TenantId string `json:"tenant_id" deprecated-by:"project"`
|
||||
TenantId string `json:"tenant_id" "yunion:deprecated-by":"project"`
|
||||
}
|
||||
|
||||
type ProjectizedResourceCreateInput struct {
|
||||
@@ -82,7 +82,7 @@ type UserResourceListInput struct {
|
||||
// swagger:ignore
|
||||
// Deprecated
|
||||
// Filter by userId
|
||||
UserId string `json:"user_id" deprecated-by:"user"`
|
||||
UserId string `json:"user_id" "yunion:deprecated-by":"user"`
|
||||
}
|
||||
|
||||
func (input UserResourceListInput) UserStr() string {
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
package monitor
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"yunion.io/x/pkg/errors"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/apis"
|
||||
@@ -103,12 +105,18 @@ type AlertCreateInput struct {
|
||||
Name string `json:"name"`
|
||||
// 报警执行频率
|
||||
Frequency int64 `json:"frequency"`
|
||||
// 报警持续时间
|
||||
For int64 `json:"for"`
|
||||
// 报警设置
|
||||
Settings AlertSetting `json:"settings"`
|
||||
// 启用报警
|
||||
Enabled *bool `json:"enabled"`
|
||||
// 报警级别
|
||||
Level string `json:"level"`
|
||||
// 没有收到监控指标时将当前报警状态设置为对应的状态
|
||||
NoDataState string `json:"no_data_state"`
|
||||
// 报警执行错误将当前报警状态设置为对应的状态
|
||||
ExecutionErrorState string `json:"execution_error_state"`
|
||||
}
|
||||
|
||||
type AlertUpdateInput struct {
|
||||
@@ -124,6 +132,10 @@ type AlertUpdateInput struct {
|
||||
Enabled *bool `json:"enabled"`
|
||||
// 报警级别
|
||||
Level *string `json:"level"`
|
||||
// 没有收到监控指标时将当前报警状态设置为对应的状态
|
||||
NoDataState string `json:"no_data_state"`
|
||||
// 报警执行错误将当前报警状态设置为对应的状态
|
||||
ExecutionErrorState string `json:"execution_error_state"`
|
||||
}
|
||||
|
||||
type AlertListInput struct {
|
||||
@@ -135,3 +147,41 @@ type AlertListInput struct {
|
||||
// 以报警是否启用/禁用过滤列表
|
||||
Enabled *bool `json:"enabled"`
|
||||
}
|
||||
|
||||
type AlertTestRunInput struct {
|
||||
apis.Meta
|
||||
|
||||
IsDebug bool `json:"is_debug"`
|
||||
}
|
||||
|
||||
// ResultLogEntry represents log data for the alert evaluation.
|
||||
type ResultLogEntry struct {
|
||||
Message string `json:"message"`
|
||||
Data interface{} `json:"data"`
|
||||
}
|
||||
|
||||
// EvalMatch represents the series violating the threshold.
|
||||
type EvalMatch struct {
|
||||
Condition string `json:"condition"`
|
||||
Value *float64 `json:"value"`
|
||||
Metric string `json:"metric"`
|
||||
Tags map[string]string `json:"tags"`
|
||||
}
|
||||
|
||||
type AlertTestRunOutput struct {
|
||||
apis.Meta
|
||||
|
||||
Firing bool `json:"firing"`
|
||||
EvalMatches []*EvalMatch `json:"eval_matches"`
|
||||
Logs []*ResultLogEntry `json:"logs"`
|
||||
Error error `json:"error"`
|
||||
ConditionEvals string `json:"condition_evals"`
|
||||
StartTime time.Time `json:"start_time"`
|
||||
EndTime time.Time `json:"end_time"`
|
||||
}
|
||||
|
||||
type AlertPauseInput struct {
|
||||
apis.Meta
|
||||
|
||||
Paused bool `json:"paused"`
|
||||
}
|
||||
|
||||
31
pkg/apis/monitor/alertnotification.go
Normal file
31
pkg/apis/monitor/alertnotification.go
Normal file
@@ -0,0 +1,31 @@
|
||||
package monitor
|
||||
|
||||
import (
|
||||
"yunion.io/x/jsonutils"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/apis"
|
||||
)
|
||||
|
||||
type AlertJointResourceBaseDetails struct {
|
||||
SAlertJointsBase
|
||||
Alert string `json:"alert"`
|
||||
}
|
||||
|
||||
type AlertnotificationDetails struct {
|
||||
AlertJointResourceBaseDetails
|
||||
Notification string `json:"notification"`
|
||||
}
|
||||
|
||||
type AlertJointCreateInput struct {
|
||||
apis.Meta
|
||||
|
||||
AlertId string `json:"alert_id"`
|
||||
}
|
||||
|
||||
type AlertnotificationCreateInput struct {
|
||||
AlertJointCreateInput
|
||||
|
||||
NotificationId string `json:"notification_id"`
|
||||
UsedBy string `json:"used_by"`
|
||||
Params jsonutils.JSONObject `json:"params"`
|
||||
}
|
||||
@@ -70,4 +70,5 @@ type MeterAlertUpdateInput struct {
|
||||
ProjectId *string `json:"project_id"`
|
||||
// 通知方式, 比如: email, mobile
|
||||
Channel *string `json:"channel"`
|
||||
Status *string `json:"status"`
|
||||
}
|
||||
|
||||
@@ -171,6 +171,7 @@ type AlertV1Details struct {
|
||||
Measurement string `json:"measurement"`
|
||||
Field string `json:"field"`
|
||||
NotifierId string `json:"notifier_id"`
|
||||
Status string `json:"status"`
|
||||
}
|
||||
|
||||
type NodeAlertDetails struct {
|
||||
|
||||
@@ -32,11 +32,3 @@ type NotificationTemplateConfig struct {
|
||||
Level string `json:"level"`
|
||||
IsRecovery bool `json:"is_recovery"`
|
||||
}
|
||||
|
||||
// EvalMatch represents the series violating the threshold.
|
||||
type EvalMatch struct {
|
||||
Condition string `json:"condition"`
|
||||
Value *float64 `json:"value"`
|
||||
Metric string `json:"metric"`
|
||||
Tags map[string]string `json:"tags"`
|
||||
}
|
||||
|
||||
77
pkg/apis/monitor/zz_generated.model.go
Normal file
77
pkg/apis/monitor/zz_generated.model.go
Normal file
@@ -0,0 +1,77 @@
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
// Code generated by model-api-gen. DO NOT EDIT.
|
||||
|
||||
package monitor
|
||||
|
||||
import (
|
||||
time "time"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/apis"
|
||||
)
|
||||
|
||||
// SAlert is an autogenerated struct via yunion.io/x/onecloud/pkg/monitor/models.SAlert.
|
||||
type SAlert struct {
|
||||
apis.SVirtualResourceBase
|
||||
Frequency int64 `json:"frequency"`
|
||||
Settings interface{} `json:"settings"`
|
||||
Level string `json:"level"`
|
||||
Message string `json:"message"`
|
||||
UsedBy string `json:"used_by"`
|
||||
// Silenced bool
|
||||
ExecutionError string `json:"execution_error"`
|
||||
For int64 `json:"for"`
|
||||
EvalData interface{} `json:"eval_data"`
|
||||
State string `json:"state"`
|
||||
NoDataState string `json:"no_data_state"`
|
||||
ExecutionErrorState string `json:"execution_error_state"`
|
||||
LastStateChange time.Time `json:"last_state_change"`
|
||||
StateChanges int `json:"state_changes"`
|
||||
}
|
||||
|
||||
// SAlertJointsBase is an autogenerated struct via yunion.io/x/onecloud/pkg/monitor/models.SAlertJointsBase.
|
||||
type SAlertJointsBase struct {
|
||||
apis.SVirtualJointResourceBase
|
||||
AlertId string `json:"alert_id"`
|
||||
}
|
||||
|
||||
// SAlertnotification is an autogenerated struct via yunion.io/x/onecloud/pkg/monitor/models.SAlertnotification.
|
||||
type SAlertnotification struct {
|
||||
SAlertJointsBase
|
||||
NotificationId string `json:"notification_id"`
|
||||
State string `json:"state"`
|
||||
Index byte `json:"index"`
|
||||
UsedBy string `json:"used_by"`
|
||||
}
|
||||
|
||||
// SDataSource is an autogenerated struct via yunion.io/x/onecloud/pkg/monitor/models.SDataSource.
|
||||
type SDataSource struct {
|
||||
apis.SStandaloneResourceBase
|
||||
Type string `json:"type"`
|
||||
Url string `json:"url"`
|
||||
User string `json:"user"`
|
||||
Password string `json:"password"`
|
||||
Database string `json:"database"`
|
||||
IsDefault *bool `json:"is_default,omitempty"`
|
||||
}
|
||||
|
||||
// SNotification is an autogenerated struct via yunion.io/x/onecloud/pkg/monitor/models.SNotification.
|
||||
type SNotification struct {
|
||||
apis.SVirtualResourceBase
|
||||
Type string `json:"type"`
|
||||
IsDefault bool `json:"is_default"`
|
||||
SendReminder bool `json:"send_reminder"`
|
||||
DisableResolveMessage bool `json:"disable_resolve_message"`
|
||||
Frequency int64 `json:"frequency"`
|
||||
Settings interface{} `json:"settings"`
|
||||
}
|
||||
@@ -19,7 +19,7 @@ import "yunion.io/x/onecloud/pkg/apis"
|
||||
type ContactDetails struct {
|
||||
apis.ModelBaseDetails
|
||||
|
||||
Id string `json:"id"`
|
||||
UID string `json:"uid"`
|
||||
Name string `json:"name"`
|
||||
Details string `json:"details"`
|
||||
}
|
||||
|
||||
@@ -77,6 +77,7 @@ type ScheduleInput struct {
|
||||
LiveMigrate bool `json:"live_migrate"`
|
||||
CpuDesc string `json:"cpu_desc"`
|
||||
CpuMicrocode string `json:"cpu_microcode"`
|
||||
CpuMode string `json:"cpu_mode"`
|
||||
|
||||
PendingUsages []jsonutils.JSONObject
|
||||
}
|
||||
@@ -93,6 +94,17 @@ type CandidateDisk struct {
|
||||
StorageIds []string `json:"storage_ids"`
|
||||
}
|
||||
|
||||
type CandidateDiskV2 struct {
|
||||
Index int `json:"index"`
|
||||
Storages []*CandidateStorage `json:"storages"`
|
||||
}
|
||||
|
||||
type CandidateStorage struct {
|
||||
Id string
|
||||
Name string
|
||||
FreeCapacity int64
|
||||
}
|
||||
|
||||
type CandidateNet struct {
|
||||
Index int `json:"index"`
|
||||
NetworkIds []string `json:"network_ids"`
|
||||
|
||||
@@ -268,7 +268,7 @@ func (app *Application) defaultHandle(w http.ResponseWriter, r *http.Request, ri
|
||||
hand, ok := handler.(*SHandlerInfo)
|
||||
if ok {
|
||||
fw := newResponseWriterChannel(w)
|
||||
worker := make(chan *SWorker)
|
||||
currentWorker := make(chan *SWorker, 1) // make it a buffered channel
|
||||
to := hand.FetchProcessTimeout(r)
|
||||
if to == 0 {
|
||||
to = app.processTimeout
|
||||
@@ -320,13 +320,13 @@ func (app *Application) defaultHandle(w http.ResponseWriter, r *http.Request, ri
|
||||
} // otherwise, the task has been timeout
|
||||
fw.closeChannels()
|
||||
},
|
||||
worker,
|
||||
currentWorker,
|
||||
func(err error) {
|
||||
httperrors.InternalServerError(&fw, "Internal server error: %s", err)
|
||||
fw.closeChannels()
|
||||
},
|
||||
)
|
||||
runErr := fw.wait(ctx, worker)
|
||||
runErr := fw.wait(ctx, currentWorker)
|
||||
if runErr != nil {
|
||||
switch runErr.(type) {
|
||||
case *httputils.JSONClientError:
|
||||
|
||||
@@ -100,7 +100,12 @@ func (w *responseWriterChannel) wait(ctx context.Context, workerChan chan *SWork
|
||||
stop := false
|
||||
for !stop {
|
||||
select {
|
||||
case worker = <-workerChan:
|
||||
case curWorker, more := <-workerChan:
|
||||
if more {
|
||||
worker = curWorker
|
||||
} else {
|
||||
// ignore, worker is responsible for close the channel
|
||||
}
|
||||
case <-ctx.Done():
|
||||
// ctx deadline reached, timeout
|
||||
if worker != nil {
|
||||
|
||||
@@ -189,10 +189,11 @@ func (job *SLogFetchJob) Do(ctx context.Context, now time.Time) error {
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "fetchLogs api.EVENT_TYPE_SYSTEM")
|
||||
}
|
||||
err = fetchLogs(job.baremetal, ctx, redfish.EVENT_TYPE_MANAGER)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "fetchLogs api.EVENT_TYPE_MANAGER")
|
||||
}
|
||||
// no longer fetch management logs
|
||||
// err = fetchLogs(job.baremetal, ctx, redfish.EVENT_TYPE_MANAGER)
|
||||
// if err != nil {
|
||||
// return errors.Wrap(err, "fetchLogs api.EVENT_TYPE_MANAGER")
|
||||
// }
|
||||
job.lastTime = now
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ import (
|
||||
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/log"
|
||||
"yunion.io/x/pkg/errors"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/appsrv"
|
||||
"yunion.io/x/onecloud/pkg/baremetal"
|
||||
@@ -71,6 +72,7 @@ func initBaremetalsHandler(app *appsrv.Application) {
|
||||
AddHandler(app, "POST", bmActionPrefix("reset-bmc"), bmObjMiddleware(handleBaremetalResetBMC))
|
||||
AddHandler(app, "POST", bmActionPrefix("ipmi-probe"), bmObjMiddleware(handleBaremetalIpmiProbe))
|
||||
AddHandler(app, "POST", bmActionPrefix("cdrom"), bmObjMiddleware(handleBaremetalCdromTask))
|
||||
AddHandler(app, "POST", bmActionPrefix("jnlp"), bmObjMiddleware(handleBaremetalJnlpTask))
|
||||
|
||||
// server actions handler
|
||||
AddHandler(app, "POST", srvActionPrefix("create"), srvClassMiddleware(handleServerCreate))
|
||||
@@ -160,6 +162,17 @@ func handleBaremetalCdromTask(ctx *Context, bm *baremetal.SBaremetalInstance) {
|
||||
ctx.ResponseOk()
|
||||
}
|
||||
|
||||
func handleBaremetalJnlpTask(ctx *Context, bm *baremetal.SBaremetalInstance) {
|
||||
jnlp, err := bm.GetConsoleJNLP(ctx)
|
||||
if err != nil {
|
||||
ctx.ResponseError(errors.Wrap(err, "GetConsoleJNLP"))
|
||||
return
|
||||
}
|
||||
result := jsonutils.NewDict()
|
||||
result.Add(jsonutils.NewString(jnlp), "jnlp")
|
||||
ctx.ResponseJson(result)
|
||||
}
|
||||
|
||||
func handleServerCreate(ctx *Context, bm *baremetal.SBaremetalInstance) {
|
||||
err := bm.StartServerCreateTask(ctx.UserCred(), ctx.TaskId(), ctx.Data())
|
||||
if err != nil {
|
||||
|
||||
@@ -64,6 +64,7 @@ import (
|
||||
"yunion.io/x/onecloud/pkg/util/influxdb"
|
||||
"yunion.io/x/onecloud/pkg/util/procutils"
|
||||
"yunion.io/x/onecloud/pkg/util/redfish"
|
||||
"yunion.io/x/onecloud/pkg/util/redfish/bmconsole"
|
||||
"yunion.io/x/onecloud/pkg/util/ssh"
|
||||
"yunion.io/x/onecloud/pkg/util/sysutils"
|
||||
)
|
||||
@@ -1235,7 +1236,12 @@ func (b *SBaremetalInstance) enableWire(mac net.HardwareAddr, ipAddr string, nic
|
||||
|
||||
func (b *SBaremetalInstance) GetIPMIConfig() *types.SIPMIInfo {
|
||||
conf := b.GetRawIPMIConfig()
|
||||
if conf == nil || conf.Password == "" {
|
||||
if conf == nil {
|
||||
log.Debugf("GetIPMIConfig conf is nil")
|
||||
return nil
|
||||
}
|
||||
if conf.Password == "" {
|
||||
log.Debugf("GetIPMIConfig password is nil")
|
||||
return nil
|
||||
}
|
||||
if conf.Username == "" {
|
||||
@@ -1254,6 +1260,7 @@ func (b *SBaremetalInstance) GetIPMIConfig() *types.SIPMIInfo {
|
||||
}
|
||||
conf.Password = utils.Unquote(conf.Password) // XXX: remove quotes!!!
|
||||
if conf.IpAddr == "" {
|
||||
log.Debugf("GetIPMIConfig ipaddr s nil")
|
||||
return nil
|
||||
}
|
||||
return conf
|
||||
@@ -1336,6 +1343,7 @@ func (b *SBaremetalInstance) SetExistingIPMIIPAddr(ipAddr string) {
|
||||
func (b *SBaremetalInstance) GetIPMITool() *ipmitool.LanPlusIPMI {
|
||||
conf := b.GetIPMIConfig()
|
||||
if conf == nil {
|
||||
log.Debugf("GetIPMIConfig is nil")
|
||||
return nil
|
||||
}
|
||||
return ipmitool.NewLanPlusIPMI(conf.IpAddr, conf.Username, conf.Password)
|
||||
@@ -1632,6 +1640,10 @@ func (b *SBaremetalInstance) DelayedSyncIPMIInfo(data jsonutils.JSONObject) (jso
|
||||
}
|
||||
|
||||
func (b *SBaremetalInstance) DelayedSyncDesc(data jsonutils.JSONObject) (jsonutils.JSONObject, error) {
|
||||
if data == nil {
|
||||
session := b.manager.GetClientSession()
|
||||
data, _ = b.manager.fetchBaremetal(session, b.GetId())
|
||||
}
|
||||
err := b.SaveDesc(data)
|
||||
return nil, err
|
||||
}
|
||||
@@ -1924,6 +1936,25 @@ func (b *SBaremetalInstance) fetchPowerThermalMetrics(ctx context.Context) ([]in
|
||||
return powerMetrics, thermalMetrics, nil
|
||||
}
|
||||
|
||||
func (b *SBaremetalInstance) GetConsoleJNLP(ctx context.Context) (string, error) {
|
||||
cli := b.GetRedfishCli(ctx)
|
||||
if cli != nil {
|
||||
return cli.GetConsoleJNLP(ctx)
|
||||
}
|
||||
conf := b.GetIPMIConfig()
|
||||
bmc := bmconsole.NewBMCConsole(conf.IpAddr, conf.Username, conf.Password, false)
|
||||
manufacture := b.GetManufacture()
|
||||
switch strings.ToLower(manufacture) {
|
||||
case "hp", "hpe":
|
||||
return bmc.GetIloConsoleJNLP(ctx)
|
||||
case "dell", "dell inc.":
|
||||
return bmc.GetIdracConsoleJNLP(ctx, "", "")
|
||||
case "supermicro":
|
||||
return bmc.GetSupermicroConsoleJNLP(ctx)
|
||||
}
|
||||
return "", httperrors.NewNotImplementedError("Unsupported manufacture %s", manufacture)
|
||||
}
|
||||
|
||||
func (b *SBaremetalInstance) getTags() []influxdb.SKeyValue {
|
||||
tags := []influxdb.SKeyValue{
|
||||
{
|
||||
|
||||
@@ -43,7 +43,7 @@ func InspurProfile() IPMIProfile {
|
||||
|
||||
func LenovoProfile() IPMIProfile {
|
||||
return IPMIProfile{
|
||||
LanChannel: []int{8},
|
||||
LanChannel: []int{1, 8},
|
||||
RootName: "root",
|
||||
RootId: 2,
|
||||
}
|
||||
@@ -51,7 +51,7 @@ func LenovoProfile() IPMIProfile {
|
||||
|
||||
func HpProfile() IPMIProfile {
|
||||
return IPMIProfile{
|
||||
LanChannel: []int{2},
|
||||
LanChannel: []int{1, 2},
|
||||
RootName: "root",
|
||||
RootId: 1,
|
||||
}
|
||||
|
||||
@@ -64,6 +64,7 @@ func (s *BaremetalService) StartService() {
|
||||
|
||||
fsdriver.Init(nil)
|
||||
app := app_common.InitApp(&o.Options.BaseOptions, false)
|
||||
|
||||
handler.InitHandlers(app)
|
||||
|
||||
s.startAgent(app)
|
||||
|
||||
@@ -306,7 +306,13 @@ func (self *SBaremetalTaskBase) EnsurePowerUp() error {
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "Get power status")
|
||||
}
|
||||
maxTries := 10
|
||||
count := 0
|
||||
for status == "" || status == types.POWER_STATUS_OFF {
|
||||
if count > maxTries {
|
||||
break
|
||||
}
|
||||
log.Infof("Try power on %d times, pxe boot %v", count+1, self.PxeBoot)
|
||||
if status == types.POWER_STATUS_OFF {
|
||||
if self.PxeBoot {
|
||||
err = self.Baremetal.DoPXEBoot()
|
||||
@@ -314,7 +320,7 @@ func (self *SBaremetalTaskBase) EnsurePowerUp() error {
|
||||
err = self.Baremetal.DoRedfishPowerOn()
|
||||
}
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "Do boot power on")
|
||||
log.Warningf("Do boot power on error: %v", err)
|
||||
}
|
||||
}
|
||||
status, err = self.Baremetal.GetPowerStatus()
|
||||
@@ -328,6 +334,7 @@ func (self *SBaremetalTaskBase) EnsurePowerUp() error {
|
||||
return err
|
||||
}
|
||||
}
|
||||
count++
|
||||
}
|
||||
if status != types.POWER_STATUS_ON {
|
||||
return fmt.Errorf("Baremetal invalid restart status: %s", status)
|
||||
|
||||
@@ -108,7 +108,9 @@ func (task *sBaremetalPrepareTask) prepareBaremetalInfo(cli *ssh.Client) (*barem
|
||||
if len(raidDiskInfo) > 0 {
|
||||
raidDrivers := []string{}
|
||||
for _, drv := range raidDiskInfo {
|
||||
raidDrivers = append(raidDrivers, drv.Driver)
|
||||
if !utils.IsInStringArray(drv.Driver, raidDrivers) {
|
||||
raidDrivers = append(raidDrivers, drv.Driver)
|
||||
}
|
||||
}
|
||||
storageDriver = strings.Join(raidDrivers, ",")
|
||||
} else {
|
||||
|
||||
@@ -28,6 +28,7 @@ import (
|
||||
|
||||
func InitApp(options *common_options.BaseOptions, dbAccess bool) *appsrv.Application {
|
||||
// cache := appsrv.NewCache(options.AuthTokenCacheSize)
|
||||
log.Infof("RequestWorkerCount: %d", options.RequestWorkerCount)
|
||||
app := appsrv.NewApplication(options.ApplicationID, options.RequestWorkerCount, dbAccess)
|
||||
app.CORSAllowHosts(options.CorsHosts)
|
||||
|
||||
|
||||
@@ -402,7 +402,7 @@ func FetchServerCreateInputByJSON(obj jsonutils.JSONObject) (*compute.ServerCrea
|
||||
input.InstanceType = skuName
|
||||
}
|
||||
if keypair := jsonutils.GetAnyString(obj, []string{"keypair", "keypair_id"}); keypair != "" {
|
||||
input.KeypairId = keypair
|
||||
input.Keypair = keypair
|
||||
}
|
||||
if secgroup := jsonutils.GetAnyString(obj, []string{"secgroup", "secgroup_id", "secgrp_id"}); len(secgroup) != 0 {
|
||||
input.SecgroupId = secgroup
|
||||
|
||||
@@ -16,6 +16,8 @@ package consts
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"yunion.io/x/log"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -58,6 +60,7 @@ func GetTenantCacheExpireSeconds() time.Duration {
|
||||
}
|
||||
|
||||
func SetNonDefaultDomainProjects(val bool) {
|
||||
log.Infof("set non_default_domain_projects to %v", val)
|
||||
nonDefaultDomainProjects = val
|
||||
}
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ func InitDB(options *common_options.DBOptions) {
|
||||
|
||||
dialect, sqlStr, err := options.GetDBConnection()
|
||||
if err != nil {
|
||||
log.Fatalf("Invalid SqlConnection string: %s", options.SqlConnection)
|
||||
log.Fatalf("Invalid SqlConnection string: %s error: %v", options.SqlConnection, err)
|
||||
}
|
||||
dbConn, err := sql.Open(dialect, sqlStr)
|
||||
if err != nil {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user