Compare commits

...

223 Commits

Author SHA1 Message Date
Zexi Li
8c74fe459c Merge pull request #15204 from zexi/ansible-run-time
fix(ansibleserver): force sleep 50s before running
2022-10-18 10:48:45 +08:00
Zexi Li
f239e34d1b fix(ansibleserver): force sleep 50s before running 2022-10-18 10:23:48 +08:00
屈轩
9c733ff130 fix(websonsole): vnc query (#15197) 2022-10-15 22:05:26 +08:00
屈轩
aacdf17099 fix(glance): esxi vmdk requre streamOptimized (#15181) 2022-10-15 22:03:44 +08:00
Zexi Li
07f6572159 Merge pull request #15200 from gouqi11/automated-cherry-pick-of-#15198-upstream-release-3.9
Automated cherry pick of #15198: fix/huawei-aksk-createdAt
2022-10-14 21:12:33 +08:00
mhf
234741d0c4 fix/huawei-aksk-createdAt 2022-10-14 19:38:23 +08:00
Zexi Li
e842e970ba Merge pull request #15193 from zexi/automated-cherry-pick-of-#15192-upstream-release-3.9
Automated cherry pick of #15192: fix(scheduler): check free capacity of each storage
2022-10-14 13:33:06 +08:00
Zexi Li
acbbb6d6f5 fix(scheduler): check free capacity of each storage 2022-10-14 12:40:26 +08:00
Zexi Li
3769869a08 Merge pull request #15188 from ioito/automated-cherry-pick-of-#15187-upstream-release-3.9
Automated cherry pick of #15187: fix(region): optimized sku list
2022-10-14 10:35:13 +08:00
Zexi Li
4b0bdcfe8b Merge pull request #15184 from ioito/automated-cherry-pick-of-#15183-upstream-release-3.9
Automated cherry pick of #15183: fix(region): skip account check
2022-10-14 10:33:52 +08:00
ioito
9151709473 fix(region): optimized sku list 2022-10-13 18:12:31 +08:00
ioito
fb0645e837 fix(region): skip account check 2022-10-13 17:00:12 +08:00
Zexi Li
cfa36774e7 Merge pull request #15180 from ioito/automated-cherry-pick-of-#15179-upstream-release-3.9
Automated cherry pick of #15179: fix(region): skip duplicate account check
2022-10-13 12:14:38 +08:00
ioito
b4516df1a4 fix(region): skip duplicate account check 2022-10-13 12:07:22 +08:00
Zexi Li
6ccd2801f0 Merge pull request #15178 from swordqiu/automated-cherry-pick-of-#15177-upstream-release-3.9
Automated cherry pick of #15177: fix: disk fallocate support
2022-10-13 09:47:44 +08:00
Zexi Li
0baca192e3 Merge pull request #15164 from swordqiu/automated-cherry-pick-of-#15163-upstream-release-3.9
Automated cherry pick of #15163: fix: ssd(rotation_rate=1) option only applicable to scsi-hd device
2022-10-13 09:46:30 +08:00
Zexi Li
fe7cbbfee8 Merge pull request #15157 from ioito/automated-cherry-pick-of-#15156-upstream-release-3.9
Automated cherry pick of #15156: fix(region): openstack vnc
2022-10-13 09:46:00 +08:00
Zexi Li
fdbf01e158 Merge pull request #15171 from ioito/automated-cherry-pick-of-#15170-upstream-release-3.9
Automated cherry pick of #15170: fix(region): purge vm by tags
2022-10-13 09:45:19 +08:00
Zexi Li
e86e4d64e4 Merge pull request #15173 from ioito/automated-cherry-pick-of-#15172-upstream-release-3.9
Automated cherry pick of #15172: fix(cloudmon): show unmarshal error
2022-10-13 09:44:54 +08:00
Jian Qiu
fc916a22f2 fix: no etcd watching if endpoint type is not internal (#15176)
Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
2022-10-13 09:36:52 +08:00
Qiu Jian
2887c8196f fix: disk fallocate support 2022-10-13 02:37:50 +08:00
ioito
3e7a321ad3 fix(cloudmon): show unmarshal error 2022-10-12 17:41:30 +08:00
ioito
dcf7bde095 fix(region): purge vm by tags 2022-10-12 16:36:25 +08:00
Zexi Li
9b2208a565 Merge pull request #15166 from ioito/automated-cherry-pick-of-#15165-upstream-release-3.9
Automated cherry pick of #15165: fix(region): avoid panic
2022-10-12 16:32:41 +08:00
ioito
4dad40e3b2 fix(region): avoid panic 2022-10-12 15:15:09 +08:00
屈轩
4142d03cce fix: climc image cache (#15153) 2022-10-12 14:55:49 +08:00
wanyaoqi
39bcd4c471 fix(region): only kvm use qgs set password in guest running status (#15159)
Signed-off-by: wanyaoqi <d3lx.yq@gmail.com>

Signed-off-by: wanyaoqi <d3lx.yq@gmail.com>
2022-10-12 14:55:12 +08:00
Qiu Jian
9ad72f63f2 fix: ssd(rotation_rate=1) option only applicable to scsi-hd device 2022-10-12 14:54:05 +08:00
Jian Qiu
5150d3d86d fix: debian 11 support missing at release/3.8 (#15161)
Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
2022-10-11 21:18:14 +08:00
ioito
47024114c6 fix(region): openstack vnc 2022-10-11 16:52:41 +08:00
Zexi Li
34266ad52e Merge pull request #15151 from wanyaoqi/automated-cherry-pick-of-#15150-upstream-release-3.9
Automated cherry pick of #15150: fix(host-image): cancel auth host-image http requests
2022-10-11 10:45:27 +08:00
Zexi Li
8e942046e6 Merge pull request #15141 from ioito/automated-cherry-pick-of-#15137-upstream-release-3.9
Automated cherry pick of #15137: fix(region): snapshot time zone
2022-10-11 10:43:56 +08:00
Zexi Li
b3afdc7b93 Merge pull request #15135 from swordqiu/automated-cherry-pick-of-#15134-upstream-release-3.9
Automated cherry pick of #15134: fix: override valid os info in metadata
2022-10-11 10:42:38 +08:00
Zexi Li
08411e3061 Merge pull request #15139 from ioito/automated-cherry-pick-of-#15138-upstream-release-3.9
Automated cherry pick of #15138: fix(region): lb sync panic
2022-10-11 10:40:58 +08:00
Zexi Li
d08864d9e7 Merge pull request #15155 from ioito/automated-cherry-pick-of-#15154-upstream-release-3.9
Automated cherry pick of #15154: fix(region): oss permission
2022-10-11 10:38:59 +08:00
ioito
62362a1887 fix(region): oss permission 2022-10-10 19:15:00 +08:00
Zexi Li
167d3d25e8 Merge pull request #15149 from ioito/automated-cherry-pick-of-#15148-upstream-release-3.9
Automated cherry pick of #15148: fix(region): apsara region endpoint
2022-10-10 15:50:47 +08:00
wanyaoqi
a92e4d72a2 fix(host-image): cancel auth host-image http requests 2022-10-10 10:51:07 +08:00
ioito
4d6490e7a1 fix(region): apsara region endpoint 2022-10-10 10:38:40 +08:00
Qiu Jian
807631b7ca fix: override valid os info in metadata 2022-10-09 23:55:34 +08:00
wanyaoqi
be9bd32824 fix(region): recover code remove by #14996 (#15145)
Signed-off-by: wanyaoqi <d3lx.yq@gmail.com>

Signed-off-by: wanyaoqi <d3lx.yq@gmail.com>
2022-10-09 23:53:49 +08:00
wanyaoqi
8742ba05d5 fix(host): marshal cycle struct guest (#15146)
Signed-off-by: wanyaoqi <d3lx.yq@gmail.com>

Signed-off-by: wanyaoqi <d3lx.yq@gmail.com>
2022-10-09 23:49:00 +08:00
ioito
8271d86911 fix(region): snapshot time zone 2022-10-09 16:21:56 +08:00
ioito
04ac34755c fix(region): lb sync panic 2022-10-09 15:46:39 +08:00
Zexi Li
3e6d9f0a59 Merge pull request #15103 from ioito/automated-cherry-pick-of-#15102-upstream-release-3.9
Automated cherry pick of #15102: fix(region): azure resource group
2022-10-09 15:36:09 +08:00
Zexi Li
2fea602ecd Merge pull request #15132 from ioito/automated-cherry-pick-of-#15131-upstream-release-3.9
Automated cherry pick of #15131: fix(region): add project tag short desc
2022-10-09 00:26:16 +08:00
Zexi Li
31540c1feb Merge pull request #15129 from ioito/automated-cherry-pick-of-#15128-upstream-release-3.9
Automated cherry pick of #15128: fix(cloudid): aliyun saml provider name
2022-10-09 00:25:17 +08:00
ioito
c66e16190b fix(region): azure resource group 2022-10-08 21:28:31 +08:00
Zexi Li
8b3f7ef336 optimize(scheduler): global cache for schedtag (#15120)
* optimize(scheduler): global cache for schedtag

* feat(scheduler): informer of schedtag
2022-10-08 20:49:26 +08:00
ioito
57005da632 fix(region): add project tag short desc 2022-10-08 18:21:40 +08:00
ioito
68a98c8eb6 fix(cloudid): aliyun saml provider name 2022-10-08 15:39:25 +08:00
Zexi Li
8dd802204f Merge pull request #15123 from ioito/automated-cherry-pick-of-#15122-upstream-release-3.9
Automated cherry pick of #15122: fix(region): modelarts change config
2022-10-08 14:45:54 +08:00
ioito
043b24cca1 fix(region): modelarts change config 2022-10-08 14:28:34 +08:00
Zexi Li
4534f951b1 Merge pull request #15117 from zexi/monitor-error-msg
fix(monitor): monitor error message
2022-10-08 12:03:24 +08:00
Zexi Li
02447ea1f9 fix(monitor): monitor error message 2022-10-08 11:49:18 +08:00
Jian Qiu
3b64b8709e fix: preserve os info of instance (#15115)
Co-authored-by: QIU Jian <qiujian@yunionyun.com>
2022-10-08 11:19:51 +08:00
Jian Qiu
117c5d60f4 update vendor wireguard 20221005 (#15113)
Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
2022-10-05 17:17:53 +08:00
Zexi Li
5c9016bd0c Merge pull request #15110 from gouqi11/automated-cherry-pick-of-#15109-upstream-release-3.9
Automated cherry pick of #15109: fix modelarts status bug
2022-09-30 11:53:28 +08:00
mhf
c8c80dc95d fix modelarts status bug 2022-09-30 11:39:13 +08:00
Zexi Li
43154ddc00 Merge pull request #15106 from swordqiu/automated-cherry-pick-of-#15105-upstream-release-3.9
Automated cherry pick of #15105: fix: do not resize partition of unsupported fs
2022-09-29 10:08:07 +08:00
Qiu Jian
60d45f698b fix: do not resize partition of unsupported fs 2022-09-29 00:56:26 +08:00
Zexi Li
a7ee027326 Merge pull request #15101 from ioito/automated-cherry-pick-of-#15100-upstream-release-3.9
Automated cherry pick of #15100: fix(cloudmon): remove cloudmon metadata tag
2022-09-28 19:32:08 +08:00
ioito
b98983a2df fix(cloudmon): remove cloudmon metadata tag 2022-09-28 18:16:58 +08:00
Zexi Li
1b50d263c4 Merge pull request #15097 from zexi/ansible-sleep
fix(ansibleserver): force sleep 15s before running playbook
2022-09-28 17:38:52 +08:00
Zexi Li
24a3ff8fa9 fix(ansibleserver): force sleep 15s before running playbook 2022-09-28 17:21:56 +08:00
wanyaoqi
6d2e8fdfc1 fix(region): check migration bandwidth is nil (#15095) 2022-09-28 16:41:45 +08:00
Zexi Li
6a9dc28b72 Merge pull request #15096 from gouqi11/automated-cherry-pick-of-#15094-upstream-release-3.9
Automated cherry pick of #15094: add modelarts nodecount
2022-09-28 16:11:34 +08:00
mhf
de65b32a47 add modelarts nodecount 2022-09-28 15:49:30 +08:00
屈轩
e715a725db fix(cloudid): azure cloudgroup (#15093) 2022-09-28 15:27:28 +08:00
屈轩
6119e60c46 fix(monitor): rename tags to tag_pairs (#15088) 2022-09-28 15:26:40 +08:00
wanyaoqi
20b7b9b9f6 fix(host): rbd snap delete (#15083) 2022-09-28 15:25:27 +08:00
wanyaoqi
7d0a88a605 Automated cherry pick of #15067: fix(region): host health use sync map (#15085)
* fix(region): host health use sync map

Signed-off-by: wanyaoqi <d3lx.yq@gmail.com>

* fix auto migrate on host shutdown

Signed-off-by: wanyaoqi <d3lx.yq@gmail.com>
2022-09-28 14:12:56 +08:00
Zexi Li
0516f72f46 fix(cloudcommon): notify event of specific resources (#15089) 2022-09-28 13:00:56 +08:00
Zexi Li
c4f0cb4dcd fix(host): out of range when list GPU devices (#15081) 2022-09-28 07:52:56 +08:00
屈轩
f8ef56cf38 fix(region): secgroup rule sync (#15076) 2022-09-27 21:23:00 +08:00
屈轩
aa99aa449e fix(climc): add debug for esxicli (#15060) 2022-09-27 21:22:08 +08:00
Zexi Li
386467927a fix(monitor): not depend taskman to execute async task (#15064) 2022-09-27 21:14:21 +08:00
Zexi Li
f9281c738d fix(cloudcommon): invoke model.PostUpdate when differences exist (#15069) 2022-09-27 21:10:52 +08:00
屈轩
ed8af7fc6f fix(cloudid): azure clouduser (#15073) 2022-09-27 21:10:04 +08:00
屈轩
077390519d fix(cloudmon): remove special characters (#15063) 2022-09-27 21:04:13 +08:00
Zexi Li
791e0753c4 Merge pull request #15058 from zexi/automated-cherry-pick-of-#15053-upstream-release-3.9
Automated cherry pick of #15053: feat(host): deploy telegraf in windows guest
2022-09-27 11:32:14 +08:00
wanyaoqi
ad0d7fde15 feat(host): deploy telegraf in windows guest
depends on telegraf service install command.
2022-09-27 11:31:51 +08:00
Zexi Li
59780e863d Merge pull request #15034 from wanyaoqi/automated-cherry-pick-of-#15033-upstream-release-3.9
Automated cherry pick of #15033: fix(region): migrate forecase add rescue mode
2022-09-26 15:22:59 +08:00
Zexi Li
fec651c425 Merge pull request #15050 from zexi/baremetal-storage
feat(region): is_baremetal option for storage list
2022-09-26 15:20:07 +08:00
Zexi Li
968cd4e6ff Merge pull request #15049 from ioito/automated-cherry-pick-of-#15048-upstream-release-3.9
Automated cherry pick of #15048: fix(monitor): influx query
2022-09-26 15:04:51 +08:00
Zexi Li
ee78115b44 feat(region): is_baremetal option for storage list 2022-09-26 15:02:33 +08:00
ioito
dac5f69abe fix(monitor): influx query 2022-09-26 15:01:24 +08:00
Zexi Li
309c69dcfd Merge pull request #15047 from ioito/automated-cherry-pick-of-#15046-upstream-release-3.9
Automated cherry pick of #15046: Hotfix/qx monitor misc
2022-09-26 14:06:09 +08:00
小林仔
12cbc9c697 support simple query 2022-09-26 13:28:19 +08:00
Zexi Li
8b3bb04adc Merge pull request #15042 from ioito/automated-cherry-pick-of-#15041-upstream-release-3.9
Automated cherry pick of #15041: fix(cloudid): role obs iam
2022-09-23 17:06:08 +08:00
ioito
cc56f30de8 fix(cloudid): role obs iam 2022-09-23 16:47:47 +08:00
Zexi Li
f0d7c4ea09 Merge pull request #15040 from swordqiu/automated-cherry-pick-of-#15039-upstream-release-3.9
Automated cherry pick of #15039: fix: ihost add cpu_architecture interface
2022-09-23 16:07:39 +08:00
QIU Jian
5b54fe3256 fix: ihost add cpu_architecture interface 2022-09-23 14:50:20 +08:00
wanyaoqi
4dd3a6a163 Automated cherry pick of #14996: fix(host): live migrate optimize (#15020)
* fix(host): live migrate optimize

- support set live migrate bandwidth
- support cancel migrate
- live migrate enable multifd
- cancel set live migrate max downtime in init live migrate
- save and sync guest desc and start script on sync config

* feat(region,host): server-monitor support qmp

server-montior add qmp option, default is hmp.

usage:
    climc server-monitor --qmp <ID> <COMMAND>

Signed-off-by: wanyaoqi <d3lx.yq@gmail.com>

Signed-off-by: wanyaoqi <d3lx.yq@gmail.com>
2022-09-23 14:09:47 +08:00
Jian Qiu
32931791cf fix: splitable duplicate records (#15038)
Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
2022-09-23 14:09:11 +08:00
屈轩
6c680c9294 fix(region): avoid panic when show dns zone (#15036) 2022-09-23 13:52:53 +08:00
wanyaoqi
7db9a50f79 fix(region): migrate forecase add rescue mode
Signed-off-by: wanyaoqi <wanyaoqi@yunion.cn>
2022-09-23 11:02:04 +08:00
Zexi Li
bf98f587b8 Merge pull request #15023 from swordqiu/automated-cherry-pick-of-#15022-upstream-release-3.9
Automated cherry pick of #15022: fix: esxi save image fail
2022-09-23 10:12:58 +08:00
Zexi Li
9f9e5361f3 Merge pull request #15029 from ioito/automated-cherry-pick-of-#15028-upstream-release-3.9
Automated cherry pick of #15028: fix(cloudid): obs iam
2022-09-23 10:11:04 +08:00
ioito
201443dcec fix(cloudid): obs iam 2022-09-22 22:58:00 +08:00
Zexi Li
034c743ba6 Merge pull request #15027 from gouqi11/automated-cherry-pick-of-#15024-upstream-release-3.9
Automated cherry pick of #15024: HCSO modelarts monitor
2022-09-22 20:42:33 +08:00
mhf
2dca05c9c2 delete huaweiClient 2022-09-22 18:45:39 +08:00
Qiu Jian
2462128a32 fix: esxi save image fail 2022-09-22 02:10:15 +08:00
Zexi Li
6d6e46083d Merge pull request #15021 from gouqi11/automated-cherry-pick-of-#15018-upstream-release-3.9
Automated cherry pick of #15018: [WIP]add hcso modelarts
2022-09-21 20:56:26 +08:00
mhf
a0efef4c4d resert endpoint 2022-09-21 17:55:14 +08:00
mhf
5cd9d07115 add hcso modelarts 2022-09-21 17:55:14 +08:00
Zexi Li
c9fa13c63b Merge pull request #15014 from ioito/automated-cherry-pick-of-#15013-upstream-release-3.9
Automated cherry pick of #15013: fix(region): qcloud and google system tag
2022-09-21 14:35:39 +08:00
Zexi Li
9379930c21 Merge pull request #15017 from gouqi11/automated-cherry-pick-of-#15011-upstream-release-3.9
Automated cherry pick of #15011: add hcso aksk
2022-09-20 20:26:02 +08:00
mhf
0a1307bb4d add hcso aksk 2022-09-20 20:23:33 +08:00
Zexi Li
905dc803b9 Merge pull request #15016 from ioito/automated-cherry-pick-of-#15015-upstream-release-3.9
Automated cherry pick of #15015: fix(hostman): host and vm metric id
2022-09-20 18:41:34 +08:00
Zexi Li
a7824c6e42 Merge pull request #15012 from ioito/automated-cherry-pick-of-#15009-upstream-release-3.9
Automated cherry pick of #15009: fix(cloudid): clear cloudid error
2022-09-20 18:40:08 +08:00
ioito
ce6d4da16b fix(hostman): host and vm metric id 2022-09-20 18:03:59 +08:00
ioito
fdfd9ad858 fix(region): qcloud and google system tag 2022-09-20 17:41:36 +08:00
ioito
f68f09f067 fix(cloudid): clear cloudid error 2022-09-20 16:30:00 +08:00
Zexi Li
44fc286a9c Merge pull request #15005 from zexi/update-net-vlan-id
fix(climc): always net vlan_id to 1 when updating network
2022-09-20 10:46:28 +08:00
Zexi Li
3491ebdcb9 fix(climc): always net vlan_id to 1 when updating network 2022-09-20 10:44:08 +08:00
Zexi Li
409dd98850 Merge pull request #15002 from zexi/bm-no-cache
feat(baremetal,region): support disable_image_cache for baremetalagent
2022-09-20 10:29:35 +08:00
Zexi Li
21b831252d feat(baremetal,region): support disable_image_cache for baremetalagent 2022-09-20 10:04:21 +08:00
屈轩
26c351796f fix(cloudmon): unified metric id with resource id (#14998) 2022-09-19 22:55:30 +08:00
Zexi Li
7b78f205a9 Merge pull request #14955 from wanyaoqi/automated-cherry-pick-of-#14954-upstream-release-3.9
Automated cherry pick of #14954: feat(region,host): check disk type of gpfs mountpoint
2022-09-19 22:31:16 +08:00
Zexi Li
ea99da1fb5 Merge pull request #15004 from zexi/automated-cherry-pick-of-#14954-upstream-release-3.9
Automated cherry pick of #14954: feat(region,host): check disk type of gpfs mountpoint
2022-09-19 22:28:58 +08:00
wanyaoqi
b13417cba2 feat(region,host): check disk type of gpfs mountpoint
Signed-off-by: wanyaoqi <d3lx.yq@gmail.com>
2022-09-19 22:28:27 +08:00
Zexi Li
3a573a2242 Merge pull request #15000 from gouqi11/automated-cherry-pick-of-#14987-upstream-release-3.9
Automated cherry pick of #14987: fix modelarts create bug
2022-09-19 21:23:39 +08:00
mhf
7554a59eea fix modelarts create bug 2022-09-19 19:43:58 +08:00
屈轩
16d3cdc7aa fix(region): cloudaccount options (#14991) 2022-09-17 19:38:36 +08:00
wanyaoqi
f272e65780 feat(region,host): check disk type of gpfs mountpoint
Signed-off-by: wanyaoqi <d3lx.yq@gmail.com>
2022-09-16 18:27:48 +08:00
Zexi Li
5d6a431902 fix(monitor,region,climc): use commonalert api for scaling policy (#14979)
* fix(monitor,region,climc): use commonalert api for scaling policy

* fix(monitor): use commonalert as nodealert's backend
2022-09-16 10:33:59 +08:00
Zexi Li
a9c27a2273 Merge pull request #14975 from ioito/automated-cherry-pick-of-#14974-upstream-release-3.9
Automated cherry pick of #14974: fix(cloudmon): azure windows disk usage
2022-09-16 03:06:25 +08:00
wanyaoqi
7cbf045638 fix(host): get gpu qemu params (#14982)
Signed-off-by: wanyaoqi <d3lx.yq@gmail.com>

Signed-off-by: wanyaoqi <d3lx.yq@gmail.com>
2022-09-15 22:48:53 +08:00
Zexi Li
1de4e19670 Merge pull request #14984 from gouqi11/automated-cherry-pick-of-#14983-upstream-release-3.9
Automated cherry pick of #14983: bugfix(modelarts)
2022-09-15 21:42:07 +08:00
mhf
e8228e4e3c modelartsBugFix 2022-09-15 21:40:07 +08:00
Zexi Li
077fd3f891 fix(host): no vm_scaling_group_id in hostmetrics (#14976) 2022-09-15 01:16:23 +08:00
ioito
4975acb914 fix(cloudmon): azure windows disk usage 2022-09-14 19:41:12 +08:00
Zexi Li
85c5e33cf9 Merge pull request #14973 from gouqi11/automated-cherry-pick-of-#14972-upstream-release-3.9
Automated cherry pick of #14972: modelarts
2022-09-14 16:00:44 +08:00
mhf
6671cf9fab modelarts 2022-09-14 15:34:19 +08:00
Zexi Li
6e987b0ba7 Merge pull request #14963 from ioito/automated-cherry-pick-of-#14962-upstream-release-3.9
Automated cherry pick of #14962: fix(region): azure win disk usage percent
2022-09-14 10:12:07 +08:00
Zexi Li
c9b3a4e95c Merge pull request #14964 from zexi/alert-not-recover
fix(monitor): alert resource not recorverd
2022-09-14 10:05:27 +08:00
Zexi Li
6a0b463874 Merge pull request #14968 from swordqiu/automated-cherry-pick-of-#14967-upstream-release-3.9
Automated cherry pick of #14967: fix: set vfs_cache_pressure to 350
2022-09-14 01:05:50 +08:00
Qiu Jian
cfa1f8d3a1 fix: set vfs_cache_pressure to 350 2022-09-13 17:01:29 +08:00
Zexi Li
91b1236e3f fix(monitor): alert resource not recorverd 2022-09-13 13:43:46 +08:00
ioito
586fb7f7cf fix(region): azure win disk usage percent 2022-09-13 10:40:11 +08:00
Zexi Li
8fee86088b Merge pull request #14960 from swordqiu/automated-cherry-pick-of-#14959-upstream-release-3.9
Automated cherry pick of #14959: fix: remove irrelevant common options
2022-09-13 08:56:55 +08:00
Qiu Jian
77f0dcb4c8 fix: remove irrelevant common options 2022-09-12 18:23:29 +08:00
Zexi Li
0e215facb9 fix(baremetal): clean UEFI info for baremetal host (#14956) 2022-09-12 18:19:51 +08:00
Zexi Li
4bfabe8c01 Merge pull request #14953 from wanyaoqi/automated-cherry-pick-of-#14952-upstream-release-3.9
Automated cherry pick of #14952: fix(region): format and check existing path
2022-09-09 10:01:12 +08:00
Zexi Li
eb079f2dc0 Merge pull request #14951 from wanyaoqi/automated-cherry-pick-of-#14950-upstream-release-3.9
Automated cherry pick of #14950: fix(region): check qga set password username is equal login_account
2022-09-09 10:00:50 +08:00
wanyaoqi
24acccc0bf fix(region): format and check existing path
Signed-off-by: wanyaoqi <d3lx.yq@gmail.com>
2022-09-08 20:25:52 +08:00
wanyaoqi
ae43d31287 fix(region): check qga set password username is equal login_account
Signed-off-by: wanyaoqi <d3lx.yq@gmail.com>
2022-09-08 18:01:34 +08:00
Zexi Li
5a113a4078 Merge pull request #14946 from zexi/fix-gpu-models
fix(region): gpu_models in capabilities' response
2022-09-08 14:05:33 +08:00
Zexi Li
43450da351 fix(region): gpu_models in capabilities' response 2022-09-08 13:02:42 +08:00
Zexi Li
64612c0f61 Merge pull request #14928 from wanyaoqi/automated-cherry-pick-of-#14927-upstream-release-3.9
Automated cherry pick of #14927: feat(region): set password use same interface
2022-09-07 10:48:11 +08:00
Zexi Li
d3a8fa1315 fix(scheduler): testing failed (#14942) 2022-09-07 10:47:36 +08:00
Zexi Li
70d67f9b0d Merge pull request #14923 from ioito/automated-cherry-pick-of-#14922-upstream-release-3.9
Automated cherry pick of #14922: fix(region): secgroup rule sync
2022-09-07 10:47:24 +08:00
Zexi Li
1c0b7be8f7 Merge pull request #14934 from swordqiu/automated-cherry-pick-of-#14933-upstream-release-3.9
Automated cherry pick of #14933: fix: fail to create ceph disk, missing disk credential
2022-09-07 10:38:34 +08:00
Zexi Li
1f4f93c518 Merge pull request #14931 from ioito/automated-cherry-pick-of-#14930-upstream-release-3.9
Automated cherry pick of #14930: fix(region): cloudprovider tenant id
2022-09-07 10:37:55 +08:00
Zexi Li
3fa9918f3d Merge pull request #14936 from swordqiu/automated-cherry-pick-of-#14935-upstream-release-3.9
Automated cherry pick of #14935: fix: agent pull list with system scope
2022-09-07 10:37:01 +08:00
Zexi Li
c6d0a96db9 Merge pull request #14940 from swordqiu/automated-cherry-pick-of-#14939-upstream-release-3.9
Automated cherry pick of #14939: fix: add HSTS (RFC 6797) header if TLS enabled
2022-09-07 10:36:22 +08:00
Qiu Jian
5d490741a0 fix: add HSTS (RFC 6797) header if TLS enabled https://www.tenable.com/plugins/nessus/142960 2022-09-07 10:05:02 +08:00
Qiu Jian
fffbab915b fix: agent pull list with system scope 2022-09-07 00:45:42 +08:00
Qiu Jian
3b93dfdd98 fix: fail to create ceph disk, missing disk credential 2022-09-07 00:39:43 +08:00
ioito
97df9f264d fix(region): cloudprovider tenant id 2022-09-06 20:27:23 +08:00
Zexi Li
de1d772814 Merge pull request #14926 from zexi/automated-cherry-pick-of-#14924-upstream-release-3.9
Automated cherry pick of #14924: fix(scheduler): fill storage and network results
2022-09-06 20:00:11 +08:00
wanyaoqi
489d75a5ed feat(region): set password use same interface
Signed-off-by: wanyaoqi <d3lx.yq@gmail.com>
2022-09-06 15:53:38 +08:00
Zexi Li
9c2203a73d fix(scheduler): fill storage and network results 2022-09-06 12:04:49 +08:00
wanyaoqi
64d0e84d73 feat(region,host): deploy telegraf (#14919)
Support deploy telegraf on server deploy.
Add start telegraf on guest reboot crontab in guest os.
2022-09-06 00:13:32 +08:00
ioito
dd08d21b82 fix(region): secgroup rule sync 2022-09-05 17:28:00 +08:00
Zexi Li
0b2a20f06b Merge pull request #14921 from ioito/automated-cherry-pick-of-#14920-upstream-release-3.9
Automated cherry pick of #14920: fix(cloudmon): aliyun redis metric
2022-09-05 17:09:47 +08:00
ioito
a869940020 fix(cloudmon): aliyun redis metric 2022-09-05 16:38:46 +08:00
Zexi Li
30d1798767 Merge pull request #14917 from swordqiu/automated-cherry-pick-of-#14916-upstream-release-3.9
Automated cherry pick of #14916: fix(keystone): ldap search with pagination
2022-09-05 16:16:46 +08:00
Qiu Jian
60f868b259 fix(keystone): ldap search with pagination 2022-09-04 19:31:34 +08:00
Jian Qiu
e31524bc5d feature: webhook support notification of user update (#14913)
Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
2022-09-04 05:04:23 +08:00
Zexi Li
c7fc21fe79 Merge pull request #14911 from ioito/automated-cherry-pick-of-#14910-upstream-release-3.9
Automated cherry pick of #14910: fix(cloudmon): server metric tag
2022-09-02 18:08:56 +08:00
ioito
93193e0170 fix(cloudmon): server metric tag 2022-09-02 18:03:04 +08:00
Zexi Li
c051f8f27e Merge pull request #14904 from ioito/automated-cherry-pick-of-#14903-upstream-release-3.9
Automated cherry pick of #14903: fix(cloudmon): alert history
2022-09-02 12:11:35 +08:00
Zexi Li
f9aade9c97 Merge pull request #14902 from ioito/automated-cherry-pick-of-#14901-upstream-release-3.9
Automated cherry pick of #14901: fix(cloudmon): qcloud redis metric
2022-09-02 10:45:40 +08:00
Jian Qiu
338f814cbc fix: allow update server pending deleted at (#14906)
Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
2022-09-02 10:04:56 +08:00
ioito
0b984efb97 fix(cloudmon): alert history 2022-09-01 19:27:25 +08:00
ioito
982f4fa909 fix(cloudmon): qcloud redis metric 2022-09-01 15:41:13 +08:00
Jian Qiu
965ba3ee77 fix: support huawei sms service (#14896)
Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
2022-09-01 14:49:27 +08:00
Zexi Li
9b2b4141ad Merge pull request #14898 from ioito/automated-cherry-pick-of-#14897-upstream-release-3.9
Automated cherry pick of #14897: fix(region): support distinct sku by name
2022-09-01 12:07:53 +08:00
Zexi Li
b8e1a841f1 Merge pull request #14900 from ioito/automated-cherry-pick-of-#14899-upstream-release-3.9
Automated cherry pick of #14899: fix(cloudmon): 添加监控指标描述信息
2022-09-01 12:03:07 +08:00
ioito
16fbba70c8 fix(cloudmon): 添加监控指标描述信息 2022-09-01 11:55:54 +08:00
ioito
0ca039b3ae fix(region): support distinct sku by name 2022-09-01 10:33:48 +08:00
Zexi Li
b58bcf5a74 Merge pull request #14892 from ioito/automated-cherry-pick-of-#14891-upstream-release-3.9
Automated cherry pick of #14891: fix(region): aws not found error
2022-08-31 21:00:03 +08:00
Zexi Li
3e14278698 Merge pull request #14894 from ioito/automated-cherry-pick-of-#14893-upstream-release-3.9
Automated cherry pick of #14893: fix(cloudmon): k8s metric
2022-08-31 20:59:15 +08:00
ioito
866facb6c1 fix(cloudmon): k8s metric 2022-08-31 17:58:05 +08:00
Jian Qiu
4b442acb68 feature(host-deployer): support neokylin (#14887)
Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
2022-08-31 11:21:31 +08:00
ioito
37f59cc9eb fix(region): aws not found error 2022-08-31 10:42:44 +08:00
Zexi Li
9c097bddc1 Merge pull request #14884 from ioito/automated-cherry-pick-of-#14883-upstream-release-3.9
Automated cherry pick of #14883: fix(cloudmon): bucket and redis metric
2022-08-30 19:42:27 +08:00
ioito
098b65c25d fix(cloudmon): bucket and redis metric 2022-08-30 19:17:37 +08:00
Jian Qiu
551b7dcc73 fix(notify): fail to create deleted contacts (#14882)
Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
2022-08-30 17:59:37 +08:00
Zexi Li
f6a9a12b6a Merge pull request #14880 from ioito/automated-cherry-pick-of-#14879-upstream-release-3.9
Automated cherry pick of #14879: fix(cloudmon): qcloud k8s metric
2022-08-30 17:34:41 +08:00
ioito
24fb95b01b fix(cloudmon): qcloud k8s metric 2022-08-30 17:23:02 +08:00
Zexi Li
4113a0fb24 Merge pull request #14878 from ioito/automated-cherry-pick-of-#14877-upstream-release-3.9
Automated cherry pick of #14877: fix(cloudmon): azure windows metric
2022-08-30 14:24:42 +08:00
Zexi Li
b8ad367a8c Merge pull request #14870 from ioito/automated-cherry-pick-of-#14869-upstream-release-3.9
Automated cherry pick of #14869: fix(region): show huawei cloudprovider with region name
2022-08-30 14:19:58 +08:00
ioito
a09bcb6667 fix(cloudmon): azure windows metric 2022-08-30 12:39:35 +08:00
Zexi Li
b5238c42ac Merge pull request #14872 from wanyaoqi/automated-cherry-pick-of-#14854-upstream-release-3.9
Automated cherry pick of #14854: fix(host): get unused port
2022-08-30 11:37:05 +08:00
Zexi Li
760a53ac30 Merge pull request #14853 from wanyaoqi/automated-cherry-pick-of-#14841-upstream-release-3.9
Automated cherry pick of #14841: feat(region,host): qga set user password
2022-08-30 11:36:10 +08:00
Zexi Li
f32e044737 Merge pull request #14868 from ioito/automated-cherry-pick-of-#14867-upstream-release-3.9
Automated cherry pick of #14867: fix(cloudid): support redirect url for qcloud aliyun and aws
2022-08-30 11:35:23 +08:00
Zexi Li
e274120935 Merge pull request #14856 from ioito/automated-cherry-pick-of-#14855-upstream-release-3.9
Automated cherry pick of #14855: fix(region): support enable aws monitor agent
2022-08-30 11:34:47 +08:00
Zexi Li
8c1ca83b23 Merge pull request #14874 from swordqiu/automated-cherry-pick-of-#14873-upstream-release-3.9
Automated cherry pick of #14873: fix: policy cache get/set with atomic ops
2022-08-30 11:33:55 +08:00
Zexi Li
be400a0e6e Merge pull request #14876 from ioito/automated-cherry-pick-of-#14875-upstream-release-3.9
Automated cherry pick of #14875: fix(cloudmon): huawei metric pull
2022-08-30 11:33:27 +08:00
ioito
585fa7bd35 fix(cloudmon): huawei metric pull 2022-08-30 11:11:38 +08:00
Qiu Jian
b1a5ccd153 fix: policy cache get/set with atomic ops 2022-08-30 07:34:04 +08:00
wanyaoqi
404fe5eaf7 fix(host): get unused port
add sync map avoid use the same port repeatedly.

Signed-off-by: wanyaoqi <d3lx.yq@gmail.com>
2022-08-30 00:01:07 +08:00
ioito
0b3d196bfd fix(region): show huawei cloudprovider with region name 2022-08-29 20:29:49 +08:00
ioito
04902ddd20 fix(cloudid): support redirect url for qcloud aliyun and aws 2022-08-29 19:57:37 +08:00
屈轩
37cc198f81 fix(region): jdcloud misc (#14864) 2022-08-29 18:09:48 +08:00
Jian Qiu
282cfb079f fix: add password info to server vnc info (#14862)
Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
2022-08-29 18:09:04 +08:00
Jian Qiu
02359b0bf8 feature: verify user with sms code (#14859)
Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
2022-08-29 15:39:29 +08:00
Zexi Li
3a0e3140dc Merge pull request #14852 from swordqiu/automated-cherry-pick-of-#14851-upstream-release-3.9
Automated cherry pick of #14851: feature: auth user with sms code
2022-08-29 10:50:27 +08:00
ioito
82fd9c0a7e fix(region): support enable aws monitor agent 2022-08-29 10:47:38 +08:00
wanyaoqi
1a7cd22bb8 fix: gen copyright
Signed-off-by: wanyaoqi <d3lx.yq@gmail.com>
2022-08-28 13:28:54 +08:00
wanyaoqi
07ece80f42 feat(qga): add server-qga-command
usage:
climc server-qga-command <ID> <QGA_RAW_COMMAND>

Signed-off-by: wanyaoqi <d3lx.yq@gmail.com>
2022-08-28 13:01:12 +08:00
wanyaoqi
95c836bed5 feat(region,host): qga set user password
Signed-off-by: wanyaoqi <d3lx.yq@gmail.com>
2022-08-28 13:01:11 +08:00
Qiu Jian
1d75cff5b4 feature: verify user with sms code 2022-08-28 12:30:12 +08:00
wanyaoqi
c524d488a9 fix(region): update host cpu_reserved on reserve cpus (#14848)
Signed-off-by: wanyaoqi <d3lx.yq@gmail.com>

Signed-off-by: wanyaoqi <d3lx.yq@gmail.com>
2022-08-27 06:57:26 +08:00
Zexi Li
dcd06f7c94 Merge pull request #14849 from ioito/automated-cherry-pick-of-#14752-upstream-release-3.9
Automated cherry pick of #14752: refactor(cloudmon): metric collect
2022-08-26 19:40:07 +08:00
ioito
683bc536bd refactor(cloudmon): metric collect 2022-08-26 19:38:53 +08:00
Zexi Li
898e62c42c Merge pull request #14845 from wanyaoqi/automated-cherry-pick-of-#14844-upstream-release-3.9
Automated cherry pick of #14844: feat(region,host): custom usb controller type
2022-08-26 17:10:24 +08:00
wanyaoqi
5e9dafe4a8 feat(region,host): custom usb controller type
support usb controller type: qemu-xhci, usb-ehci.
qemu-xhci is much more virtualization-friendly when compared to EHCI and UHCI.
but guest supports XHCI which should be the case for any operating system
released around 2010 or later.
So sometimes wo need use usb controller type EHCI.

Signed-off-by: wanyaoqi <d3lx.yq@gmail.com>
2022-08-26 12:32:55 +08:00
Zexi Li
19b2bbc88a Merge pull request #14840 from ioito/automated-cherry-pick-of-#14839-upstream-release-3.9
Automated cherry pick of #14839: fix(region): api version for k8s
2022-08-25 14:27:20 +08:00
ioito
ec3b2c321e fix(region): api version for k8s 2022-08-25 14:26:12 +08:00
972 changed files with 50386 additions and 72877 deletions

View File

@@ -241,6 +241,21 @@ y18n-check:
.PHONY: y18n-check
define hostdeployer-grpc-gen
set -o errexit; \
set -o pipefail; \
protoc -I pkg/hostman/hostdeployer/apis \
--go_out=pkg/hostman/hostdeployer/apis \
--go_opt=paths=source_relative \
--go-grpc_out=pkg/hostman/hostdeployer/apis \
--go-grpc_opt=paths=source_relative \
pkg/hostman/hostdeployer/apis/deploy.proto
endef
hostdeployer-grpc-gen:
$(hostdeployer-grpc-gen)
check: fmt-check
check: gendocgo-check
check: goimports-check

View File

@@ -1,4 +1,4 @@
FROM registry.cn-beijing.aliyuncs.com/yunionio/host-deployer-base:1.1
FROM registry.cn-beijing.aliyuncs.com/yunionio/host-deployer-base:1.2
MAINTAINER "Yaoqi Wan wanyaoqi@yunionyun.com"

View File

@@ -15,7 +15,10 @@
package cloudid
import (
"yunion.io/x/jsonutils"
"yunion.io/x/onecloud/cmd/climc/shell"
"yunion.io/x/onecloud/pkg/mcclient/modulebase"
modules "yunion.io/x/onecloud/pkg/mcclient/modules/cloudid"
"yunion.io/x/onecloud/pkg/mcclient/options/cloudid"
)
@@ -35,4 +38,10 @@ func init() {
cmd.Perform("reset-password", &cloudid.ClouduserResetPasswordOptions{})
cmd.Perform("cloud-user-join-group", &cloudid.ClouduserGroupOptions{})
cmd.Perform("cloud-user-leave-group", &cloudid.ClouduserGroupOptions{})
cmd.GetWithCustomShow("access-keys", func(result jsonutils.JSONObject) {
ret := modulebase.JSON2ListResult(result)
shell.PrintList(ret, nil)
}, &cloudid.ClouduserListAccessKeyInput{})
cmd.Perform("delete-access-key", &cloudid.ClouduserDeleteAccessKeyInput{})
cmd.Perform("create-access-key", &cloudid.ClouduserCreateAccessKeyInput{})
}

View File

@@ -17,69 +17,90 @@ package compute
import (
"yunion.io/x/jsonutils"
"yunion.io/x/onecloud/pkg/mcclient"
"yunion.io/x/onecloud/cmd/climc/shell"
modules "yunion.io/x/onecloud/pkg/mcclient/modules/compute"
"yunion.io/x/onecloud/pkg/mcclient/options"
)
func init() {
type BaremetalAgentListOptions struct {
options.BaseListOptions
}
R(&BaremetalAgentListOptions{}, "agent-list", "List all agent", func(s *mcclient.ClientSession, args *BaremetalAgentListOptions) error {
var params *jsonutils.JSONDict
{
var err error
params, err = args.BaseListOptions.Params()
if err != nil {
return err
}
}
result, err := modules.Baremetalagents.List(s, params)
if err != nil {
return err
}
printList(result, modules.Baremetalagents.GetColumns(s))
return nil
})
type BaremetalAgentOpsOperations struct {
ID string `help:"ID or name of agent"`
}
R(&BaremetalAgentOpsOperations{}, "agent-show", "Show details of an agent", func(s *mcclient.ClientSession, args *BaremetalAgentOpsOperations) error {
result, err := modules.Baremetalagents.Get(s, args.ID, nil)
if err != nil {
return err
}
printObject(result)
return nil
})
R(&BaremetalAgentOpsOperations{}, "agent-enable", "Enable agent", func(s *mcclient.ClientSession, args *BaremetalAgentOpsOperations) error {
result, err := modules.Baremetalagents.PerformAction(s, args.ID, "enable", nil)
if err != nil {
return err
}
printObject(result)
return nil
})
R(&BaremetalAgentOpsOperations{}, "agent-disable", "Disable agent", func(s *mcclient.ClientSession, args *BaremetalAgentOpsOperations) error {
result, err := modules.Baremetalagents.PerformAction(s, args.ID, "disable", nil)
if err != nil {
return err
}
printObject(result)
return nil
})
R(&BaremetalAgentOpsOperations{}, "agent-delete", "Delete agent", func(s *mcclient.ClientSession, args *BaremetalAgentOpsOperations) error {
result, err := modules.Baremetalagents.Delete(s, args.ID, nil)
if err != nil {
return err
}
printObject(result)
return nil
})
type AgentListOptions struct {
options.BaseListOptions
}
func (o AgentListOptions) Params() (jsonutils.JSONObject, error) {
return o.BaseListOptions.Params()
}
func (o AgentListOptions) Description() string {
return "List all agent"
}
type AgentOpsOperations struct {
ID string `help:"ID or name of agent"`
}
func (o AgentOpsOperations) GetId() string {
return o.ID
}
func (o AgentOpsOperations) Params() (jsonutils.JSONObject, error) {
return nil, nil
}
type AgentShowOpt struct {
AgentOpsOperations
}
func (o AgentShowOpt) Description() string {
return "Show details of an agent"
}
type AgentEnableOpt struct {
AgentOpsOperations
}
func (o AgentEnableOpt) Description() string {
return "Enable agent"
}
type AgentDisableOpt struct {
AgentOpsOperations
}
func (o AgentDisableOpt) Description() string {
return "Disable agent"
}
type AgentDeleteOpt struct {
AgentOpsOperations
}
func (o AgentDeleteOpt) Description() string {
return "Delete agent"
}
type AgentEnableImageCacheOpt struct {
AgentOpsOperations
}
func (o AgentEnableImageCacheOpt) Description() string {
return "Enable cache image of a agent"
}
type AgentDisableImageCacheOpt struct {
AgentOpsOperations
}
func (o AgentDisableImageCacheOpt) Description() string {
return "Disable cache image of a agent"
}
func init() {
cmd := shell.NewResourceCmd(&modules.Baremetalagents).WithKeyword("agent")
cmd.List(new(AgentListOptions))
cmd.Show(new(AgentShowOpt))
cmd.Perform("enable", new(AgentEnableOpt))
cmd.Perform("disable", new(AgentDisableOpt))
cmd.Perform("enable-image-cache", new(AgentEnableImageCacheOpt))
cmd.Perform("disable-image-cache", new(AgentDisableImageCacheOpt))
cmd.Delete(new(AgentDeleteOpt))
}

View File

@@ -47,7 +47,7 @@ func init() {
return
}
for k, v := range rc {
fmt.Printf(`export %s="%s"`+"\n", k, v)
fmt.Printf(`export %s='%s'`+"\n", k, v)
}
}, &options.BaseIdOptions{})
cmd.Get("storage-classes", &compute.CloudproviderStorageClassesOptions{})

View File

@@ -0,0 +1,31 @@
// Copyright 2019 Yunion
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package compute
import (
"yunion.io/x/onecloud/cmd/climc/shell"
modules "yunion.io/x/onecloud/pkg/mcclient/modules/compute"
"yunion.io/x/onecloud/pkg/mcclient/options"
"yunion.io/x/onecloud/pkg/mcclient/options/compute"
)
func init() {
cmd := shell.NewResourceCmd(&modules.ModelartsPools).WithKeyword("modelarts-pool")
cmd.List(&compute.ModelartsPoolListOptions{})
cmd.Delete(&options.BaseIdOptions{})
cmd.Create(&compute.ModelartsPoolCreateOption{})
cmd.Perform("syncstatus", &compute.ModelartsPoolSyncstatusOption{})
cmd.Perform("change-config", &compute.ModelartsPoolChangeConfigOption{})
}

View File

@@ -0,0 +1,26 @@
// Copyright 2019 Yunion
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package compute
import (
"yunion.io/x/onecloud/cmd/climc/shell"
modules "yunion.io/x/onecloud/pkg/mcclient/modules/compute"
"yunion.io/x/onecloud/pkg/mcclient/options/compute"
)
func init() {
cmd := shell.NewResourceCmd(&modules.ModelartsPoolSku).WithKeyword("modelarts-pool-sku")
cmd.List(&compute.ModelartsPoolSkuListOptions{})
}

View File

@@ -66,6 +66,8 @@ func init() {
cmd.PrintObjectYAML().Perform("migrate-forecast", new(options.ServerMigrateForecastOptions))
cmd.Perform("migrate", new(options.ServerMigrateOptions))
cmd.Perform("live-migrate", new(options.ServerLiveMigrateOptions))
cmd.BatchPerform("cancel-live-migrate", new(options.ServerIdsOptions))
cmd.Perform("set-live-migrate-params", new(options.ServerSetLiveMigrateParamsOptions))
cmd.Perform("modify-src-check", new(options.ServerModifySrcCheckOptions))
cmd.Perform("set-secgroup", new(options.ServerSecGroupsOptions))
cmd.Perform("add-secgroup", new(options.ServerSecGroupsOptions))
@@ -105,6 +107,10 @@ func init() {
cmd.Perform("calculate-record-checksum", &options.ServerIdOptions{})
cmd.Perform("set-class-metadata", &baseoptions.ResourceMetadataOptions{})
cmd.BatchPerform("enable-memclean", new(options.ServerIdsOptions))
cmd.Perform("qga-set-password", &options.ServerQgaSetPassword{})
cmd.Perform("qga-command", &options.ServerQgaCommand{})
cmd.Perform("set-password", &options.ServerSetPasswordOptions{})
cmd.Perform("monitor", &options.ServerMonitorOptions{})
cmd.Get("vnc", new(options.ServerIdOptions))
cmd.Get("desc", new(options.ServerIdOptions))
@@ -306,23 +312,6 @@ func init() {
return nil
})
R(&options.ServerMonitorOptions{}, "server-monitor", "Send commands to qemu monitor", func(s *mcclient.ClientSession, opts *options.ServerMonitorOptions) error {
params, err := baseoptions.StructToParams(opts)
if err != nil {
return err
}
ret, err := modules.Servers.PerformAction(s, opts.ID, "monitor", params)
if err != nil {
return err
}
result, err := ret.GetString("results")
if err != nil {
return err
}
fmt.Println(result)
return nil
})
type ServerDiskSnapshotOptions struct {
SERVER string `help:"server ID or Name"`
DISK string `help:"create snapshot disk id"`
@@ -700,10 +689,11 @@ func init() {
})
type ServerQemuParams struct {
ID string `help:"ID or name of VM"`
DisableIsaSerial string `help:"disable isa serial device" choices:"true|false"`
DisablePvpanic string `help:"disable pvpanic device" choices:"true|false"`
DisableUsbKbd string `help:"disable usb kbd" choices:"true|false"`
ID string `help:"ID or name of VM"`
DisableIsaSerial string `help:"disable isa serial device" choices:"true|false"`
DisablePvpanic string `help:"disable pvpanic device" choices:"true|false"`
DisableUsbKbd string `help:"disable usb kbd" choices:"true|false"`
UsbControllerType string `help:"usb controller type" choices:"usb-ehci|qemu-xhci"`
}
R(&ServerQemuParams{}, "server-set-qemu-params", "config qemu params", func(s *mcclient.ClientSession,
@@ -718,6 +708,9 @@ func init() {
if len(opts.DisableUsbKbd) > 0 {
params.Set("disable_usb_kbd", jsonutils.NewString(opts.DisableUsbKbd))
}
if len(opts.UsbControllerType) > 0 {
params.Set("usb_controller_type", jsonutils.NewString(opts.UsbControllerType))
}
result, err := modules.Servers.PerformAction(s, opts.ID, "set-qemu-params", params)
if err != nil {
return err

View File

@@ -74,6 +74,10 @@ func doMonitorEventList(s *mcclient.ClientSession, args *EventListOptions) error
return DoEventList(modules.MonitorLogs, s, args)
}
func doNotifyEventList(s *mcclient.ClientSession, args *EventListOptions) error {
return DoEventList(modules.NotifyLogs, s, args)
}
func DoEventList(man modulebase.ResourceManager, s *mcclient.ClientSession, args *EventListOptions) error {
params := jsonutils.NewDict()
if len(args.Type) > 0 {
@@ -262,4 +266,9 @@ func init() {
nargs := EventListOptions{BaseEventListOptions: args.BaseEventListOptions, Id: args.ID, Type: []string{"migrationalert"}}
return doMonitorEventList(s, &nargs)
})
R(&TypeEventListOptions{}, "notification-event", "Show operation event logs of a notification", func(s *mcclient.ClientSession, args *TypeEventListOptions) error {
nargs := EventListOptions{BaseEventListOptions: args.BaseEventListOptions, Id: args.ID, Type: []string{"notification"}}
return doNotifyEventList(s, &nargs)
})
}

View File

@@ -29,7 +29,7 @@ import (
func init() {
cmd := NewResourceCmd(monitor.Alerts)
cmd.List(new(options.AlertListOptions))
cmd.Create(new(options.AlertCreateOptions))
// cmd.Create(new(options.AlertCreateOptions))
cmd.Show(new(options.AlertShowOptions))
cmd.Update(new(options.AlertUpdateOptions))
cmd.BatchDelete(new(options.AlertDeleteOptions))

View File

@@ -20,7 +20,8 @@ import (
)
func init() {
cmd := NewResourceCmd(modules.CommonAlertManager)
cmd := NewResourceCmd(modules.CommonAlerts)
cmd.Create(new(options.CommonAlertCreateOptions))
cmd.List(new(options.CommonAlertListOptions))
cmd.Show(new(options.CommonAlertShowOptions))
cmd.Perform("enable", &options.CommonAlertShowOptions{})

View File

@@ -0,0 +1,26 @@
// Copyright 2019 Yunion
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package monitor
import (
"yunion.io/x/onecloud/cmd/climc/shell"
"yunion.io/x/onecloud/pkg/mcclient/modules/monitor"
options "yunion.io/x/onecloud/pkg/mcclient/options/monitor"
)
func init() {
cmd := shell.NewResourceCmd(monitor.UnifiedMonitorManager).WithKeyword("monitor")
cmd.Show(&options.SimpleQueryOptions{})
}

View File

@@ -1,158 +0,0 @@
package main
import (
"context"
"fmt"
"os"
"path"
"time"
"yunion.io/x/log"
"yunion.io/x/pkg/errors"
"yunion.io/x/pkg/util/version"
_ "yunion.io/x/onecloud/pkg/cloudmon/collectors"
"yunion.io/x/onecloud/pkg/cloudmon/options"
"yunion.io/x/onecloud/pkg/mcclient"
)
func showErrorAndExit(e error) {
fmt.Fprintf(os.Stderr, "%s", e)
fmt.Fprintln(os.Stderr)
os.Exit(1)
}
func newClientSession(options *options.CloudMonOptions) (*mcclient.ClientSession, error) {
if len(options.AuthURL) == 0 {
return nil, errors.Error("empty auth_url")
}
if len(options.AdminUser) == 0 {
return nil, errors.Error("empty admin_user")
}
if len(options.AdminPassword) == 0 {
return nil, errors.Error("empty admin_password")
}
if len(options.AdminProject) == 0 {
return nil, errors.Error("empty admin_project")
}
client := mcclient.NewClient(
options.AuthURL,
options.ReqTimeout,
options.Debug,
options.Insecure,
options.CertFile,
options.KeyFile,
)
token, err := client.AuthenticateWithSource(
options.AdminUser,
options.AdminPassword,
options.AdminDomain,
options.AdminProject,
options.AdminProjectDomain,
mcclient.AuthSourceAPI)
if err != nil {
return nil, err
}
session := client.NewSession(
context.Background(),
options.Region,
"",
options.EndpointType,
token,
)
return session, nil
}
func TestCron() {
parser, err := options.GetArgumentParser()
if err != nil {
showErrorAndExit(err)
}
err = parser.ParseArgs2(os.Args[1:], false, false)
opts := parser.Options().(*options.SubCloudMonOptions)
if opts.Help {
fmt.Println(parser.HelpString())
os.Exit(0)
}
if opts.Version {
fmt.Println(version.GetJsonString())
os.Exit(0)
}
if len(opts.Config) == 0 {
for _, p := range []string{"./etc", "/etc/yunion"} {
confTmp := path.Join(p, "cloudmon.conf")
if _, err := os.Stat(confTmp); err == nil {
opts.Config = confTmp
break
}
}
}
if len(opts.Config) > 0 {
err := parser.ParseFile(opts.Config)
if err != nil {
showErrorAndExit(err)
}
}
if err != nil {
showErrorAndExit(err)
}
parser.SetDefault()
subcmd := parser.GetSubcommand()
subparser := subcmd.GetSubParser()
if err != nil {
if subparser != nil {
fmt.Print(subparser.Usage())
} else {
fmt.Print(parser.Usage())
}
showErrorAndExit(err)
}
suboptions := subparser.Options()
if opts.Subcommand == "help" {
err = subcmd.Invoke(suboptions)
} else {
timout := suboptions.(*options.ReportOptions).Timeout
endChan := make(chan int, 1)
go func() {
ticker := time.NewTicker(time.Duration(timout) * time.Second)
for {
select {
case <-ticker.C:
log.Errorf("cmd: %s,provider: %v,end due to timeout: %d s", opts.Subcommand,
suboptions.(*options.ReportOptions).Provider, suboptions.(*options.ReportOptions).Timeout)
os.Exit(3)
case <-endChan:
}
}
}()
var session *mcclient.ClientSession
session, err = newClientSession(&opts.CloudMonOptions)
if err != nil {
showErrorAndExit(err)
}
err = subcmd.Invoke(session, suboptions)
endChan <- 1
}
if err != nil {
showErrorAndExit(err)
}
}
//func main() {
// TestCron()
//}

View File

@@ -35,6 +35,8 @@ type BaseOptions struct {
Port int `help:"Service port" default:"$VMWARE_PORT" metavar:"VMWARE_PORT"`
Account string `help:"VCenter or ESXi Account" default:"$VMWARE_ACCOUNT" metavar:"VMWARE_ACCOUNT"`
Password string `help:"Password" default:"$VMWARE_PASSWORD" metavar:"VMWARE_PASSWORD"`
Debug bool
Format string `choices:"xml|json" default:"json"`
SUBCOMMAND string `help:"aliyuncli subcommand" subcommand:"true"`
}
@@ -101,7 +103,7 @@ func newClient(options *BaseOptions) (*esxi.SESXiClient, error) {
cloudprovider.ProviderConfig{
ProxyFunc: proxyFunc,
},
),
).Debug(options.Debug).Format(options.Format),
)
}

View File

@@ -35,7 +35,7 @@ import (
type Options struct {
Debug bool `help:"Show debug" default:"false"`
AccessKey string `help:"Access key" default:"$JDCLOUD_ACCESS_KEY"`
AccessSecret string `help:"Secret" default:"$JDCLOUD_ACCESS_SECRET"`
AccessSecret string `help:"Secret" default:"$JDCLOUD_SECRET"`
RegionId string `help:"RegionId" default:"$JDCLOUD_REGION"`
SUBCOMMAND string `help:"jdcloudcli subcommand" subcommand:"true"`
}
@@ -69,7 +69,7 @@ func showErrorAndExit(e error) {
os.Exit(1)
}
func newClient(options *Options) (*jdcloud.SRegion, error) {
func newClient(options *Options) (*jdcloud.SJDCloudClient, error) {
if len(options.AccessKey) == 0 {
return nil, fmt.Errorf("Missing access key")
}
@@ -91,15 +91,16 @@ func newClient(options *Options) (*jdcloud.SRegion, error) {
return cfgProxyFunc(req.URL)
}
cfcg := &cloudprovider.ProviderConfig{
cfcg := cloudprovider.ProviderConfig{
ProxyFunc: proxyFunc,
}
region := jdcloud.NewRegion(regionId, options.AccessKey, options.AccessSecret, cfcg, options.Debug)
if region == nil {
return nil, fmt.Errorf("no such region %s", regionId)
}
return region, nil
return jdcloud.NewJDCloudClient(
jdcloud.NewJDCloudClientConfig(
options.AccessKey,
options.AccessSecret,
).CloudproviderConfig(cfcg).Debug(options.Debug),
)
}
func main() {
@@ -134,11 +135,15 @@ func main() {
fmt.Print(subparser.HelpString())
return
}
var region *jdcloud.SRegion
region, err = newClient(options)
client, err := newClient(options)
if err != nil {
showErrorAndExit(err)
}
region := client.GetRegion(options.RegionId)
if region == nil {
fmt.Printf("not found region: %s", options.RegionId)
return
}
err = subcmd.Invoke(region, suboptions)
if err != nil {
showErrorAndExit(err)

View File

@@ -40,6 +40,8 @@ func init() {
Search []string `help:"search conditions, in format of field:value"`
Field []string `help:"retrieve field info"`
Scope string `help:"query scope" choices:"one|sub" default:"sub"`
PageLimit uint32 `help:"page size" default:"100"`
Limit uint32 `help:"maximal output items"`
}
shellutils.R(&LdapSearchOptions{}, "search", "search ldap", func(cli *ldaputils.SLDAPClient, args *LdapSearchOptions) error {
search := make(map[string]string)
@@ -50,13 +52,14 @@ func init() {
}
search[s[:colonPos]] = s[(colonPos + 1):]
}
entries, err := cli.Search(args.Base, args.Objectclass, search, "", args.Field, queryScope(args.Scope))
total, err := cli.Search(args.Base, args.Objectclass, search, "", args.Field, queryScope(args.Scope), args.PageLimit, args.Limit, func(offset uint32, entry *ldap.Entry) error {
entry.PrettyPrint(2)
return nil
})
if err != nil {
return err
}
for _, entry := range entries {
entry.PrettyPrint(2)
}
fmt.Println("Total:", total)
return nil
})

27
go.mod
View File

@@ -67,7 +67,7 @@ require (
github.com/serialx/hashring v0.0.0-20180504054112-49a4782e9908
github.com/sevlyar/go-daemon v0.1.5
github.com/shirou/gopsutil v3.21.11+incompatible
github.com/sirupsen/logrus v1.6.0
github.com/sirupsen/logrus v1.9.0
github.com/skip2/go-qrcode v0.0.0-20190110000554-dc11ecdae0a9
github.com/smartystreets/goconvey v1.6.4
github.com/stretchr/testify v1.7.2
@@ -82,16 +82,15 @@ require (
github.com/vmware/govmomi v0.20.1
go.etcd.io/etcd/api/v3 v3.5.0
go.etcd.io/etcd/client/v3 v3.5.0
golang.org/x/crypto v0.0.0-20210817164053-32db794688a5
golang.org/x/net v0.0.0-20210525063256-abc453219eb5
golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4
golang.org/x/net v0.0.0-20220418201149-a630d4f3e7a2
golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c
golang.org/x/sys v0.0.0-20220429233432-b5fbb4746d32
golang.org/x/sys v0.0.0-20220829200755-d48e67d00261
golang.org/x/text v0.3.7
golang.org/x/time v0.0.0-20191024005414-555d28b269f0
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1
golang.zx2c4.com/wireguard/wgctrl v0.0.0-20191008142428-8d021180e987
google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c
golang.zx2c4.com/wireguard/wgctrl v0.0.0-20220916014741-473347a5e6e3
google.golang.org/grpc v1.38.0
google.golang.org/protobuf v1.27.1
gopkg.in/fatih/set.v0 v0.2.1
@@ -103,15 +102,17 @@ require (
k8s.io/cluster-bootstrap v0.19.3
moul.io/http2curl/v2 v2.3.0
yunion.io/x/executor v0.0.0-20211018100936-39a2cd966656
yunion.io/x/jsonutils v1.0.0
yunion.io/x/jsonutils v1.0.1-0.20220819091305-3bab322ab4fd
yunion.io/x/log v1.0.0
yunion.io/x/ovsdb v0.0.0-20200526071744-27bf0940cbc7
yunion.io/x/pkg v1.0.1-0.20220630095420-9925accd7c5e
yunion.io/x/pkg v1.0.1-0.20220819080140-55b265a8658e
yunion.io/x/s3cli v0.0.0-20190917004522-13ac36d8687e
yunion.io/x/sqlchemy v1.1.2-0.20220704015412-b0c3988ceaa2
yunion.io/x/sqlchemy v1.1.2-0.20220923040147-ddd3e96868af
yunion.io/x/structarg v0.0.0-20220312084958-9c6c79c7d1c6
)
require github.com/google/uuid v1.3.0
require (
cloud.google.com/go v0.65.0 // indirect
github.com/Azure/go-autorest/autorest/adal v0.8.2 // indirect
@@ -176,10 +177,8 @@ require (
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect
github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db // indirect
github.com/google/btree v1.0.0 // indirect
github.com/google/go-cmp v0.5.7 // indirect
github.com/google/go-querystring v1.0.0 // indirect
github.com/google/gofuzz v1.1.0 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/googleapis/gax-go/v2 v2.0.5 // indirect
github.com/googleapis/gnostic v0.4.1 // indirect
github.com/googollee/go-engine.io v0.0.0-20180829091931-e2f255711dcb // indirect
@@ -192,7 +191,6 @@ require (
github.com/jstemmer/go-junit-report v0.9.1 // indirect
github.com/jtolds/gls v4.20.0+incompatible // indirect
github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0 // indirect
github.com/konsorten/go-windows-terminal-sequences v1.0.3 // indirect
github.com/leodido/go-urn v1.2.0 // indirect
github.com/lestrrat-go/iter v0.0.0-20200422075355-fc1769541911 // indirect
github.com/lestrrat-go/pdebug v0.0.0-20200204225717-4d6bd78da58d // indirect
@@ -244,11 +242,13 @@ require (
go.uber.org/zap v1.17.0 // indirect
golang.org/x/lint v0.0.0-20210508222113-6edffad5e616 // indirect
golang.org/x/mod v0.4.2 // indirect
golang.org/x/term v0.0.0-20210615171337-6886f2dfbf5b // indirect
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 // indirect
golang.org/x/tools v0.1.2 // indirect
google.golang.org/api v0.30.0 // indirect
google.golang.org/appengine v1.6.6 // indirect
google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c // indirect
gopkg.in/asn1-ber.v1 v1.0.0-20181015200546-f715ec2f112d // indirect
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/ini.v1 v1.44.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
@@ -261,5 +261,4 @@ require (
replace (
github.com/go-logr/logr => github.com/go-logr/logr v0.4.0
github.com/jaypipes/ghw => github.com/zexi/ghw v0.9.1
google.golang.org/grpc => google.golang.org/grpc v1.29.0
)

92
go.sum
View File

@@ -1,5 +1,6 @@
bazil.org/fuse v0.0.0-20180421153158-65cc252bf669 h1:FNCRpXiquG1aoyqcIWVFmpTSKVcx2bQD38uZZeGtdlw=
bazil.org/fuse v0.0.0-20180421153158-65cc252bf669/go.mod h1:Xbm+BRKSBEpa4q4hTSxohYNQpsxXPbPry4JJWOB3LB8=
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU=
cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU=
@@ -188,9 +189,11 @@ github.com/cheggaaa/pb/v3 v3.0.8/go.mod h1:UICbiLec/XO6Hw6k+BHEtHeQFzzBH4i2/qk/o
github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
github.com/cloudflare/golz4 v0.0.0-20150217214814-ef862a3cdc58 h1:F1EaeKL/ta07PY/k9Os/UFtwERei2/XzGemhpGnBKNg=
github.com/cloudflare/golz4 v0.0.0-20150217214814-ef862a3cdc58/go.mod h1:EOBUe0h4xcZ5GoxqC5SDxFQ8gwyZPKQoEzownBlhI80=
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
github.com/coredns/coredns v1.3.0 h1:Ubjr8ZrOpEj95/A9dqQqQAG2k5DWEFdg2ZB3tUXuULA=
github.com/coredns/coredns v1.3.0/go.mod h1:zASH/MVDgR6XZTbxvOnsZfffS+31vg6Ackf/wo1+AM0=
github.com/coreos/go-semver v0.3.0 h1:wkHLiw0WNATZnSG7epLsujiMCgPAc9xhjJ4tgnAxmfM=
@@ -229,7 +232,10 @@ github.com/elazarl/goproxy v0.0.0-20180725130230-947c36da3153/go.mod h1:/Zj4wYkg
github.com/elgatito/upnp v0.0.0-20180711183757-2f244d205f9a h1:2Zw3pxDRTs4nX1WCLAEm27UN0hvjZSge7EaUUQexRZw=
github.com/elgatito/upnp v0.0.0-20180711183757-2f244d205f9a/go.mod h1:afkYpY8JAIL4341N7Zj9xJ5yTovsg6BkWfBFlCzIoF4=
github.com/emicklei/go-restful v0.0.0-20170410110728-ff4f55a20633/go.mod h1:otzb+WCGbkyDHkqmQmT5YD2WR4BBwUdeQoFo8l/7tVs=
github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98=
github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk=
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
github.com/evanphx/json-patch v4.9.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk=
github.com/farsightsec/golang-framestream v0.0.0-20181102145529-8a0cb8ba8710 h1:QdyRyGZWLEvJG5Kw3VcVJvhXJ5tZ1MkRgqpJOEZSySM=
@@ -302,6 +308,7 @@ github.com/goji/httpauth v0.0.0-20160601135302-2da839ab0f4d/go.mod h1:nnjvkQ9ptG
github.com/golang-plus/errors v1.0.0 h1:9Rh4itnph6OYO7wm9u3FUTLMFMKCoL07+bLiYKELxWw=
github.com/golang-plus/errors v1.0.0/go.mod h1:YTFZjOTBcUFieeZe4q+7Umfu/sceSr3XQyBIkTkzpd8=
github.com/golang-plus/testing v1.0.0 h1:azmFWFV44LHK/j/jAkNTbzB2G2b6HdmqF358r73m8kg=
github.com/golang-plus/testing v1.0.0/go.mod h1:psANDlKPZ0ycedUzCS0Trf8h98sFyOyB51FlqyU+Ltc=
github.com/golang-plus/uuid v1.0.0 h1:ga84hG89vda++AGpup4N/cbfbM3O4d3R5ON9/jcN6AY=
github.com/golang-plus/uuid v1.0.0/go.mod h1:pBDDRrdgRHHqyYlj1d1i2gwyBq62Zc+sP2cDiCDkBLI=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
@@ -371,6 +378,7 @@ github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hf
github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg=
@@ -424,7 +432,6 @@ github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGw
github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U=
github.com/jmoiron/sqlx v1.2.0/go.mod h1:1FEQNm3xlJgrMD+FBdI9+xvCksHtbpVBBw5dYhBSsks=
github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4=
github.com/jsimonetti/rtnetlink v0.0.0-20190606172950-9527aa82566a/go.mod h1:Oz+70psSo5OFh8DBl0Zv2ACw7Esh6pPUphlvZG9x7uw=
github.com/json-iterator/go v1.1.5/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
@@ -448,11 +455,11 @@ github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+o
github.com/koding/websocketproxy v0.0.0-20181220232114-7ed82d81a28c h1:N7A4JCA2G+j5fuFxCsJqjFU/sZe0mj8H0sSoSwbaikw=
github.com/koding/websocketproxy v0.0.0-20181220232114-7ed82d81a28c/go.mod h1:Nn5wlyECw3iJrzi0AhIWg+AJUb4PlRQVW4/3XHH1LZA=
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/konsorten/go-windows-terminal-sequences v1.0.3 h1:CE8S1cTafDpPvMhIxNJKvHsGVBgn1xWYf1NbHQhywc8=
github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0=
github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
@@ -505,10 +512,6 @@ github.com/mdlayher/arp v0.0.0-20190313224443-98a83c8a2717/go.mod h1:eOj1DDj3NAZ
github.com/mdlayher/ethernet v0.0.0-20190313224307-5b5fc417d966/go.mod h1:5s5p/sMJ6sNsFl6uCh85lkFGV8kLuIYJCRJLavVJwvg=
github.com/mdlayher/ethernet v0.0.0-20190606142754-0394541c37b7 h1:lez6TS6aAau+8wXUP3G9I3TGlmPFEq2CTxBaRqY6AGE=
github.com/mdlayher/ethernet v0.0.0-20190606142754-0394541c37b7/go.mod h1:U6ZQobyTjI/tJyq2HG+i/dfSoFUt8/aZCM+GKtmFk/Y=
github.com/mdlayher/genetlink v0.0.0-20191004171646-5cf585d3b847/go.mod h1:LNhNWFVJapYK8zEjVHUIle4gy+Oahfc3UtcaqZ8Dz98=
github.com/mdlayher/netlink v0.0.0-20190409211403-11939a169225/go.mod h1:eQB3mZE4aiYnlUsyGGCOpPETfdQq4Jhsgf1fk3cwQaA=
github.com/mdlayher/netlink v0.0.0-20191004170026-3c8695cb0643/go.mod h1:KxeJAFOFLG6AjpyDkQ/iIhxygIUKD+vcwqcnu43w/+M=
github.com/mdlayher/netlink v0.0.0-20191008140946-2a17fd90af51/go.mod h1:KxeJAFOFLG6AjpyDkQ/iIhxygIUKD+vcwqcnu43w/+M=
github.com/mdlayher/raw v0.0.0-20190313224157-43dbcdd7739d/go.mod h1:r1fbeITl2xL/zLbVnNHFyOzQJTgr/3fpf1lJX/cjzR8=
github.com/mdlayher/raw v0.0.0-20190606142536-fef19f00fc18/go.mod h1:7EpbotpCmVZcu+KCX4g9WaRNuu11uyhiW7+Le1dKawg=
github.com/mdlayher/raw v0.0.0-20190606144222-a54781e5f38f h1:Xjvm7UTnKTwrlhbs+8qA6I0v1iX77rY3QxftSgvOVRk=
@@ -519,7 +522,6 @@ github.com/mholt/caddy v0.10.11 h1:s8X+R8DuBbrrMuUTcWSxlDe567B0s5EDmiDBKSYsioY=
github.com/mholt/caddy v0.10.11/go.mod h1:Wb1PlT4DAYSqOEd03MsqkdkXnTxA8v9pKjdpxbqM1kY=
github.com/miekg/dns v1.1.25 h1:dFwPR6SfLtrSwgDcIq2bcU/gVutB4sNApq2HBdqcakg=
github.com/miekg/dns v1.1.25/go.mod h1:bPDLeHnStXmXAq1m/Ch/hvfNHr14JKNPMBo3VZKjuso=
github.com/mikioh/ipaddr v0.0.0-20190404000644-d465c8ab6721/go.mod h1:Ickgr2WtCLZ2MDGd4Gr0geeCH5HybhRJbonOgQpvSxc=
github.com/minio/cli v1.20.0/go.mod h1:bYxnK0uS629N3Bq+AOZZ+6lwF77Sodk4+UL9vNuXhOY=
github.com/minio/minio-go v6.0.14+incompatible h1:fnV+GD28LeqdN6vT2XdGKW8Qe/IfjJDswNVuni6km9o=
github.com/minio/minio-go v6.0.14+incompatible/go.mod h1:7guKYtitv8dktvNUGrhzmNlA5wrAABTQXCoesZdFQO8=
@@ -630,8 +632,9 @@ github.com/shirou/gopsutil v3.21.11+incompatible h1:+1+c1VGhc88SSonWP6foOcLhvnKl
github.com/shirou/gopsutil v3.21.11+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA=
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
github.com/sirupsen/logrus v1.6.0 h1:UBcNElsrwanuuMsnGSlYmtmgbb23qDR5dG+6X6Oo89I=
github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88=
github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0=
github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
github.com/skip2/go-qrcode v0.0.0-20190110000554-dc11ecdae0a9 h1:lpEzuenPuO1XNTeikEmvqYFcU37GVLl8SRNblzyvGBE=
github.com/skip2/go-qrcode v0.0.0-20190110000554-dc11ecdae0a9/go.mod h1:PLPIyL7ikehBD1OAjmKKiOEhbvWyHGaNDjquXMcYABo=
github.com/smartystreets/assertions v0.0.0-20180607162144-eb5b59917fa2/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
@@ -734,15 +737,13 @@ golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8U
golang.org/x/crypto v0.0.0-20190513172903-22d7a77e9e5f/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20190621222207-cc06ce4a13d4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20190829043050-9756ffdc2472/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20190923035154-9ee001bba392/go.mod h1:/lpIB1dKB+9EgE3H3cr1v9wB50oz8l4C4h62xy7jSTY=
golang.org/x/crypto v0.0.0-20191002192127-34f69633bfdc/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20191206172530-e9b2fee46413/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20201012173705-84dcc777aaee/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20210817164053-32db794688a5 h1:HWj/xjIHfjYU5nVXpTM0s39J9CbLn7Cc5a7IC5rwsMQ=
golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4 h1:kUhD7nTDoI3fVd9G4ORWrbV5NY0liEs/Jg2pv5f+bBA=
golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
@@ -755,6 +756,7 @@ golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EH
golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU=
golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
@@ -779,6 +781,7 @@ golang.org/x/mod v0.4.2 h1:Gz96sIWK3OalVv/I/qNygP42zyoKp3xptRVCWRFEBvo=
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/net v0.0.0-20180524181706-dfa909b99c79/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
@@ -795,10 +798,7 @@ golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLL
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20190923162816-aa69164e4478/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20191003171128-d98b1b443823/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20191007182048-72f939374954/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
@@ -817,8 +817,9 @@ golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwY
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
golang.org/x/net v0.0.0-20210525063256-abc453219eb5 h1:wjuX4b5yYQnEQHzd+CBcrcC6OVR2J1CN6mUy0oSxIPo=
golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20220418201149-a630d4f3e7a2 h1:6mzvA99KwZxbOrxww4EvWVQUnN1+xEu9tafK5ZxkYeA=
golang.org/x/net v0.0.0-20220418201149-a630d4f3e7a2/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
@@ -839,6 +840,7 @@ golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJ
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c h1:5KslGYwFpkhGh+Q16bwMP3cOontH8FOep7tGV86Y7SQ=
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20180724212812-e072cadbbdc8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
@@ -847,7 +849,6 @@ golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5h
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190405154228-4b34438f7a67/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190411185658-b44545bcd369/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190418153312-f0ce4c0180be/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
@@ -857,15 +858,11 @@ golang.org/x/sys v0.0.0-20190606122018-79a91cf218c4/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190830023255-19e00faab6ad/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190922100055-0a153f010e69/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190924154521-2837fb4f24fe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191003212358-c178f38b412c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191008105621-543471e840be/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
@@ -899,11 +896,13 @@ golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220128215802-99c3d69c2c27/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220429233432-b5fbb4746d32 h1:Js08h5hqB5xyWR789+QqueR6sDE8mk+YvpETZ+F6X9Y=
golang.org/x/sys v0.0.0-20220429233432-b5fbb4746d32/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220829200755-d48e67d00261 h1:v6hYoSR9T5oet+pMXwUWkbiVqx/63mlHjefrHmxwfeY=
golang.org/x/sys v0.0.0-20220829200755-d48e67d00261/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210615171337-6886f2dfbf5b h1:9zKuko04nR4gjZ4+DNjHqRlAJqbJETHwiNKDqTfOjfE=
golang.org/x/term v0.0.0-20210615171337-6886f2dfbf5b/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 h1:JGgROgKl9N8DuW20oFS5gxc+lE67/N3FcwmBPMe7ArY=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
@@ -921,6 +920,7 @@ golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxb
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20181011042414-1f849cf54d09/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
@@ -972,9 +972,8 @@ golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8T
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.zx2c4.com/wireguard v0.0.20190908/go.mod h1:LhfXh5z6bLC2lW2ve6BzYZFwnnsXK3OQjySR0Yh2dO8=
golang.zx2c4.com/wireguard/wgctrl v0.0.0-20191008142428-8d021180e987 h1:26OAgqBTufVr8WKonCEhhjO1oKsYhHv0iM5Dg92G1TM=
golang.zx2c4.com/wireguard/wgctrl v0.0.0-20191008142428-8d021180e987/go.mod h1:7hq1rEDsx7/FWl8IEEnfH2Xhs6M2MNnjUfN0PeI8Rm0=
golang.zx2c4.com/wireguard/wgctrl v0.0.0-20220916014741-473347a5e6e3 h1:ARxNdT6I+00ZyY5yRT/ZECkQti4iGrMZX9dvG/ao/LY=
golang.zx2c4.com/wireguard/wgctrl v0.0.0-20220916014741-473347a5e6e3/go.mod h1:yp4gl6zOlnDGOZeWeDfMwQcsdOIQnMdhuPx9mwwWBL4=
google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE=
google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M=
google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg=
@@ -992,12 +991,14 @@ google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0M
google.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM=
google.golang.org/api v0.30.0 h1:yfrXXP61wVuLb0vBcG6qaOoIoqYEzOQS8jum51jkv2w=
google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc=
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0=
google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
google.golang.org/appengine v1.6.6 h1:lMO5rYAqUxkmaj76jAkRUvt5JZgFymx/+Q5Mzfivuhc=
google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
@@ -1029,8 +1030,22 @@ google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6D
google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c h1:wtujag7C+4D6KMoulW9YauvK2lgdvCMS260jsqqBXr0=
google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0=
google.golang.org/grpc v1.29.0 h1:2pJjwYOdkZ9HlN4sWRYBg9ttH5bCOlsueaM+b/oYjwo=
google.golang.org/grpc v1.29.0/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk=
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38=
google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM=
google.golang.org/grpc v1.22.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY=
google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60=
google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk=
google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak=
google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak=
google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0=
google.golang.org/grpc v1.38.0 h1:/9BgsAsa5nWe26HqOlvlgJnqBuktYOLCgjCPqsa56W0=
google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM=
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
@@ -1050,8 +1065,9 @@ gopkg.in/asn1-ber.v1 v1.0.0-20181015200546-f715ec2f112d h1:TxyelI5cVkbREznMhfzyc
gopkg.in/asn1-ber.v1 v1.0.0-20181015200546-f715ec2f112d/go.mod h1:cuepJuh7vyXfUyUwEgHQXw849cJrilpS5NeIjOWESAw=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo=
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
gopkg.in/fatih/set.v0 v0.2.1 h1:Xvyyp7LXu34P0ROhCyfXkmQCAoOUKb1E2JS9I7SE5CY=
gopkg.in/fatih/set.v0 v0.2.1/go.mod h1:5eLWEndGL4zGGemXWrKuts+wTJR0y+w+auqUJZbmyBg=
@@ -1117,8 +1133,9 @@ sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc=
yunion.io/x/executor v0.0.0-20211018100936-39a2cd966656 h1:0zlZD5uhZoIHgLVAWCz2aHaYk2ZrNsACCYD7R6EIBII=
yunion.io/x/executor v0.0.0-20211018100936-39a2cd966656/go.mod h1:Uxuou9WQIeJXNpy7t2fPLL0BYLvLiMvGQwY7Qc6aSws=
yunion.io/x/jsonutils v0.0.0-20190625054549-a964e1e8a051/go.mod h1:4N0/RVzsYL3kH3WE/H1BjUQdFiWu50JGCFQuuy+Z634=
yunion.io/x/jsonutils v1.0.0 h1:ySgXdIoRqUZRYA0t8QVqRkWgV8IWJlh2JtGovqqc+iI=
yunion.io/x/jsonutils v1.0.0/go.mod h1:p0nyMqGA/apTxxyLIU/o1k4V7Vujl2O6ey30L594sYE=
yunion.io/x/jsonutils v0.0.0-20220106020632-953b71a4c3a8/go.mod h1:p0nyMqGA/apTxxyLIU/o1k4V7Vujl2O6ey30L594sYE=
yunion.io/x/jsonutils v1.0.1-0.20220819091305-3bab322ab4fd h1:QUAIH9oqQoDRz/byjE8id4yZE1qbCc53QzhsfcLzQp8=
yunion.io/x/jsonutils v1.0.1-0.20220819091305-3bab322ab4fd/go.mod h1:L5QYTYqiL+f56wzir14TWHurE3Vcn9elaFiQpPWhXsg=
yunion.io/x/log v0.0.0-20190514041436-04ce53b17c6b/go.mod h1:+gauLs73omeJAPlsXcevLsJLKixV+sR/E7WSYTSx1fE=
yunion.io/x/log v0.0.0-20190629062853-9f6483a7103d/go.mod h1:LC6f/4FozL0iaAbnFt2eDX9jlsyo3WiOUPm03d7+U4U=
yunion.io/x/log v1.0.0 h1:VPgssPi8Om+KAHjlEjf6RDU86du//yO+X0upu+h6fZM=
@@ -1128,11 +1145,12 @@ yunion.io/x/ovsdb v0.0.0-20200526071744-27bf0940cbc7/go.mod h1:0vLkNEhlmA64HViPB
yunion.io/x/pkg v0.0.0-20190620104149-945c25821dbf/go.mod h1:t6rEGG2sQ4J7DhFxSZVOTjNd0YO/KlfWQyK1W4tog+E=
yunion.io/x/pkg v0.0.0-20190628082551-f4033ba2ea30/go.mod h1:t6rEGG2sQ4J7DhFxSZVOTjNd0YO/KlfWQyK1W4tog+E=
yunion.io/x/pkg v0.0.0-20200814072949-4f1b541857d6/go.mod h1:t6rEGG2sQ4J7DhFxSZVOTjNd0YO/KlfWQyK1W4tog+E=
yunion.io/x/pkg v1.0.1-0.20220630095420-9925accd7c5e h1:p/Cb7z6gyJbZKnGMeOPL3pTmnphB9GLCU+8qMsln7qA=
yunion.io/x/pkg v1.0.1-0.20220630095420-9925accd7c5e/go.mod h1:nYOMflWG1wQC6301rGVglQva9bYbJxHThEJUxRAgMFc=
yunion.io/x/pkg v1.0.1-0.20220819080140-55b265a8658e h1:enPKN/yaKmRjw3PWEdA7HDd6VDqewvczIJbSRpO7R8E=
yunion.io/x/pkg v1.0.1-0.20220819080140-55b265a8658e/go.mod h1:nYOMflWG1wQC6301rGVglQva9bYbJxHThEJUxRAgMFc=
yunion.io/x/s3cli v0.0.0-20190917004522-13ac36d8687e h1:v+EzIadodSwkdZ/7bremd7J8J50Cise/HCylsOJngmo=
yunion.io/x/s3cli v0.0.0-20190917004522-13ac36d8687e/go.mod h1:0iFKpOs1y4lbCxeOmq3Xx/0AcQoewVPwj62eRluioEo=
yunion.io/x/sqlchemy v1.1.2-0.20220704015412-b0c3988ceaa2 h1:Kz+Np1WHxYIyn2SQJEolFrMifLoT1yNF6J34W0zbRc8=
yunion.io/x/sqlchemy v1.1.2-0.20220704015412-b0c3988ceaa2/go.mod h1:xXVfJLIxxTRTnPEaVIIoRZXqWyO8+takIOYhc+zO5KE=
yunion.io/x/sqlchemy v1.0.1/go.mod h1:FTdwPdGhMgh4E+UFXc9klI1Ok34fMuybTT+jLhOaIjI=
yunion.io/x/sqlchemy v1.1.2-0.20220923040147-ddd3e96868af h1:WjaARkzdxBQBD6j5I1MDMlJ0Z3WOHzEp5bTQl+TScaU=
yunion.io/x/sqlchemy v1.1.2-0.20220923040147-ddd3e96868af/go.mod h1:xXVfJLIxxTRTnPEaVIIoRZXqWyO8+takIOYhc+zO5KE=
yunion.io/x/structarg v0.0.0-20220312084958-9c6c79c7d1c6 h1:WuWXhY3DvhdRTzWCJ/kwt3Ss6KIq7+KqJwb+esvNGwU=
yunion.io/x/structarg v0.0.0-20220312084958-9c6c79c7d1c6/go.mod h1:EP6NSv2C0zzqBDTKumv8hPWLb3XvgMZDHQRfyuOrQng=

View File

@@ -149,6 +149,9 @@ func (apb *SAnsiblePlaybookV2) runPlaybook(ctx context.Context, userCred mcclien
return fmt.Errorf("playbook is already running")
}
// hack: force Sleep 50s to wait some host ssh service started
time.Sleep(50 * time.Second)
var (
privateKey string
err error

View File

@@ -145,10 +145,8 @@ func (h *AuthHandlers) GetRegionsResponse(ctx context.Context, w http.ResponseWr
Domains: []string{},
ReturnFullDomains: false,
Idps: []agapi.SIdp{},
SCommonConfig: agapi.SCommonConfig{
ApiServer: options.Options.ApiServer,
},
EncryptPasswd: true,
EncryptPasswd: true,
ApiServer: options.Options.ApiServer,
}
s := auth.GetAdminSession(ctx, regions[0])
@@ -195,12 +193,10 @@ func (h *AuthHandlers) GetRegionsResponse(ctx context.Context, w http.ResponseWr
// fetch this option directly from Keystone
commonCfg, err := modules.ServicesV3.GetSpecific(s, "common", "config", nil)
if err == nil && commonCfg != nil {
config := agapi.SCommonConfig{}
commonCfg.Unmarshal(&config, "config", "default")
if len(config.ApiServer) > 0 {
ret.ApiServer = config.ApiServer
apiServer, _ := commonCfg.GetString("config", "default", "api_server")
if len(apiServer) > 0 {
ret.ApiServer = apiServer
}
ret.IsForgetLoginUser = config.IsForgetLoginUser
}
return ret, nil
}
@@ -355,9 +351,14 @@ func (h *AuthHandlers) doCredentialLogin(ctx context.Context, req *http.Request,
idpId, _ := body.GetString("idp_id")
redirectUri := getSsoCallbackUrl(ctx, req, idpId)
token, err = processSsoLoginData(body, cliIp, redirectUri)
if err != nil {
return nil, errors.Wrap(err, "processSsoLoginData")
}
// if err != nil {
// return nil, errors.Wrap(err, "processSsoLoginData")
// }
} else if body.Contains("verify_code") { // verify by mobile
verifyCode, _ := body.GetString("verify_code")
uid, _ := body.GetString("uid")
contactType, _ := body.GetString("contact_type")
token, err = processVerifyLoginData(uid, contactType, verifyCode, cliIp)
} else {
return nil, httperrors.NewInputParameterError("missing credential")
}

View File

@@ -1,3 +1,17 @@
// Copyright 2019 Yunion
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package handler
import (

View File

@@ -0,0 +1,24 @@
// Copyright 2019 Yunion
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package handler
import (
"yunion.io/x/onecloud/pkg/mcclient"
"yunion.io/x/onecloud/pkg/mcclient/auth"
)
func processVerifyLoginData(uid, contactType, verifyCode string, cliIp string) (mcclient.TokenCredential, error) {
return auth.Client().AuthenticateVerify(uid, contactType, verifyCode, "", "", "", cliIp)
}

View File

@@ -1 +1,15 @@
// Copyright 2019 Yunion
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package report // import "yunion.io/x/onecloud/pkg/apigateway/report"

View File

@@ -104,6 +104,7 @@ func GetModels(opts *GetModelsOptions) error {
listOptions := options.BaseListOptions{
System: options.Bool(true),
Admin: options.Bool(true),
Scope: "system",
Details: options.Bool(opts.IncludeDetails),
ShowEmulated: options.Bool(opts.IncludeEmulated),
Filter: []string{

View File

@@ -23,21 +23,14 @@ type SIdp struct {
IsDefault bool `json:"is_default"`
}
type SCommonConfig struct {
ApiServer string `json:"api_server,allowempty"`
IsForgetLoginUser bool `json:"is_forget_login_user"`
}
type SRegionsReponse struct {
Regions []string `json:"regions,allowempty"`
Domains []string `json:"domains,allowempty"`
Captcha bool `json:"captcha,allowempty"`
Idps []SIdp `json:"idps,allowempty"`
ReturnFullDomains bool `json:"return_full_domains"`
EncryptPasswd bool `json:"encrypt_passwd"`
SCommonConfig
ApiServer string `json:"api_server,allowempty"`
}

View File

@@ -268,3 +268,14 @@ type ClouduserChangeOwnerInput struct {
// 本地用户Id
UserId string `json:"user_id"`
}
type ClouduserCreateAccessKeyInput struct {
Name string `json:"name"`
}
type ClouduserDeleteAccessKeyInput struct {
AccessKey string `json:"access_key"`
}
type ClouduserListAccessKeyInput struct {
}

View File

@@ -440,8 +440,9 @@ type ServerCreateInput struct {
// 创建后自动启动
// 部分云创建后会自动启动例如: 腾讯云, AWS, OpenStack, ZStack, Ucloud, Huawei, Azure, 天翼云
// default: false
AutoStart bool `json:"auto_start"`
DeployConfigs []*DeployConfig `json:"deploy_configs"`
AutoStart bool `json:"auto_start"`
DeployConfigs []*DeployConfig `json:"deploy_configs"`
DeployTelegraf bool `json:"deploy_telegraf"`
// 包年包月时长
//
@@ -579,6 +580,8 @@ type GuestBatchMigrateRequest struct {
SkipCpuCheck bool `json:"skip_cpu_check"`
SkipKernelCheck bool `json:"skip_kernel_check"`
EnableTLS *bool `json:"enable_tls"`
MaxBandwidthMb *int64 `json:"max_bandwidth_mb"`
QuciklyFinish *bool `json:"quickly_finish"`
}
type GuestBatchMigrateParams struct {
@@ -589,6 +592,8 @@ type GuestBatchMigrateParams struct {
EnableTLS *bool
RescueMode bool
OldStatus string
MaxBandwidthMb *int64
QuciklyFinish *bool
}
type HostLoginInfo struct {

View File

@@ -63,6 +63,30 @@ type BucketDetails struct {
AccessUrls []cloudprovider.SBucketAccessUrl `json:"access_urls"`
}
func (self BucketDetails) GetMetricTags() map[string]string {
ret := map[string]string{
"id": self.Id,
"brand": self.Brand,
"cloudregion": self.Cloudregion,
"cloudregion_id": self.CloudregionId,
"domain_id": self.DomainId,
"oss_id": self.Id,
"oss_name": self.Name,
"project_domain": self.ProjectDomain,
"region_ext_id": self.RegionExtId,
"status": self.Status,
"tenant": self.Project,
"tenant_id": self.ProjectId,
"external_id": self.ExternalId,
}
return ret
}
func (self BucketDetails) GetMetricPairs() map[string]string {
ret := map[string]string{}
return ret
}
type BucketObjectsActionInput struct {
Key []string
}

View File

@@ -15,6 +15,7 @@
package compute
import (
"fmt"
"reflect"
"yunion.io/x/jsonutils"
@@ -144,6 +145,9 @@ type CloudaccountCreateInput struct {
// swagger:ignore
AccountId string
// 跳过重复账号注册检查
SkipDuplicateAccountCheck bool
// 指定云平台品牌, 此参数默认和provider相同
// requried: false
//
@@ -317,6 +321,25 @@ type CloudaccountDetail struct {
ProjectMappingResourceInfo
}
func (self CloudaccountDetail) GetMetricTags() map[string]string {
ret := map[string]string{
"id": self.Id,
"cloudaccount_id": self.Id,
"cloudaccount_name": self.Name,
"brand": self.Brand,
"domain_id": self.DomainId,
"project_domain": self.ProjectDomain,
}
return ret
}
func (self CloudaccountDetail) GetMetricPairs() map[string]string {
ret := map[string]string{
"balance": fmt.Sprintf("%.2f", self.Balance),
}
return ret
}
type CloudaccountUpdateInput struct {
apis.EnabledStatusInfrasResourceBaseUpdateInput

View File

@@ -15,6 +15,7 @@
package compute
import (
"strings"
"time"
"yunion.io/x/onecloud/pkg/apis"
@@ -317,6 +318,39 @@ type DBInstanceDetails struct {
Zone2Name string `json:"zone2_name"`
// Zone3名称
Zone3Name string `json:"zone3_name"`
Databases []apis.IdNameDetails `json:"databases"`
}
func (self DBInstanceDetails) GetMetricTags() map[string]string {
ret := map[string]string{
"id": self.Id,
"rds_id": self.Id,
"rds_name": self.Name,
"zone": self.Zone1Name,
"zone_id": self.Zone1,
"status": self.Status,
"engine": self.Engine,
"server_type": strings.ToLower(self.Engine),
"cloudregion": self.Cloudregion,
"cloudregion_id": self.CloudregionId,
"region_ext_id": self.RegionExtId,
"tenant": self.Project,
"tenant_id": self.ProjectId,
"brand": self.Brand,
"domain_id": self.DomainId,
"project_domain": self.ProjectDomain,
"external_id": self.ExternalId,
}
if len(self.IpAddrs) > 0 {
ret["rds_ip"] = strings.ReplaceAll(self.IpAddrs, ",", "|")
}
return ret
}
func (self DBInstanceDetails) GetMetricPairs() map[string]string {
ret := map[string]string{}
return ret
}
type DBInstanceResourceInfoBase struct {

View File

@@ -37,6 +37,34 @@ type ElasticcacheDetails struct {
SlaveZoneInfos []apis.StandaloneShortDesc `json:"slave_zone_infos"`
}
func (self ElasticcacheDetails) GetMetricTags() map[string]string {
ret := map[string]string{
"id": self.Id,
"redis_id": self.Id,
"redis_ip": self.PrivateIpAddr,
"redis_name": self.Name,
"zone": self.Zone,
"zone_id": self.ZoneId,
"zone_ext_id": self.ZoneExtId,
"status": self.Status,
"cloudregion": self.Cloudregion,
"cloudregion_id": self.CloudregionId,
"region_ext_id": self.RegionExtId,
"tenant": self.Project,
"tenant_id": self.ProjectId,
"brand": self.Brand,
"domain_id": self.DomainId,
"project_domain": self.ProjectDomain,
"external_id": self.ExternalId,
}
return ret
}
func (self ElasticcacheDetails) GetMetricPairs() map[string]string {
ret := map[string]string{}
return ret
}
type ElasticcacheResourceInfo struct {
// 弹性缓存实例名称
Elasticcache string `json:"elasticcache"`

View File

@@ -71,6 +71,7 @@ const (
VM_START_MIGRATE = "start_migrate"
VM_MIGRATING = "migrating"
VM_LIVE_MIGRATING = "live_migrating"
VM_MIGRATE_FAILED = "migrate_failed"
VM_CHANGE_FLAVOR = "change_flavor"
@@ -154,6 +155,9 @@ const (
VM_SYNC_ISOLATED_DEVICE_FAILED = "sync_isolated_device_failed"
VM_QGA_SET_PASSWORD = "qga_set_password"
VM_QGA_COMMAND_EXECUTING = "qga_command_executing"
SHUTDOWN_STOP = "stop"
SHUTDOWN_TERMINATE = "terminate"
@@ -186,6 +190,13 @@ const (
HYPERVISOR_DEFAULT = HYPERVISOR_KVM
)
const (
QGA_STATUS_UNKNOWN = "unknown"
QGA_STATUS_EXCUTING = "executing"
QGA_STATUS_EXECUTE_FAILED = "execute_failed"
QGA_STATUS_AVAILABLE = "available"
)
const (
CPU_MODE_QEMU = "qemu"
CPU_MODE_HOST = "host"

View File

@@ -245,6 +245,46 @@ type ServerDetails struct {
ScalingGroupId string `json:"scaling_group_id"`
}
func (self ServerDetails) GetMetricTags() map[string]string {
ret := map[string]string{
"id": self.Id,
"res_type": "guest",
"is_vm": "true",
"paltform": self.Hypervisor,
"host": self.Host,
"host_id": self.HostId,
"vm_id": self.Id,
"vm_name": self.Name,
"zone": self.Zone,
"zone_id": self.ZoneId,
"zone_ext_id": self.ZoneExtId,
"os_type": self.OsType,
"status": self.Status,
"cloudregion": self.Cloudregion,
"cloudregion_id": self.CloudregionId,
"region_ext_id": self.RegionExtId,
"tenant": self.Project,
"tenant_id": self.ProjectId,
"brand": self.Brand,
"vm_scaling_group_id": self.ScalingGroupId,
"domain_id": self.DomainId,
"project_domain": self.ProjectDomain,
"account": self.Account,
"account_id": self.AccountId,
"external_id": self.ExternalId,
}
return ret
}
func (self ServerDetails) GetMetricPairs() map[string]string {
ret := map[string]string{
"vcpu_count": fmt.Sprintf("%d", self.VcpuCount),
"vmem_size": fmt.Sprintf("%d", self.VmemSize),
"disk": fmt.Sprintf("%d", self.DiskSizeMb),
}
return ret
}
// GuestDiskInfo describe the information of disk on the guest.
type GuestDiskInfo struct {
Id string `json:"id"`
@@ -395,6 +435,12 @@ type GuestLiveMigrateInput struct {
SkipKernelCheck *bool `json:"skip_kernel_check"`
// 是否启用 tls
EnableTLS *bool `json:"enable_tls"`
// 迁移带宽限制
MaxBandwidthMb *int64 `json:"max_bandwidth_mb"`
// 快速完成,内存同步一定周期后调整 downtime
QuicklyFinish *bool `json:"quickly_finish"`
KeepDestGuestOnFailed *bool `json:"keep_dest_guest_on_failed"`
}
type GuestSetSecgroupInput struct {
@@ -574,6 +620,7 @@ type ServerMigrateForecastInput struct {
LiveMigrate bool `json:"live_migrate"`
SkipCpuCheck bool `json:"skip_cpu_check"`
SkipKernelCheck bool `json:"skip_kernel_check"`
IsRescueMode bool `json:"is_rescue_mode"`
}
type ServerResizeDiskInput struct {
@@ -618,6 +665,8 @@ type ServerDeployInput struct {
// swagger: ignore
DeployConfigs []*DeployConfig `json:"deploy_configs"`
// swagger: ignore
DeployTelegraf bool `json:"deploy_telegraf"`
}
type ServerUserDataInput struct {
@@ -732,7 +781,7 @@ type GuestJsonDesc struct {
UserData string `json:"user_data"`
PendingDeleted bool `json:"pending_deleted"`
ScallingGroupId string `json:"scalling_group_id"`
ScalingGroupId string `json:"scaling_group_id"`
// baremetal
DiskConfig jsonutils.JSONObject `json:"disk_config"`
@@ -841,7 +890,35 @@ type ServerGetCPUSetCoresResp struct {
HostUsedCores []int `json:"host_used_cores"`
}
type ServerMonitorInput struct {
COMMAND string
QMP bool
}
type ServerQemuInfo struct {
Version string `json:"version"`
Cmdline string `json:"cmdline"`
}
type ServerQgaSetPasswordInput struct {
Username string
Password string
}
type ServerQgaCommandInput struct {
Command string
}
type ServerSetPasswordInput struct {
Username string
Password string
// deploy params
ResetPassword bool
AutoStart bool
}
type ServerSetLiveMigrateParamsInput struct {
MaxBandwidthMB *int64
DowntimeLimitMS *int64
}

View File

@@ -228,6 +228,35 @@ type HostDetails struct {
SysError string `json:"sys_error"`
}
func (self HostDetails) GetMetricTags() map[string]string {
ret := map[string]string{
"id": self.Id,
"host_id": self.Id,
"host_ip": self.AccessIp,
"host": self.Name,
"zone": self.Zone,
"zone_id": self.ZoneId,
"zone_ext_id": self.ZoneExtId,
"status": self.Status,
"cloudregion": self.Cloudregion,
"cloudregion_id": self.CloudregionId,
"region_ext_id": self.RegionExtId,
"brand": self.Brand,
"domain_id": self.DomainId,
"project_domain": self.ProjectDomain,
"account": self.Account,
"res_type": "host",
"account_id": self.AccountId,
"external_id": self.ExternalId,
}
return ret
}
func (self HostDetails) GetMetricPairs() map[string]string {
ret := map[string]string{}
return ret
}
type HostResourceInfo struct {
// 归属云订阅ID
ManagerId string `json:"manager_id"`

View File

@@ -1,3 +1,17 @@
// Copyright 2019 Yunion
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package compute
const (

View File

@@ -45,10 +45,36 @@ type KubeClusterCreateInput struct {
type KubeClusterDetails struct {
apis.EnabledStatusInfrasResourceBaseDetails
SKubeCluster
ManagedResourceInfo
CloudregionResourceInfo
}
func (self KubeClusterDetails) GetMetricTags() map[string]string {
ret := map[string]string{
"id": self.ExternalClusterId,
"res_type": "kube_cluster",
"cluster_id": self.ExternalClusterId,
"cluster_name": self.Name,
"status": self.Status,
"cloudregion": self.Cloudregion,
"cloudregion_id": self.CloudregionId,
"region_ext_id": self.RegionExtId,
"domain_id": self.DomainId,
"project_domain": self.ProjectDomain,
"account": self.Account,
"account_id": self.AccountId,
"external_id": self.ExternalId,
}
return ret
}
func (self KubeClusterDetails) GetMetricPairs() map[string]string {
ret := map[string]string{}
return ret
}
type KubeClusterUpdateInput struct {
apis.EnabledStatusInfrasResourceBaseUpdateInput
}

View File

@@ -0,0 +1,87 @@
// Copyright 2019 Yunion
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package compute
import (
"yunion.io/x/onecloud/pkg/apis"
)
const (
MODELARTS_POOL_STATUS_RUNNING = "running"
MODELARTS_POOL_STATUS_ABNORMAL = "abnormal"
MODELARTS_POOL_STATUS_CREATING = "creating"
MODELARTS_POOL_STATUS_DELETING = "deleting"
MODELARTS_POOL_STATUS_CHANGE_CONFIG = "change_config"
MODELARTS_POOL_STATUS_ERROR = "error"
MODELARTS_POOL_STATUS_UNKNOWN = "unknown"
)
type ModelartsPoolCreateInput struct {
apis.VirtualResourceCreateInput
DeletePreventableCreateInput
CloudregionResourceInput
CloudproviderResourceInput
NodeCount int
}
type ModelartsPoolUpdateInput struct {
apis.StatusInfrasResourceBaseCreateInput
CloudproviderResourceInput
WorkType string `json:"work_type"`
}
// 资源返回详情
type ModelartsPoolDetails struct {
apis.SVirtualResourceBase
apis.VirtualResourceDetails
apis.SExternalizedResourceBase
SBillingResourceBase
ManagedResourceInfo
CloudregionResourceInfo
}
func (self ModelartsPoolDetails) GetMetricTags() map[string]string {
ret := map[string]string{
"id": self.Id,
"modelarts_pool_id": self.Id,
"modelarts_pool_name": self.Name,
"status": self.Status,
"tenant_id": self.ProjectId,
"brand": self.Brand,
"domain_id": self.DomainId,
"account_id": self.AccountId,
"account": self.Account,
"external_id": self.ExternalId,
}
return ret
}
type ModelartsPoolListInput struct {
apis.VirtualResourceListInput
apis.ExternalizedResourceBaseListInput
ManagedResourceListInput
RegionalFilterListInput
apis.DeletePreventableResourceBaseListInput
}
type ModelartsPoolSyncstatusInput struct {
}
type ModelartsPoolChangeConfigInput struct {
NodeCount int
}

View File

@@ -0,0 +1,36 @@
// Copyright 2019 Yunion
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package compute
import "yunion.io/x/onecloud/pkg/apis"
type ModelartsPoolSkuDetails struct {
apis.EnabledStatusStandaloneResourceDetails
ManagedResourceInfo
CloudregionResourceInfo
}
const (
MODELARTS_POOL_SKU_AVAILABLE = "available"
MODELARTS_POOL_SKU_SOLDOUT = "soldout"
)
type ModelartsPoolSkuListInput struct {
apis.EnabledStatusStandaloneResourceListInput
apis.ExternalizedResourceBaseListInput
RegionalFilterListInput
ManagedResourceListInput
}

View File

@@ -83,6 +83,9 @@ type ServerSkuListInput struct {
// 预付费状态
PrepaidStatus string `json:"prepaid_status"`
// 按套餐名称去重
Distinct bool `json:"distinct"`
}
type ElasticcacheSkuListInput struct {

View File

@@ -15,6 +15,8 @@
package compute
import (
"strconv"
"yunion.io/x/jsonutils"
"yunion.io/x/onecloud/pkg/apis"
@@ -147,6 +149,31 @@ type StorageDetails struct {
CommitBound float32 `json:"commit_bound"`
}
func (self StorageDetails) GetMetricTags() map[string]string {
ret := map[string]string{
"id": self.Id,
"storage_id": self.Id,
"storage_name": self.Name,
"brand": self.Brand,
"domain_id": self.DomainId,
"project_domain": self.ProjectDomain,
"external_id": self.ExternalId,
}
return ret
}
func (self StorageDetails) GetMetricPairs() map[string]string {
usageActive := "0"
if self.Capacity > 0 {
usageActive = strconv.FormatFloat(float64(self.ActualCapacityUsed/self.Capacity*100.0), 'f', -1, 64)
}
ret := map[string]string{
"free": strconv.FormatFloat(float64(self.Capacity-self.ActualCapacityUsed), 'f', 2, 64),
"usage_active": usageActive,
}
return ret
}
type StorageResourceInfo struct {
// 归属云订阅ID
ManagerId string `json:"manager_id"`

View File

@@ -236,4 +236,7 @@ type StorageListInput struct {
// filter storages which attached the specified host
HostId string `json:"host_id"`
// filter storages of baremetal host
IsBaremetal *bool `json:"is_baremetal"`
}

View File

@@ -33,6 +33,7 @@ const (
SERVICE_TYPE_MONITOR = "monitor"
SERVICE_TYPE_LOG = "log"
SERVICE_TYPE_REGION = "compute"
SERVICE_TYPE_CLOUDMON = "cloudmon"
SERVICE_TYPE_ETCD = "etcd"
SERVICE_TYPE_INFLUXDB = "influxdb"

View File

@@ -31,3 +31,9 @@ type HostTopology struct {
type HostCPUInfo struct {
*cpu.Info
}
type GuestSetPasswordRequest struct {
Username string `json:"username"`
Password string `json:"password"`
Crypted bool `json:"crypted"`
}

View File

@@ -37,6 +37,7 @@ const (
AUTH_METHOD_SAML = "saml"
AUTH_METHOD_OIDC = "oidc"
AUTH_METHOD_OAuth2 = "oauth2"
AUTH_METHOD_VERIFY = "verify"
// AUTH_METHOD_ID_PASSWORD = 1
// AUTH_METHOD_ID_TOKEN = 2
@@ -103,7 +104,6 @@ var (
"default": []string{
"enable_quota_check",
"default_quota_value",
"enable_rbac",
"non_default_domain_projects",
"time_zone",
"domainized_namespace",
@@ -114,9 +114,6 @@ var (
"ignore_nonrunning_guests",
"platform_name",
"platform_names",
"is_forget_login_user",
"enable_organization",
"enable_tls_migration",
},
}

View File

@@ -377,3 +377,8 @@ type OpsLogListInput struct {
Until time.Time `json:"until"`
}
type IdNameDetails struct {
Id string `json:"id"`
Name string `json:"name"`
}

View File

@@ -159,6 +159,8 @@ type AlertListInput struct {
}
type AlertDetails struct {
SAlert
apis.StatusStandaloneResourceDetails
apis.ScopedResourceBaseInfo
}

View File

@@ -20,6 +20,13 @@ import (
"yunion.io/x/onecloud/pkg/apis"
)
const (
AlertNotificationUsedByMeterAlert = "meter_alert"
AlertNotificationUsedByNodeAlert = "node_alert"
AlertNotificationUsedByCommonAlert = "common_alert"
AlertNotificationUsedByMigrationAlert = "migration_alert"
)
type AlertJointResourceBaseDetails struct {
apis.JointResourceBaseDetails
SAlertJointsBase

View File

@@ -42,6 +42,8 @@ type AlertRecordListInput struct {
}
type AlertRecordDetails struct {
SAlertRecord
apis.StatusStandaloneResourceDetails
apis.ScopedResourceBaseInfo
@@ -50,6 +52,20 @@ type AlertRecordDetails struct {
TriggerTime time.Time
}
func (self AlertRecordDetails) GetMetricTags() map[string]string {
ret := map[string]string{
"id": self.Id,
"alert_id": self.AlertId,
"alert_name": self.AlertName,
"domain_id": self.DomainId,
"project_domain": self.ProjectDomain,
"res_type": self.ResType,
"tenant": self.Tenant,
"tenant_id": self.TenantId,
}
return ret
}
type AlertRecordCreateInput struct {
apis.StandaloneResourceCreateInput

View File

@@ -21,8 +21,9 @@ const (
ALERT_STATUS_DELETING = "deleting"
ALERT_STATUS_DELETED = "deleted"
CommonAlertSystemAlertType = "system"
CommonAlertNomalAlertType = "normal"
CommonAlertSystemAlertType = "system"
CommonAlertNomalAlertType = "normal"
CommonAlertServiceAlertType = "service"
MonitorComponentType = "default-monitor"
MonitorComponentPort = 30093
@@ -40,16 +41,15 @@ const (
METRIC_QUERY_TYPE_NO_DATA = "nodata_query"
METRIC_QUERY_NO_DATA_THESHOLD = "nodata"
CommonAlertLevelNormal = "normal"
CommonAlertLevelImportant = "important"
CommonAlertLevelFatal = "fatal"
)
var CommonAlertLevels = []string{"normal", "important", "fatal"}
var CommonAlertLevels = []string{CommonAlertLevelNormal, CommonAlertLevelImportant, CommonAlertLevelFatal}
type CommonAlertCreateInput struct {
CommonMetricInputQuery
AlertCreateInput
// 查询指标周期
Period string `json:"period"`
type CommonAlertCreateBaseInput struct {
// 报警连续持续周期数
AlertDuration int64 `json:"alert_duration"`
// 通知方式, 比如: email, mobile
@@ -76,6 +76,15 @@ type CommonAlertCreateInput struct {
Description string `json:"description"`
}
type CommonAlertCreateInput struct {
CommonMetricInputQuery
AlertCreateInput
CommonAlertCreateBaseInput
// 查询指标周期
Period string `json:"period"`
}
type CommonMetricInputQuery struct {
From string `json:"from"`
To string `json:"to"`

View File

@@ -15,7 +15,7 @@
package monitor
import (
"time"
"strings"
)
const (
@@ -51,39 +51,79 @@ type NodeAlertCreateInput struct {
NodeName string `json:"node_name"`
// 监控资源 Id
NodeId string `json:"node_id"`
// CommonAlertCreateInput injected by server and do not pass it through API
CommonAlertCreateInput *CommonAlertCreateInput `json:"common_alert_create_input,omitempty"`
}
func (input NodeAlertCreateInput) ToAlertCreateInput(
func (input NodeAlertCreateInput) ToCommonAlertCreateInput(
name string,
field string,
measurement string,
db string) AlertCreateInput {
freq, _ := time.ParseDuration(input.Window)
ret := AlertCreateInput{
Name: name,
Frequency: int64(freq / time.Second),
Level: input.Level,
Settings: AlertSetting{
Conditions: []AlertCondition{
db string) CommonAlertCreateInput {
ret := CommonAlertCreateInput{
AlertCreateInput: AlertCreateInput{
Name: name,
Level: input.Level,
},
CommonAlertCreateBaseInput: CommonAlertCreateBaseInput{
Channel: strings.Split(input.Channel, ","),
Recipients: strings.Split(input.Recipients, ","),
AlertType: CommonAlertNomalAlertType,
},
CommonMetricInputQuery: CommonMetricInputQuery{
MetricQuery: []*CommonAlertQuery{
{
Type: "query",
Operator: "and",
Query: AlertQuery{
AlertQuery: &AlertQuery{
Model: input.GetQuery(field, measurement, db),
From: input.Period,
To: "now",
},
Evaluator: input.GetEvaluator(),
Reducer: Condition{
Type: "avg",
},
Comparator: input.Comparator,
Threshold: input.Threshold,
ConditionType: "query",
Reduce: "avg",
},
},
},
Period: input.Window,
}
ret.UsedBy = AlertNotificationUsedByNodeAlert
return ret
}
// func (input NodeAlertCreateInput) ToAlertCreateInput(
// name string,
// field string,
// measurement string,
// db string) AlertCreateInput {
// freq, _ := time.ParseDuration(input.Window)
// ret := AlertCreateInput{
// Name: name,
// Frequency: int64(freq / time.Second),
// Level: input.Level,
// Settings: AlertSetting{
// Conditions: []AlertCondition{
// {
// Type: "query",
// Operator: "and",
// Query: AlertQuery{
// Model: input.GetQuery(field, measurement, db),
// From: input.Period,
// To: "now",
// },
// Evaluator: input.GetEvaluator(),
// Reducer: Condition{
// Type: "avg",
// },
// },
// },
// },
// }
// return ret
// }
func (input NodeAlertCreateInput) GetQuery(field, measurement, db string) MetricQuery {
return GetNodeAlertQuery(input.Type, field, measurement, db, input.NodeId)
}
@@ -102,8 +142,9 @@ func GetNodeAlertQuery(typ, field, measurement, db, nodeId string) MetricQuery {
Selects: sels,
Tags: []MetricQueryTag{
{
Key: idField,
Value: nodeId,
Key: idField,
Operator: "=",
Value: nodeId,
},
},
GroupBy: []MetricQueryPart{
@@ -145,7 +186,7 @@ type V1AlertListInput struct {
}
type NodeAlertListInput struct {
V1AlertListInput
AlertListInput
// 监控指标名称
Metric string `json:"metric"`
@@ -157,6 +198,13 @@ type NodeAlertListInput struct {
NodeId string `json:"node_id"`
}
func (o NodeAlertListInput) ToCommonAlertListInput() CommonAlertListInput {
return CommonAlertListInput{
AlertListInput: o.AlertListInput,
Metric: o.Metric,
}
}
type AlertV1Details struct {
AlertDetails
@@ -185,7 +233,7 @@ type NodeAlertDetails struct {
}
type NodeAlertUpdateInput struct {
V1AlertUpdateInput
AlertUpdateInput
// 监控指标名称
Metric *string `json:"metric"`

View File

@@ -14,6 +14,8 @@
package monitor
import "time"
var (
UNIFIED_MONITOR_FIELD_OPT_TYPE = []string{"Aggregations", "Selectors"}
UNIFIED_MONITOR_GROUPBY_OPT_TYPE = []string{"time", "tag", "fill"}
@@ -83,3 +85,25 @@ type MetricInputQuery struct {
Signature string `json:"signature"`
ShowMeta bool `json:"show_meta"`
}
type SimpleQueryInput struct {
// 资源Id, 可以不填, 代表查询指定监控的所有监控数据
Id string `json:"id"`
// 查询指定数据库
// default: telegraf
Database string `json:"database"`
// 监控指标: https://github.com/codelinz/cloudpods/blob/monitor/pkg/cloudprovider/metrics.go
MetricName string `json:"metric_name"`
// 开始时间
StartTime time.Time `json:"start_time"`
// 结束时间
EndTime time.Time `json:"end_time"`
// 指定标签
Tags map[string]string `json:"tag_pairs"`
}
type SimpleQueryOutput struct {
Id string `json:"id"`
Time time.Time `json:"time"`
Value float64 `json:"value"`
}

View File

@@ -63,6 +63,7 @@ type ReceiveDetail struct {
ReceiverId string `json:"receiver_id"`
ReceiverName string `json:"receiver_name"`
Contact string `json:"contact"`
ReceiverType string `json:"receiver_type"`
SendAt time.Time `json:"sendAt"`
SendBy string `json:"send_by"`
Status string `json:"status"`

View File

@@ -43,6 +43,9 @@ type ReceiverCreateInput struct {
// description: enabled contact types for user
// example: {"email", "mobile", "feishu", "dingtalk", "workwx"}
EnabledContactTypes []string `json:"enabled_contact_types"`
// force verified if admin create the records
ForceVerified bool `json:"force_verified"`
}
type SInternationalMobile struct {
@@ -129,6 +132,8 @@ type ReceiverUpdateInput struct {
// description: enabled contacts for user
// example: {"email", "mobile", "feishu", "dingtalk", "workwx"}
EnabledContactTypes []string `json:"enabled_contact_types"`
ForceVerified bool `json:"force_verified"`
}
type ReceiverTriggerVerifyInput struct {

View File

@@ -67,6 +67,8 @@ type Application struct {
idleConnsClosed chan struct{}
httpServer *http.Server
slaveHttpServer *http.Server
isTLS bool
}
const (
@@ -315,6 +317,9 @@ func (app *Application) defaultHandle(w http.ResponseWriter, r *http.Request, ri
w.Header().Set("Server", "Yunion AppServer/Go/2018.4")
w.Header().Set("X-Frame-Options", "SAMEORIGIN")
w.Header().Set("X-XSS-Protection", "1; mode=block")
if app.isTLS {
w.Header().Set("Strict-Transport-Security", "max-age=31536000; includeSubDomains")
}
isCors := app.handleCORS(w, r)
handler := app.getRoot(r.Method).Match(segs, params)
if handler != nil {
@@ -500,6 +505,7 @@ func (app *Application) ListenAndServeWithoutCleanup(addr, certFile, keyFile str
}
func (app *Application) ListenAndServeTLSWithCleanup2(addr string, certFile, keyFile string, onStop func(), isMaster bool) {
app.isTLS = true
httpSrv := app.initServer(addr)
if isMaster {
app.addDefaultHandlers()

View File

@@ -41,11 +41,9 @@ var (
baremetalAgent *SBaremetalAgent
)
//
// BaremetalAgent has two types of address
// - AccessAddress/Address: this is the address controller to accesss the agent
// - ListenAddress: this is the address baremetal to access the agent
//
type SBaremetalAgent struct {
agent.SBaseAgent
@@ -84,6 +82,10 @@ func (agent *SBaremetalAgent) GetAdminSession() *mcclient.ClientSession {
return auth.GetAdminSession(context.TODO(), o.Options.Region)
}
func (agent *SBaremetalAgent) GetPublicAdminSession() *mcclient.ClientSession {
return auth.GetAdminSessionWithPublic(context.TODO(), o.Options.Region)
}
func (agent *SBaremetalAgent) GetListenIP() (net.IP, error) {
return agent.FindListenIP(o.Options.ListenAddress)
}

View File

@@ -41,6 +41,7 @@ import (
"yunion.io/x/onecloud/pkg/apis"
api "yunion.io/x/onecloud/pkg/apis/compute"
apiidenty "yunion.io/x/onecloud/pkg/apis/identity"
o "yunion.io/x/onecloud/pkg/baremetal/options"
"yunion.io/x/onecloud/pkg/baremetal/profiles"
"yunion.io/x/onecloud/pkg/baremetal/pxe"
@@ -100,6 +101,10 @@ func (m *SBaremetalManager) GetClientSession() *mcclient.ClientSession {
return m.Agent.GetAdminSession()
}
func (m *SBaremetalManager) GetPublicClientSession() *mcclient.ClientSession {
return m.Agent.GetPublicAdminSession()
}
func (m *SBaremetalManager) GetZoneId() string {
return m.Agent.Zone.Id
}
@@ -549,6 +554,10 @@ func (b *SBaremetalInstance) GetClientSession() *mcclient.ClientSession {
return b.manager.GetClientSession()
}
func (b *SBaremetalInstance) GetPublicClientSession() *mcclient.ClientSession {
return b.manager.GetPublicClientSession()
}
func (b *SBaremetalInstance) Keyword() string {
return "host"
}
@@ -1061,7 +1070,15 @@ func (b *SBaremetalInstance) getTftpFileUrl(filename string) string {
return fmt.Sprintf("http://%s/tftp/%s", endpoint, filename)
}
func (b *SBaremetalInstance) GetImageCacheUrl() string {
func (b *SBaremetalInstance) GetImageUrl(disableImageCache bool) string {
if disableImageCache {
url, err := b.GetPublicClientSession().GetServiceURL(apis.SERVICE_TYPE_IMAGE, apiidenty.EndpointInterfacePublic, "")
if err != nil {
log.Errorf("Get image public url: %v", err)
return ""
}
return url
}
serverIP, err := b.manager.Agent.GetDHCPServerIP()
if err != nil {
log.Errorf("Get http file server: %v", err)
@@ -1607,7 +1624,7 @@ func (b *SBaremetalInstance) adjustUEFIWrapper(cli *ssh.Client, f func() error)
return errors.Wrap(err, "Check is uefi boot")
}
if !isUEFI {
return nil
return b.CleanUEFIInfo()
}
return f()
}
@@ -1625,13 +1642,8 @@ func (b *SBaremetalInstance) AdjustUEFICurrentBootOrder(hostCli *ssh.Client) err
})
}
func (b *SBaremetalInstance) SendUEFIInfo(mgr *uefi.BootMgr) error {
info, err := mgr.ToEFIBootMgrInfo()
if err != nil {
return err
}
func (b *SBaremetalInstance) updateUEFIInfo(uefiData jsonutils.JSONObject) error {
desc := b.desc
uefiData := jsonutils.Marshal(info)
desc.Add(uefiData, "uefi_info")
if err := b.SaveDesc(desc); err != nil {
return errors.Wrap(err, "Save uefi_info")
@@ -1644,6 +1656,24 @@ func (b *SBaremetalInstance) SendUEFIInfo(mgr *uefi.BootMgr) error {
return nil
}
func (b *SBaremetalInstance) CleanUEFIInfo() error {
if err := b.updateUEFIInfo(jsonutils.NewDict()); err != nil {
return errors.Wrap(err, "CleanUEFIInfo")
}
return nil
}
func (b *SBaremetalInstance) SendUEFIInfo(mgr *uefi.BootMgr) error {
info, err := mgr.ToEFIBootMgrInfo()
if err != nil {
return err
}
if err := b.updateUEFIInfo(jsonutils.Marshal(info)); err != nil {
return errors.Wrap(err, "SendUEFIInfo")
}
return nil
}
func (b *SBaremetalInstance) adjustServerUEFIBootOrder(srvCli *ssh.Client) error {
return b.adjustUEFIWrapper(srvCli, func() error {
info, err := b.GetUEFIInfo()
@@ -2651,10 +2681,10 @@ func replaceHostAddr(urlStr string, addr string) string {
return urlComp.String()
}
func (s *SBaremetalServer) doCreateRoot(term *ssh.Client, devName string) error {
func (s *SBaremetalServer) doCreateRoot(term *ssh.Client, devName string, disableImageCache bool) error {
session := s.baremetal.GetClientSession()
token := session.GetToken().GetTokenString()
urlStr := s.baremetal.GetImageCacheUrl()
urlStr := s.baremetal.GetImageUrl(disableImageCache)
imageId := s.GetRootTemplateId()
cmd := fmt.Sprintf("/lib/mos/rootcreate.sh %s %s %s %s", token, urlStr, imageId, devName)
log.Infof("rootcreate cmd: %q", cmd)
@@ -2664,7 +2694,7 @@ func (s *SBaremetalServer) doCreateRoot(term *ssh.Client, devName string) error
return nil
}
func (s *SBaremetalServer) DoPartitionDisk(tool *disktool.SSHPartitionTool, term *ssh.Client) ([]*disktool.Partition, error) {
func (s *SBaremetalServer) DoPartitionDisk(tool *disktool.SSHPartitionTool, term *ssh.Client, disableImageCache bool) ([]*disktool.Partition, error) {
raid, nonRaid, pcie, err := detect_storages.DetectStorageInfo(term, false)
if err != nil {
return nil, err
@@ -2697,7 +2727,7 @@ func (s *SBaremetalServer) DoPartitionDisk(tool *disktool.SSHPartitionTool, term
if len(rootImageId) > 0 {
rootDisk := disks[0]
rootSize, _ := rootDisk.Int("size")
err = s.doCreateRoot(term, tool.GetRootDisk().GetDevName())
err = s.doCreateRoot(term, tool.GetRootDisk().GetDevName(), disableImageCache)
if err != nil {
return nil, errors.Wrap(err, "Failed to create root")
}
@@ -2739,7 +2769,7 @@ func (s *SBaremetalServer) DoPartitionDisk(tool *disktool.SSHPartitionTool, term
return tool.GetPartitions(), nil
}
func (s *SBaremetalServer) DoRebuildRootDisk(tool *disktool.SSHPartitionTool, term *ssh.Client) ([]*disktool.Partition, error) {
func (s *SBaremetalServer) DoRebuildRootDisk(tool *disktool.SSHPartitionTool, term *ssh.Client, disableImageCache bool) ([]*disktool.Partition, error) {
// raid, nonRaid, pcie, err := detect_storages.DetectStorageInfo(term, false)
// if err != nil {
// return nil, err
@@ -2770,7 +2800,7 @@ func (s *SBaremetalServer) DoRebuildRootDisk(tool *disktool.SSHPartitionTool, te
rootDisk := disks[0]
rootSize, _ := rootDisk.Int("size")
rd := tool.GetRootDisk()
err := s.doCreateRoot(term, rd.GetDevName())
err := s.doCreateRoot(term, rd.GetDevName(), disableImageCache)
if err != nil {
return nil, fmt.Errorf("Failed to create root: %v", err)
}
@@ -2847,7 +2877,9 @@ func (s *SBaremetalServer) DoDeploy(tool *disktool.SSHPartitionTool, term *ssh.C
password = seclib.RandomPassword(12)
}
deployInfo := deployapi.NewDeployInfo(publicKey, deployapi.JsonDeploysToStructs(deploys),
password, isInit, true, o.Options.LinuxDefaultRootUser, o.Options.WindowsDefaultAdminUser, false, "")
password, isInit, true, o.Options.LinuxDefaultRootUser, o.Options.WindowsDefaultAdminUser, false, "",
false, "",
)
return s.deployFs(tool, term, deployInfo)
}

View File

@@ -69,6 +69,10 @@ func (self *SBaremetalServerBaseDeployTask) NeedPXEBoot() bool {
return self.needPXEBoot
}
func (self *SBaremetalServerBaseDeployTask) IsDisableImageCache() bool {
return jsonutils.QueryBoolean(self.data, "disable_image_cache", false)
}
func (self *SBaremetalServerBaseDeployTask) GetFinishAction() string {
if self.data != nil {
action, _ := self.data.GetString("on_finish")

View File

@@ -97,7 +97,7 @@ func (self *SBaremetalCdromTask) DoInsertISO(ctx context.Context, args interface
if !fileutils2.Exists(localImagePath) {
return errors.Error("image not cached")
}
imageBaseUrl := self.Baremetal.GetImageCacheUrl()
imageBaseUrl := self.Baremetal.GetImageUrl(true)
if len(imageBaseUrl) == 0 {
return errors.Error("empty image base url")
}

View File

@@ -61,7 +61,7 @@ func (self *SBaremetalServerCreateTask) DoDeploys(term *ssh.Client) (jsonutils.J
return nil, self.onError(term, err)
}
time.Sleep(2 * time.Second)
parts, err := self.Baremetal.GetServer().DoPartitionDisk(tool, term)
parts, err := self.Baremetal.GetServer().DoPartitionDisk(tool, term, self.IsDisableImageCache())
if err != nil {
return nil, self.onError(term, err)
}

View File

@@ -62,7 +62,7 @@ type IBaremetal interface {
GenerateBootISO() error
SendNicInfo(nic *types.SNicDevInfo, idx int, nicType string, reset bool, ipAddr string, reserve bool) error
DoNTPConfig() error
GetImageCacheUrl() string
GetImageUrl(needImageCache bool) string
RemoveServer()
InitializeServer(session *mcclient.ClientSession, name string) error

View File

@@ -55,7 +55,7 @@ func (self *SBaremetalServerRebuildTask) DoDeploys(term *ssh.Client) (jsonutils.
if err != nil {
return nil, errors.Wrap(err, "NewConfigedSSHPartitionTool")
}
parts, err := self.Baremetal.GetServer().DoRebuildRootDisk(tool, term)
parts, err := self.Baremetal.GetServer().DoRebuildRootDisk(tool, term, self.IsDisableImageCache())
if err != nil {
return nil, fmt.Errorf("Rebuild root disk: %v", err)
}

View File

@@ -31,9 +31,9 @@ type IBaremetalServer interface {
DoDiskUnconfig(term *ssh.Client) error
DoDiskConfig(term *ssh.Client) (*disktool.SSHPartitionTool, error)
DoEraseDisk(term *ssh.Client) error
DoPartitionDisk(tool *disktool.SSHPartitionTool, term *ssh.Client) ([]*disktool.Partition, error)
DoPartitionDisk(tool *disktool.SSHPartitionTool, term *ssh.Client, disableImageCache bool) ([]*disktool.Partition, error)
NewConfigedSSHPartitionTool(term *ssh.Client) (*disktool.SSHPartitionTool, error)
DoRebuildRootDisk(tool *disktool.SSHPartitionTool, term *ssh.Client) ([]*disktool.Partition, error)
DoRebuildRootDisk(tool *disktool.SSHPartitionTool, term *ssh.Client, disableImageCache bool) ([]*disktool.Partition, error)
SyncPartitionSize(term *ssh.Client, parts []*disktool.Partition) ([]jsonutils.JSONObject, error)
DoDeploy(tool *disktool.SSHPartitionTool, term *ssh.Client, data jsonutils.JSONObject, isInit bool) (jsonutils.JSONObject, error)
SaveDesc(desc jsonutils.JSONObject) error

View File

@@ -1 +1,15 @@
// Copyright 2019 Yunion
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package grub // import "yunion.io/x/onecloud/pkg/baremetal/utils/grub"

View File

@@ -18,7 +18,9 @@ import "fmt"
func GetYunionOSConfig(sleepTime int, httpSite, kernel string, kernelArgs string, initrd string) string {
kernel = fmt.Sprintf("(http,${http_site})/tftp/%s", kernel)
// kernel = fmt.Sprintf("(tftp,10.127.100.2)/%s", kernel)
initrd = fmt.Sprintf("(http,${http_site})/tftp/%s", initrd)
// initrd = fmt.Sprintf("(tftp,10.127.100.2)/%s", initrd)
return fmt.Sprintf(`
set timeout=%d
set http_site=%s

View File

@@ -62,7 +62,11 @@ func InitAuth(options *common_options.CommonOptions, authComplete auth.AuthCompl
if options.SessionEndpointType != "" {
if !utils.IsInStringArray(options.SessionEndpointType,
[]string{identity.EndpointInterfacePublic, identity.EndpointInterfaceInternal}) {
[]string{
identity.EndpointInterfacePublic,
identity.EndpointInterfaceInternal,
identity.EndpointInterfaceApigateway,
}) {
log.Fatalf("Invalid session endpoint type %s", options.SessionEndpointType)
}
auth.SetEndpointType(options.SessionEndpointType)
@@ -85,10 +89,12 @@ func InitAuth(options *common_options.CommonOptions, authComplete auth.AuthCompl
InitBaseAuth(&options.BaseOptions)
watcher := newEndpointChangeManager()
watcher.StartWatching(&identity_modules.EndpointsV3)
if options.SessionEndpointType == identity.EndpointInterfaceInternal {
watcher := newEndpointChangeManager()
watcher.StartWatching(&identity_modules.EndpointsV3)
startEtcdEndpointPuller()
startEtcdEndpointPuller()
}
}
func InitBaseAuth(options *common_options.BaseOptions) {
@@ -106,7 +112,7 @@ func FetchEtcdServiceInfo() (*identity.EndpointDetails, error) {
func startEtcdEndpointPuller() {
retryInterval := 60
etecdUrl, err := auth.GetServiceURL(apis.SERVICE_TYPE_ETCD, consts.GetRegion(), "", "")
etecdUrl, err := auth.GetServiceURL(apis.SERVICE_TYPE_ETCD, consts.GetRegion(), "", identity.EndpointInterfaceInternal)
if err != nil {
log.Errorf("[etcd] GetServiceURL fail %s, retry after %d seconds", err, retryInterval)
} else if len(etecdUrl) == 0 {

View File

@@ -38,6 +38,7 @@ var (
)
type TCronJobFunction func(ctx context.Context, userCred mcclient.TokenCredential, isStart bool)
type TCronJobFunctionWithStartTime func(ctx context.Context, userCred mcclient.TokenCredential, start time.Time, isStart bool)
var manager *SCronJobManager
@@ -72,11 +73,13 @@ func (t *TimerHour) Next(now time.Time) time.Time {
}
type SCronJob struct {
Name string
job TCronJobFunction
Timer ICronTimer
Next time.Time
StartRun bool
Name string
job TCronJobFunction
jobWithStartTime TCronJobFunctionWithStartTime
Timer ICronTimer
Next time.Time
StartRun bool
times []time.Time
}
type CronJobTimerHeap []*SCronJob
@@ -161,6 +164,38 @@ func (self *SCronJobManager) AddJobAtIntervals(name string, interval time.Durati
return self.AddJobAtIntervalsWithStartRun(name, interval, jobFunc, false)
}
func (self *SCronJobManager) AddJobAtIntervalsWithStarTime(name string, interval time.Duration, jobFunc TCronJobFunctionWithStartTime) error {
return self.AddJobAtIntervalsWithStarTimeStartRun(name, interval, jobFunc, false)
}
func (self *SCronJobManager) AddJobAtIntervalsWithStarTimeStartRun(name string, interval time.Duration, jobFunc TCronJobFunctionWithStartTime, startRun bool) error {
if interval <= 0 {
return errors.Error("AddJobAtIntervals: interval must > 0")
}
self.dataLock.Lock()
defer self.dataLock.Unlock()
if !self.IsNameUnique(name) {
return ErrCronJobNameConflict
}
t := Timer1{
dur: interval,
}
job := SCronJob{
Name: name,
jobWithStartTime: jobFunc,
Timer: &t,
StartRun: startRun,
}
if !self.running {
self.jobs = append(self.jobs, &job)
} else {
self.addJob(&job)
}
return nil
}
func (self *SCronJobManager) AddJobAtIntervalsWithStartRun(name string, interval time.Duration, jobFunc TCronJobFunction, startRun bool) error {
if interval <= 0 {
return errors.Error("AddJobAtIntervals: interval must > 0")
@@ -268,7 +303,7 @@ func (self *SCronJobManager) addJob(newJob *SCronJob) {
now := time.Now()
newJob.Next = newJob.Timer.Next(now)
if newJob.StartRun {
newJob.runJob(true)
newJob.runJob(true, now)
}
heap.Push(&self.jobs, newJob)
go func() { self.add <- struct{}{} }()
@@ -335,7 +370,7 @@ func (self *SCronJobManager) init() {
for i := 0; i < len(self.jobs); i += 1 {
if self.jobs[i].StartRun {
self.jobs[i].StartRun = false
self.jobs[i].runJob(true)
self.jobs[i].runJob(true, now)
}
}
}
@@ -369,7 +404,7 @@ func (self *SCronJobManager) runJobs(now time.Time) {
defer self.dataLock.Unlock()
for i := 0; i < len(self.jobs); i++ {
if !(self.jobs[i].Next.After(now) || self.jobs[i].Next.IsZero()) {
self.jobs[i].runJob(false)
self.jobs[i].runJob(false, now)
self.jobs[i].Next = self.jobs[i].Timer.Next(now)
heap.Fix(&self.jobs, i)
}
@@ -377,19 +412,25 @@ func (self *SCronJobManager) runJobs(now time.Time) {
}
func (job *SCronJob) Run() {
job.runJobInWorker(job.StartRun)
startTime := time.Now()
if len(job.times) > 0 {
startTime = job.times[0]
job.times = job.times[1:]
}
job.runJobInWorker(job.StartRun, startTime)
}
func (job *SCronJob) Dump() string {
return ""
}
func (job *SCronJob) runJob(isStart bool) {
func (job *SCronJob) runJob(isStart bool, now time.Time) {
job.StartRun = isStart
job.times = append(job.times, now)
manager.workers.Run(job, nil, nil)
}
func (job *SCronJob) runJobInWorker(isStart bool) {
func (job *SCronJob) runJobInWorker(isStart bool, startTime time.Time) {
defer func() {
if r := recover(); r != nil {
log.Errorf("CronJob task %s run error: %s", job.Name, r)
@@ -397,10 +438,14 @@ func (job *SCronJob) runJobInWorker(isStart bool) {
}
}()
log.Debugf("Cron job: %s started", job.Name)
log.Debugf("Cron job: %s started, startTime: %s", job.Name, startTime)
ctx := context.Background()
ctx = context.WithValue(ctx, appctx.APP_CONTEXT_KEY_APPNAME, "Cron-Service")
ctx = context.WithValue(ctx, appctx.APP_CONTEXT_KEY_TASKNAME, fmt.Sprintf("%s-%d", job.Name, time.Now().Unix()))
userCred := DefaultAdminSessionGenerator()
job.job(ctx, userCred, isStart)
if job.job != nil {
job.job(ctx, userCred, isStart)
} else if job.jobWithStartTime != nil {
job.jobWithStartTime(ctx, userCred, startTime, isStart)
}
}

View File

@@ -1684,6 +1684,7 @@ func updateItem(manager IModelManager, item IModel, ctx context.Context, userCre
if len(diff) > 0 {
OpsLog.LogEvent(item, ACT_UPDATE, diff, userCred)
logclient.AddActionLogWithContext(ctx, item, logclient.ACT_UPDATE, diff, userCred, true)
CallUpdateNotifyHook(ctx, userCred, item)
}
item.PostUpdate(ctx, userCred, query, data)

View File

@@ -692,6 +692,17 @@ func IsMetadataKeySystemAdmin(key string) bool {
return strings.HasPrefix(key, SYSTEM_ADMIN_PREFIX)
}
func IsMetadataKeyPrivateKey(key string) bool {
for _, k := range []string{"admin", "project"} {
for _, v := range []string{"ssh-private-key", "ssh-public-key"} {
if key == fmt.Sprintf("%s-%s", k, v) {
return true
}
}
}
return strings.HasPrefix(key, SYSTEM_ADMIN_PREFIX)
}
func IsMetadataKeySysTag(key string) bool {
return strings.HasPrefix(key, SYS_TAG_PREFIX)
}
@@ -701,7 +712,7 @@ func (manager *SMetadataManager) GetSysadminKey(key string) string {
}
func IsMetadataKeyVisiable(key string) bool {
return !(IsMetadataKeySysTag(key) || IsMetadataKeySystemAdmin(key))
return !(IsMetadataKeySysTag(key) || IsMetadataKeySystemAdmin(key) || IsMetadataKeyPrivateKey(key))
}
func GetVisiableMetadata(ctx context.Context, model IStandaloneModel, userCred mcclient.TokenCredential) (map[string]string, error) {

View File

@@ -12,20 +12,30 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package collectors
package db
import (
"yunion.io/x/onecloud/pkg/cloudmon/collectors/common"
"yunion.io/x/onecloud/pkg/cloudmon/options"
"context"
"yunion.io/x/onecloud/pkg/mcclient"
"yunion.io/x/onecloud/pkg/util/shellutils"
)
func init() {
shellutils.R(&options.ReportOptions{}, "report-host", "Report Host", reportHost)
var (
updateNotifyHook updateNotifyHookFunc
)
type updateNotifyHookFunc func(ctx context.Context, userCred mcclient.TokenCredential, obj IModel)
func SetUpdateNotifyHook(f updateNotifyHookFunc) {
if updateNotifyHook != nil {
panic("updateNotifyHook already set")
}
updateNotifyHook = f
}
//入口函数[aliyun、huawei]
func reportHost(session *mcclient.ClientSession, args *options.ReportOptions) error {
return common.ReportCloudMetricOfoperatorType(string(common.HOST), session, args)
func CallUpdateNotifyHook(ctx context.Context, userCred mcclient.TokenCredential, obj IModel) {
if updateNotifyHook == nil {
return
}
updateNotifyHook(ctx, userCred, obj)
}

View File

@@ -150,6 +150,9 @@ const (
ACT_VM_DEPLOY = "deploy"
ACT_VM_DEPLOY_FAIL = "deploy_fail"
ACT_SET_USER_PASSWORD = "set_user_password"
ACT_SET_USER_PASSWORD_FAIL = "set_user_password_fail"
ACT_VM_IO_THROTTLE = "io_throttle"
ACT_VM_IO_THROTTLE_FAIL = "io_throttle_fail"

View File

@@ -178,6 +178,10 @@ func (manager *SProjectizedResourceBaseManager) FetchCustomizeColumns(
}
}
}
domainRows := manager.SDomainizedResourceBaseManager.FetchCustomizeColumns(ctx, userCred, query, objs, fields, isList)
for i := range ret {
ret[i].DomainizedResourceInfo = domainRows[i]
}
return ret
}

View File

@@ -61,7 +61,7 @@ type SVirtualResourceBase struct {
IsSystem bool `nullable:"true" default:"false" list:"admin" create:"optional" json:"is_system"`
// 资源放入回收站时间
PendingDeletedAt time.Time `json:"pending_deleted_at" list:"user"`
PendingDeletedAt time.Time `json:"pending_deleted_at" list:"user" update:"admin"`
// 资源是否处于回收站中
PendingDeleted bool `nullable:"false" default:"false" index:"true" get:"user" list:"user" json:"pending_deleted"`
// 资源是否被冻结
@@ -608,6 +608,8 @@ func (model *SVirtualResourceBase) GetShortDesc(ctx context.Context) *jsonutils.
tc, _ := TenantCacheManager.FetchTenantById(ctx, model.ProjectId)
if tc != nil {
desc.Add(jsonutils.NewString(tc.GetName()), "owner_tenant")
metadata, _ := GetVisiableMetadata(ctx, tc, nil)
desc.Set("project_tags", jsonutils.Marshal(metadata))
}
return desc
}

View File

@@ -17,6 +17,7 @@ package notifyclient
import (
"context"
"fmt"
"sync"
"time"
"yunion.io/x/jsonutils"
@@ -36,10 +37,30 @@ var (
notifyAdminUsers []string
notifyAdminGroups []string
notifyDBHookResources sync.Map
)
func init() {
notifyClientWorkerMan = appsrv.NewWorkerManager("NotifyClientWorkerManager", 1, 50, false)
// set db notify hook
db.SetUpdateNotifyHook(func(ctx context.Context, userCred mcclient.TokenCredential, obj db.IModel) {
_, ok := notifyDBHookResources.Load(obj.KeywordPlural())
if !ok {
return
}
EventNotify(ctx, userCred, SEventNotifyParam{
Obj: obj,
Action: ActionUpdate,
})
})
}
func AddNotifyDBHookResources(keywordPlurals ...string) {
for _, kp := range keywordPlurals {
notifyDBHookResources.Store(kp, true)
}
}
func NotifyWithCtx(ctx context.Context, recipientId []string, isGroup bool, priority npk.TNotifyPriority, event string, data jsonutils.JSONObject) {

View File

@@ -53,9 +53,6 @@ func OnBaseOptionsChange(oOpts, nOpts interface{}) bool {
if oldOpts.ApiServer != newOpts.ApiServer {
log.Debugf("api_server changed from %s to %s", oldOpts.ApiServer, newOpts.ApiServer)
}
if oldOpts.EnableTlsMigration != newOpts.EnableTlsMigration {
log.Debugf("enable_tls_migration changed from %v to %v", oldOpts.EnableTlsMigration, newOpts.EnableTlsMigration)
}
return changed
}

View File

@@ -21,7 +21,9 @@ import (
"yunion.io/x/jsonutils"
"yunion.io/x/log"
"yunion.io/x/pkg/util/reflectutils"
identity_api "yunion.io/x/onecloud/pkg/apis/identity"
"yunion.io/x/onecloud/pkg/appsrv"
"yunion.io/x/onecloud/pkg/cloudcommon/consts"
"yunion.io/x/onecloud/pkg/cloudcommon/syncman/watcher"
@@ -78,7 +80,13 @@ func StartOptionManagerWithSessionDriver(options interface{}, refreshSeconds int
OptionManager.FirstSync()
if session.IsRemote() {
OptionManager.StartWatching(&identity.ServicesV3)
var opts *CommonOptions
err := reflectutils.FindAnonymouStructPointer(options, &opts)
if err != nil {
log.Errorf("cannot find CommonOptions in options")
} else if opts.SessionEndpointType == identity_api.EndpointInterfaceInternal {
OptionManager.StartWatching(&identity.ServicesV3)
}
}
}

View File

@@ -110,8 +110,6 @@ type BaseOptions struct {
PlatformName string `help:"identity name of this platform" default:"Cloudpods"`
PlatformNames map[string]string `help:"identity name of this platform by language"`
EnableTlsMigration bool `help:"Enable TLS migration" default:"false"`
}
const (

View File

@@ -239,14 +239,14 @@ type policyTask struct {
}
func (t *policyTask) Run() {
val := t.manager.policyCache.Get(t.key)
val := t.manager.policyCache.AtomicGet(t.key)
result := fetchResult{}
if gotypes.IsNil(val) {
pg, err := DefaultPolicyFetcher(context.Background(), t.userCred)
if err != nil {
result.err = errors.Wrap(err, "DefaultPolicyFetcher")
} else {
t.manager.policyCache.Set(t.key, pg)
t.manager.policyCache.AtomicSet(t.key, pg)
result.output = pg
}
} else {
@@ -297,7 +297,7 @@ func (manager *SPolicyManager) allow(scope rbacutils.TRbacScope, userCred mcclie
policySet = rbacutils.TPolicySet{}
}
result := manager.allowWithoutCache(policySet, scope, userCred, service, resource, action, extra...)
manager.permissionCache.Set(key, result)
manager.permissionCache.AtomicSet(key, result)
return result
}

View File

@@ -828,6 +828,10 @@ func NewIPv4AddrValidator(key string) *ValidatorIPv4Addr {
}
var ValidateModel = func(userCred mcclient.TokenCredential, manager db.IStandaloneModelManager, id *string) (db.IModel, error) {
if len(*id) == 0 {
return nil, httperrors.NewMissingParameterError(manager.Keyword())
}
model, err := manager.FetchByIdOrName(userCred, *id)
if err != nil {
if errors.Cause(err) == sql.ErrNoRows {

View File

@@ -1874,18 +1874,29 @@ func (self *SCloudaccount) SyncCloudroles(ctx context.Context, userCred mcclient
return result
}
func (self *SCloudaccount) GetUserCloudgroups(userId string) ([]string, error) {
func (self *SCloudaccount) GetUserCloudgroups(userCred mcclient.TokenCredential) ([]string, error) {
ret := []string{}
q := CloudgroupManager.Query()
samlusers := SamluserManager.Query("cloudgroup_id").Equals("owner_id", userId).Equals("cloudaccount_id", self.Id).SubQuery()
q = q.In("id", samlusers)
q := SamluserManager.Query().Equals("owner_id", userCred.GetUserId()).Equals("cloudaccount_id", self.Id)
users := []SSamluser{}
err := db.FetchModelObjects(SamluserManager, q, &users)
if err != nil {
return nil, errors.Wrapf(err, "db.FetchModelObjects")
}
if len(users) == 0 {
return nil, fmt.Errorf("no available saml user for %s %s", userCred.GetUserName(), userCred.GetUserId())
}
groupIds := []string{}
for i := range users {
groupIds = append(groupIds, users[i].CloudgroupId)
}
q = CloudgroupManager.Query().In("id", groupIds)
groups := []SCloudgroup{}
err := db.FetchModelObjects(CloudgroupManager, q, &groups)
err = db.FetchModelObjects(CloudgroupManager, q, &groups)
if err != nil {
return nil, errors.Wrapf(err, "db.FetchModelObjects")
}
if len(groups) == 0 {
return ret, nil
return ret, fmt.Errorf("no available cloudgroup for %s %s", userCred.GetUserName(), userCred.GetUserId())
}
for i := range groups {
cache, err := CloudgroupcacheManager.Register(&groups[i], self)

View File

@@ -1512,3 +1512,48 @@ func (self *SClouduser) SyncCustomCloudpoliciesForCloud(ctx context.Context, use
return account.SyncCustomCloudpoliciesForCloud(ctx, userCred, self)
}
func (self *SClouduser) PerformCreateAccessKey(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject, input api.ClouduserCreateAccessKeyInput) (jsonutils.JSONObject, error) {
user, err := self.GetIClouduser()
if err != nil {
return nil, errors.Wrapf(err, "GetIClouduser error")
}
ak, err := user.CreateAccessKey(input.Name)
if err != nil {
return nil, errors.Wrapf(err, "GetDetailsAccessKeys error")
}
return jsonutils.Marshal(ak), nil
}
func (self *SClouduser) GetDetailsAccessKeys(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject) (jsonutils.JSONObject, error) {
user, err := self.GetIClouduser()
if err != nil {
return nil, errors.Wrapf(err, "GetIClouduser")
}
aks, err := user.GetAccessKeys()
if err != nil {
return nil, errors.Wrapf(err, "GetAccessKeys")
}
ret := struct {
Data []cloudprovider.SAccessKey
Total int
Limit int
}{
Data: aks,
Total: len(aks),
Limit: 20,
}
return jsonutils.Marshal(ret), nil
}
func (self *SClouduser) PerformDeleteAccessKey(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject, input api.ClouduserDeleteAccessKeyInput) (jsonutils.JSONObject, error) {
user, err := self.GetIClouduser()
if err != nil {
return nil, errors.Wrapf(err, "GetIClouduser")
}
err = user.DeleteAccessKey(input.AccessKey)
if err != nil {
return nil, errors.Wrapf(err, "DeleteAccessKey")
}
return nil, nil
}

View File

@@ -68,13 +68,10 @@ func (d *SHuaweiSAMLDriver) GetIdpInitiatedLoginData(ctx context.Context, userCr
if len(idpId) == 0 {
return data, httperrors.NewInputParameterError("saml auth url %s missing idp", uri)
}
groups, err := account.GetUserCloudgroups(userCred.GetUserId())
groups, err := account.GetUserCloudgroups(userCred)
if err != nil {
return data, httperrors.NewGeneralError(errors.Wrapf(err, "GetUserCloudgroups"))
}
if len(groups) == 0 {
return data, httperrors.NewResourceNotFoundError("no available group found")
}
data.NameId = userCred.GetUserName()
data.NameIdFormat = samlutils.NAME_ID_FORMAT_TRANSIENT
@@ -129,13 +126,10 @@ func (d *SHuaweiSAMLDriver) GetSpInitiatedLoginData(ctx context.Context, userCre
return data, httperrors.NewResourceNotReadyError("SAMLProvider for account %s not ready", account.Id)
}
groups, err := account.GetUserCloudgroups(userCred.GetUserId())
groups, err := account.GetUserCloudgroups(userCred)
if err != nil {
return data, httperrors.NewGeneralError(errors.Wrapf(err, "GetUserCloudgroups"))
}
if len(groups) == 0 {
return data, httperrors.NewResourceNotFoundError("no available group found")
}
data.NameId = userCred.GetUserName()
data.NameIdFormat = samlutils.NAME_ID_FORMAT_TRANSIENT

View File

@@ -70,7 +70,10 @@ func (d *SAliyunSAMLDriver) GetIdpInitiatedLoginData(ctx context.Context, userCr
Values: []string{v},
})
}
data.RelayState = "https://homenew.console.aliyun.com/"
if len(redirectUrl) == 0 {
redirectUrl = "https://homenew.console.aliyun.com/"
}
data.RelayState = redirectUrl
return data, nil
}

View File

@@ -87,7 +87,10 @@ func (d *SAWSSAMLDriver) GetIdpInitiatedLoginData(ctx context.Context, userCred
Values: []string{v.value},
})
}
data.RelayState = "https://console.aws.amazon.com/"
if len(redirectUrl) == 0 {
redirectUrl = "https://console.aws.amazon.com/"
}
data.RelayState = redirectUrl
return data, nil
}

View File

@@ -86,7 +86,10 @@ func (d *SAWSCNSAMLDriver) GetIdpInitiatedLoginData(ctx context.Context, userCre
Values: []string{v.value},
})
}
data.RelayState = "https://console.amazonaws.cn/"
if len(redirectUrl) == 0 {
redirectUrl = "https://console.amazonaws.cn/"
}
data.RelayState = redirectUrl
return data, nil
}

View File

@@ -84,7 +84,10 @@ func (d *SQcloudSAMLDriver) GetIdpInitiatedLoginData(ctx context.Context, userCr
Values: []string{v.value},
})
}
data.RelayState = "https://console.cloud.tencent.com/"
if len(redirectUrl) == 0 {
redirectUrl = "https://console.cloud.tencent.com/"
}
data.RelayState = redirectUrl
return data, nil
}

View File

@@ -1,142 +0,0 @@
// Copyright 2019 Yunion
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package alertrecordhistorymon
import (
"context"
"fmt"
"strconv"
"time"
"golang.org/x/sync/errgroup"
"yunion.io/x/jsonutils"
"yunion.io/x/pkg/errors"
"yunion.io/x/pkg/util/timeutils"
"yunion.io/x/onecloud/pkg/cloudmon/collectors/common"
"yunion.io/x/onecloud/pkg/cloudmon/options"
"yunion.io/x/onecloud/pkg/mcclient"
modules "yunion.io/x/onecloud/pkg/mcclient/modules/monitor"
)
func init() {
factory := SAlertRecordHistoryFactory{}
common.RegisterFactory(&factory)
}
type SAlertRecordHistoryFactory struct {
}
func (self *SAlertRecordHistoryFactory) MyRoutineInteval(monOptions options.CloudMonOptions) time.Duration {
return time.Duration(monOptions.AlertRecordHistoryInterval)
}
func (self *SAlertRecordHistoryFactory) MyRoutineFunc() common.RoutineFunc {
return common.MakePullMetricRoutineAtZeroPoint
}
func (self *SAlertRecordHistoryFactory) NewCloudReport(provider *common.SProvider, session *mcclient.ClientSession,
args *options.ReportOptions,
operatorType string) common.ICloudReport {
return &SAlertRecordHistoryReport{
common.CloudReportBase{
SProvider: nil,
Session: session,
Args: args,
Operator: string(common.ALERT_RECORD),
},
}
}
func (S *SAlertRecordHistoryFactory) GetId() string {
return string(common.ALERT_RECORD)
}
type SAlertRecordHistoryReport struct {
common.CloudReportBase
}
func (self *SAlertRecordHistoryReport) Report() error {
alerts, err := self.getMonitorCommonAlert()
if err != nil {
return err
}
errs := make([]error, 0)
recordGroup, _ := errgroup.WithContext(context.Background())
count := 0
for i, _ := range alerts {
tmp := alerts[i]
count++
recordGroup.Go(func() error {
alert_id, _ := tmp.GetString("id")
alertRecords, err := self.getAlertRecordsByAlertId(alert_id)
if err != nil {
return errors.Wrapf(err, "getAlertRecordsByAlertId:%s error", alert_id)
}
return self.collectMetric(alertRecords)
})
if count == 4 {
err := recordGroup.Wait()
if err != nil {
errs = append(errs, errors.Wrap(err, "alertRecordHistoryReport collectMetric error"))
}
count = 0
}
}
err = recordGroup.Wait()
if err != nil {
errs = append(errs, errors.Wrap(err, "alertRecordHistoryReport collectMetric error"))
}
return errors.NewAggregate(errs)
}
func (self *SAlertRecordHistoryReport) getMonitorCommonAlert() ([]jsonutils.JSONObject, error) {
alerts := make([]jsonutils.JSONObject, 0)
query := jsonutils.NewDict()
query.Add(jsonutils.NewString("0"), common.KEY_LIMIT)
//query.Add(jsonutils.NewBool(true), common.DETAILS)
query.Add(jsonutils.NewString("system"), "scope")
alerts, err := self.ListAllResource(modules.CommonAlertManager, query)
if err != nil {
return nil, errors.Wrap(err, "getMonitorCommonAlert error")
}
return alerts, nil
}
func (self *SAlertRecordHistoryReport) getAlertRecordsByAlertId(id string) ([]jsonutils.JSONObject, error) {
now := time.Now().UTC()
period64, err := strconv.ParseInt(self.Args.Interval, 10, 8)
if err != nil {
return nil, err
}
query := jsonutils.NewDict()
query.Add(jsonutils.NewString("0"), common.KEY_LIMIT)
query.Add(jsonutils.NewBool(true), common.DETAILS)
query.Add(jsonutils.NewString("system"), "scope")
query.Add(jsonutils.NewString(id), "alert_id")
query.Add(jsonutils.NewString("alerting"), "state")
query.Add(jsonutils.NewString(fmt.Sprintf(`created_at.between("%s","%s")`,
now.Add(-time.Hour*24*time.Duration(period64)).Format(timeutils.MysqlTimeFormat),
now.Format(timeutils.MysqlTimeFormat))),
"filter")
alertRecords, err := self.ListAllResource(modules.AlertRecordManager, query)
if err != nil {
return nil, err
}
return alertRecords, nil
}

View File

@@ -1,54 +0,0 @@
// Copyright 2019 Yunion
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package alertrecordhistorymon
import (
"time"
"yunion.io/x/jsonutils"
"yunion.io/x/onecloud/pkg/cloudmon/collectors/common"
"yunion.io/x/onecloud/pkg/util/influxdb"
)
func (self *SAlertRecordHistoryReport) collectMetric(alertRecords []jsonutils.JSONObject) error {
dataList := make([]influxdb.SMetricData, 0)
matchRecord := self.getMaxEvalMatchOfAlertRecord(alertRecords)
if matchRecord == nil {
return nil
}
metric, err := self.NewMetricFromJson(matchRecord)
if err != nil {
return err
}
metric.Timestamp = time.Now()
metric.Name = ALERT_RECORD_HISTORY_MEASUREMENT
dataList = append(dataList, metric)
return common.SendMetrics(self.Session, dataList, self.Args.Debug, ALERT_RECORD_HISTORY_DATABASE)
}
func (self *SAlertRecordHistoryReport) getMaxEvalMatchOfAlertRecord(alertRecords []jsonutils.JSONObject) jsonutils.JSONObject {
var matchRecord jsonutils.JSONObject
maxCount := int64(0)
for _, record := range alertRecords {
resNum, _ := record.Int("res_num")
if resNum > maxCount {
maxCount = resNum
matchRecord = record
}
}
return matchRecord
}

View File

@@ -1,15 +0,0 @@
// Copyright 2019 Yunion
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package alertrecordhistorymon // import "yunion.io/x/onecloud/pkg/cloudmon/collectors/alertrecordhistorymon"

View File

@@ -1,96 +0,0 @@
// Copyright 2019 Yunion
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package alimon
import "yunion.io/x/onecloud/pkg/cloudmon/collectors/common"
const (
SERVER_METRIC_NAMESPACE = "acs_ecs_dashboard"
REDIS_METRIC_NAMESPACE = "acs_kvstore"
RDS_METRIC_NAMESPACE = "acs_rds_dashboard"
OSS_METRIC_NAMESPACE = "acs_oss"
ELB_METRIC_NAMESPACE = "acs_slb_dashboard"
K8S_METRIC_NAMESPACE = "acs_k8s"
)
//multiCloud查询指标列表组装
var aliMetricSpecs = map[string][]string{
"CPUUtilization": {common.DEFAULT_STATISTICS, common.UNIT_PERCENT, common.INFLUXDB_FIELD_CPU_USAGE},
"InternetInRate": {common.DEFAULT_STATISTICS, common.UNIT_BPS, common.INFLUXDB_FIELD_NET_BPS_RX_INTERNET},
"IntranetInRate": {common.DEFAULT_STATISTICS, common.UNIT_BPS, common.INFLUXDB_FIELD_NET_BPS_RX_INTRANET},
"InternetOutRate": {common.DEFAULT_STATISTICS, common.UNIT_BPS, common.INFLUXDB_FIELD_NET_BPS_TX_INTERNET},
"IntranetOutRate": {common.DEFAULT_STATISTICS, common.UNIT_BPS, common.INFLUXDB_FIELD_NET_BPS_TX_INTRANET},
"DiskReadBPS": {common.DEFAULT_STATISTICS, common.UNIT_BYTEPS, common.INFLUXDB_FIELD_DISK_READ_BPS},
"DiskWriteBPS": {common.DEFAULT_STATISTICS, common.UNIT_BYTEPS, common.INFLUXDB_FIELD_DISK_WRITE_BPS},
"DiskReadIOPS": {common.DEFAULT_STATISTICS, common.UNIT_CPS, common.INFLUXDB_FIELD_DISK_READ_IOPS},
"DiskWriteIOPS": {common.DEFAULT_STATISTICS, common.UNIT_CPS, common.INFLUXDB_FIELD_DISK_WRITE_IOPS},
}
var aliRdsMetricSpecs = map[string][]string{
"CpuUsage": {common.DEFAULT_STATISTICS, common.UNIT_PERCENT, common.INFLUXDB_FIELD_RDS_CPU_USAGE},
"MemoryUsage": {common.DEFAULT_STATISTICS, common.UNIT_PERCENT, common.INFLUXDB_FIELD_RDS_MEM_USAGE},
"MySQL_NetworkInNew": {common.DEFAULT_STATISTICS, common.UNIT_BPS, common.INFLUXDB_FIELD_RDS_NET_BPS_RX_MYSQL},
"MySQL_NetworkOutNew": {common.DEFAULT_STATISTICS, common.UNIT_BPS, common.INFLUXDB_FIELD_RDS_NET_BPS_TX_MYSQL},
"DiskUsage": {common.DEFAULT_STATISTICS, common.UNIT_PERCENT, common.INFLUXDB_FIELD_RDS_DISK_USAGE},
"SQLServer_NetworkInNew": {common.DEFAULT_STATISTICS, common.UNIT_BPS, common.INFLUXDB_FIELD_RDS_NET_BPS_RX_SQLSERVER},
"SQLServer_NetworkOutNew": {common.DEFAULT_STATISTICS, common.UNIT_BPS, common.INFLUXDB_FIELD_RDS_NET_BPS_TX_SQLSERVER},
"ConnectionUsage": {common.DEFAULT_STATISTICS, common.UNIT_PERCENT, common.INFLUXDB_FIELD_RDS_CONN_USAGE},
}
var aliRedisMetricSpecs = map[string][]string{
"CpuUsage": {common.DEFAULT_STATISTICS, common.UNIT_PERCENT, common.INFLUXDB_FIELD_REDIS_CPU_USAGE},
"MemoryUsage": {common.DEFAULT_STATISTICS, common.UNIT_PERCENT, common.INFLUXDB_FIELD_REDIS_MEM_USAGE},
"IntranetIn": {common.DEFAULT_STATISTICS, common.UNIT_BPS, common.INFLUXDB_FIELD_REDIS_NET_BPS_RX},
"IntranetOut": {common.DEFAULT_STATISTICS, common.UNIT_BPS, common.INFLUXDB_FIELD_REDIS_NET_BPS_TX},
"UsedConnection": {common.DEFAULT_STATISTICS, common.UNIT_COUNT, common.INFLUXDB_FIFLD_REDIS_CONN_USAGE},
"UsedQPS": {common.DEFAULT_STATISTICS, common.UNIT_COUNT, common.INFLUXDB_FIFLD_REDIS_OPT_SES},
"Keys": {common.DEFAULT_STATISTICS, common.UNIT_COUNT, common.INFLUXDB_FIFLD_REDIS_CACHE_KEYS},
"ExpiredKeys": {common.DEFAULT_STATISTICS, common.UNIT_COUNT, common.INFLUXDB_FIFLD_REDIS_CACHE_EXP_KEYS},
"UsedMemory": {common.DEFAULT_STATISTICS, common.UNIT_MEM, common.INFLUXDB_FIFLD_REDIS_DATA_MEM_USAGE},
}
var aliOSSMetricSpecs = map[string][]string{
"InternetSend": {common.DEFAULT_STATISTICS, common.UNIT_MEM, common.INFLUXDB_FIELD_OSS_NET_BPS_TX_INTERNET},
"InternetRecv": {common.DEFAULT_STATISTICS, common.UNIT_MEM, common.INFLUXDB_FIELD_OSS_NET_BPS_RX_INTERNET},
"IntranetSend": {common.DEFAULT_STATISTICS, common.UNIT_MEM, common.INFLUXDB_FIELD_OSS_NET_BPS_TX_INTRANET},
"IntranetRecv": {common.DEFAULT_STATISTICS, common.UNIT_MEM, common.INFLUXDB_FIELD_OSS_NET_BPS_RX_INTRANET},
"GetObjectE2eLatency": {common.DEFAULT_STATISTICS, common.UNIT_MSEC, common.INFLUXDB_FIELD_OSS_LATECY_GET},
"PostObjectE2eLatency": {common.DEFAULT_STATISTICS, common.UNIT_MSEC, common.INFLUXDB_FIELD_OSS_LATECY_POST},
"GetObjectCount": {common.DEFAULT_STATISTICS, common.UNIT_COUNT, common.INFLUXDB_FIELD_OSS_REQ_COUNT_GET},
"PostObjectCount": {common.DEFAULT_STATISTICS, common.UNIT_COUNT, common.INFLUXDB_FIELD_OSS_REQ_COUNT_POST},
"ServerErrorCount": {common.DEFAULT_STATISTICS, common.UNIT_COUNT, common.INFLUXDB_FIELD_OSS_REQ_COUNT_5XX},
}
var aliElbMetricSpecs = map[string][]string{
"InstanceTrafficRX": {common.DEFAULT_STATISTICS, common.UNIT_BPS, common.INFLUXDB_FIELD_ELB_NET_BPS_RX},
"InstanceTrafficTX": {common.DEFAULT_STATISTICS, common.UNIT_BPS, common.INFLUXDB_FIELD_ELB_NET_BPS_TX},
"InstanceStatusCode2xx": {common.DEFAULT_STATISTICS, common.UNIT_COUNT_SEC, common.INFLUXDB_FIELD_ELB_HRSP_COUNT_2XX},
"InstanceStatusCode3xx": {common.DEFAULT_STATISTICS, common.UNIT_COUNT_SEC, common.INFLUXDB_FIELD_ELB_HRSP_COUNT_3XX},
"InstanceStatusCode4xx": {common.DEFAULT_STATISTICS, common.UNIT_COUNT_SEC, common.INFLUXDB_FIELD_ELB_HRSP_COUNT_4XX},
"InstanceStatusCode5xx": {common.DEFAULT_STATISTICS, common.UNIT_COUNT_SEC, common.INFLUXDB_FIELD_ELB_HRSP_COUNT_5XX},
}
var aliK8SClusterMetricSpecs = map[string][]string{
"cluster.cpu.utilization": {common.DEFAULT_STATISTICS, common.UNIT_PERCENT, common.INFLUXDB_FIELD_K8S_CLUSTER_CPU_USAGE},
"cluster.memory.utilization": {common.DEFAULT_STATISTICS, common.UNIT_PERCENT, common.INFLUXDB_FIELD_K8S_CLUSTER_MEM_USAGE},
}
var aliK8SPodMetricSpecs = map[string][]string{
"pod.cpu.utilization": {common.DEFAULT_STATISTICS, common.UNIT_PERCENT, common.INFLUXDB_FIELD_K8S_POD_CPU_USAGE},
"pod.memory.utilization": {common.DEFAULT_STATISTICS, common.UNIT_PERCENT, common.INFLUXDB_FIELD_K8S_POD_MEM_USAGE},
}
var aliK8SNodeMetricSpecs = map[string][]string{
"node.cpu.utilization": {common.DEFAULT_STATISTICS, common.UNIT_PERCENT, common.INFLUXDB_FIELD_K8S_NODE_CPU_USAGE},
"node.memory.utilization": {common.DEFAULT_STATISTICS, common.UNIT_PERCENT, common.INFLUXDB_FIELD_K8S_NODE_MEM_USAGE},
}

View File

@@ -1,143 +0,0 @@
// Copyright 2019 Yunion
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package alimon
import (
"yunion.io/x/jsonutils"
"yunion.io/x/onecloud/pkg/apis/compute"
"yunion.io/x/onecloud/pkg/cloudmon/collectors/common"
"yunion.io/x/onecloud/pkg/cloudmon/options"
"yunion.io/x/onecloud/pkg/mcclient"
)
func init() {
factory := SAliCloudReportFactory{}
common.RegisterFactory(&factory)
cluster := &AliK8sClusterHelper{
K8sClusterMetricBaseHelper: &common.K8sClusterMetricBaseHelper{
ModuleHelper: map[common.K8sClusterModuleType]common.IK8sClusterModuleHelper{},
},
}
cluster.RegisterModuleHelper(new(AliK8sClusterPodHelper))
cluster.RegisterModuleHelper(new(AliK8sClusterNodeHelper))
common.RegisterK8sClusterHelper(cluster)
}
type SAliCloudReportFactory struct {
common.CommonReportFactory
}
func (self *SAliCloudReportFactory) NewCloudReport(provider *common.SProvider, session *mcclient.ClientSession,
args *options.ReportOptions, operatorType string) common.ICloudReport {
return &SAliCloudReport{
common.CloudReportBase{
SProvider: provider,
Session: session,
Args: args,
Operator: operatorType,
},
}
}
func (self *SAliCloudReportFactory) GetId() string {
return compute.CLOUD_PROVIDER_ALIYUN
}
type SAliCloudReport struct {
common.CloudReportBase
}
func (self *SAliCloudReport) Report() error {
var servers []jsonutils.JSONObject
var err error
servers, err = self.GetResourceByOperator()
providerInstance, err := self.InitProviderInstance()
if err != nil {
return err
}
regionList, regionServerMap, err := self.GetAllRegionOfServers(servers, providerInstance)
if err != nil {
return err
}
for _, region := range regionList {
servers := regionServerMap[region.GetGlobalId()]
switch common.MonType(self.Operator) {
case common.REDIS:
err = self.collectRegionMetricOfRedis(region, servers)
case common.K8S:
err = self.collectRegionMetricOfResource(region, servers)
if err != nil {
return err
}
self.Impl = self
err = self.CollectRegionMetricOfK8sModules(region, servers)
default:
err = self.collectRegionMetricOfResource(region, servers)
}
if err != nil {
return err
}
}
return nil
}
type AliK8sClusterHelper struct {
*common.K8sClusterMetricBaseHelper
}
func (a AliK8sClusterHelper) HelperBrand() string {
return compute.CLOUD_PROVIDER_ALIYUN
}
type AliK8sClusterPodHelper struct {
common.K8sClusterModuleQueryHelper
}
func (q AliK8sClusterPodHelper) MyModuleType() common.K8sClusterModuleType {
return common.K8S_MODULE_POD
}
func (q AliK8sClusterPodHelper) MyResDimensionId() common.DimensionId {
return common.DimensionId{
LocalId: "name",
ExtId: "pod",
}
}
func (q AliK8sClusterPodHelper) MyNamespaceAndMetrics() (string, map[string][]string) {
return K8S_METRIC_NAMESPACE, aliK8SPodMetricSpecs
}
type AliK8sClusterNodeHelper struct {
common.K8sClusterModuleQueryHelper
}
func (a AliK8sClusterNodeHelper) MyModuleType() common.K8sClusterModuleType {
return common.K8S_MODULE_NODE
}
func (a AliK8sClusterNodeHelper) MyResDimensionId() common.DimensionId {
return common.DimensionId{
LocalId: "name",
ExtId: "node",
}
}
func (a AliK8sClusterNodeHelper) MyNamespaceAndMetrics() (string, map[string][]string) {
return K8S_METRIC_NAMESPACE, aliK8SNodeMetricSpecs
}

View File

@@ -1,315 +0,0 @@
// Copyright 2019 Yunion
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package alimon
import (
"strconv"
"strings"
"time"
"yunion.io/x/jsonutils"
"yunion.io/x/log"
"yunion.io/x/onecloud/pkg/cloudmon/collectors/common"
"yunion.io/x/onecloud/pkg/cloudprovider"
"yunion.io/x/onecloud/pkg/multicloud/aliyun"
"yunion.io/x/onecloud/pkg/util/influxdb"
)
func (self *SAliCloudReport) collectRegionMetricOfResource(region cloudprovider.ICloudRegion, servers []jsonutils.JSONObject) error {
dataList := make([]influxdb.SMetricData, 0)
aliReg := region.(*aliyun.SRegion)
since, until, err := common.TimeRangeFromArgs(self.Args)
if err != nil {
return err
}
namespace, metrics := self.getMetricSpecs(servers)
dimensionId := self.getDimensionId()
dataCnt := 0
for metricName, influxDbSpecs := range metrics {
rtnArray, _, err := aliReg.DescribeMetricList(metricName, namespace, since, until, "", nil)
if err != nil {
log.Errorln(err)
continue
}
dataCnt = len(dataList)
if len(rtnArray) > 0 {
for _, rtnMetric := range rtnArray {
for _, server := range servers {
external_id, _ := server.GetString(dimensionId.LocalId)
if instanceId, _ := rtnMetric.GetString(dimensionId.ExtId); instanceId == external_id {
if self.Operator == string(common.SERVER) {
metric, err := common.FillVMCapacity(server.(*jsonutils.JSONDict))
if err != nil {
return err
}
dataList = append(dataList, metric)
}
serverMetric, err := self.collectMetricFromThisServer(server, rtnMetric, influxDbSpecs, metricName)
if err != nil {
return err
}
dataList = append(dataList, serverMetric)
}
}
}
}
log.Debugf("%s %s %s report %d metric", self.SProvider.Name, self.Operator, metricName, len(dataList)-dataCnt)
}
return common.SendMetrics(self.Session, dataList, self.Args.Debug, "")
}
func (self *SAliCloudReport) collectRegionMetricOfRedis(region cloudprovider.ICloudRegion,
servers []jsonutils.JSONObject) error {
dataList := make([]influxdb.SMetricData, 0)
aliReg := region.(*aliyun.SRegion)
since, until, err := common.TimeRangeFromArgs(self.Args)
if err != nil {
return err
}
redisDeployType := make(map[string]string)
for _, server := range servers {
local_category, err := server.GetString("local_category")
if err != nil {
return err
}
switch local_category {
case "single":
redisDeployType["single"] = "Standard"
case "master":
redisDeployType["master"] = "Standard"
case "cluster":
redisDeployType["cluster"] = "Sharding"
case "rwsplit":
redisDeployType["rwsplit"] = "Splitrw"
}
}
dataCnt := 0
for metricName, influxDbSpecs := range aliRedisMetricSpecs {
for _, pre := range redisDeployType {
rtnArray, _, err := aliReg.DescribeMetricList(pre+metricName, "acs_kvstore", since, until, "", nil)
if err != nil {
log.Errorln(err)
continue
}
dataCnt = len(dataList)
if len(rtnArray) > 0 {
for _, rtnMetric := range rtnArray {
for _, server := range servers {
external_id, _ := server.GetString("external_id")
if instanceId, _ := rtnMetric.GetString("instanceId"); instanceId == external_id {
serverMetric, err := self.collectMetricFromThisServer(server, rtnMetric, influxDbSpecs, "")
node_id, _ := rtnMetric.GetString("nodeId")
serverMetric.Tags = append(serverMetric.Tags, influxdb.SKeyValue{Key: "node_id", Value: node_id})
if err != nil {
return err
}
dataList = append(dataList, serverMetric)
}
}
}
}
}
log.Debugf("%s %s %s report %d metric", self.SProvider.Name, self.Operator, metricName, len(dataList)-dataCnt)
}
return common.SendMetrics(self.Session, dataList, self.Args.Debug, "")
}
func (self *SAliCloudReport) collectMetricFromThisServer(server jsonutils.JSONObject, rtnMetric jsonutils.JSONObject, influxDbSpecs []string, valueKey string) (influxdb.SMetricData, error) {
metric, err := self.NewMetricFromJson(server)
//metric, err := common.JsonToMetric(server.(*jsonutils.JSONDict), "", common.ServerTags, make([]string, 0))
if err != nil {
return influxdb.SMetricData{}, err
}
timestamp, _ := rtnMetric.Get("timestamp")
metric.Timestamp = time.Unix(timestamp.(*jsonutils.JSONInt).Value()/1000, 0)
fieldValue, err := self.getDataPointValue(valueKey, influxDbSpecs, rtnMetric)
if err != nil {
return influxdb.SMetricData{}, err
}
//根据条件拼装metric的tag和metirc信息
influxDbSpec := influxDbSpecs[2]
measurement := common.SubstringBefore(influxDbSpec, ".")
var pairsKey string
if strings.Contains(influxDbSpec, ",") {
pairsKey = common.SubstringBetween(influxDbSpec, ".", ",")
} else {
pairsKey = common.SubstringAfter(influxDbSpec, ".")
}
if influxDbSpecs[1] == common.UNIT_BYTEPS && strings.Contains(pairsKey, common.UNIT_BPS) {
fieldValue = fieldValue * 8
}
tag := common.SubstringAfter(influxDbSpec, ",")
if tag != "" && strings.Contains(influxDbSpec, "=") {
metric.Tags = append(metric.Tags, influxdb.SKeyValue{
Key: common.SubstringBefore(tag, "="),
Value: common.SubstringAfter(tag, "="),
})
}
cpu_cout, err := server.Get("vcpu_count")
if err == nil {
metric.Metrics = append(metric.Metrics, influxdb.SKeyValue{
Key: "cpu_count",
Value: strconv.FormatInt(cpu_cout.(*jsonutils.JSONInt).Value(), 10),
})
}
metric.Metrics = append(metric.Metrics, influxdb.SKeyValue{
Key: pairsKey,
Value: strconv.FormatFloat(fieldValue, 'E', -1, 64),
})
metric.Name = measurement
return metric, nil
}
func (self *SAliCloudReport) getDataPointValue(valueKey string, influxDbSpecs []string, rtnMetric jsonutils.JSONObject) (float64, error) {
key := common.UNIT_AVERAGE
switch common.MonType(self.Operator) {
case common.OSS:
key = valueKey
case common.K8S:
key = "Value"
}
fieldValue, err := rtnMetric.Float(key)
if err != nil {
return 0, err
}
return fieldValue, nil
}
func (self *SAliCloudReport) getMetricSpecs(res []jsonutils.JSONObject) (string, map[string][]string) {
switch common.MonType(self.Operator) {
case common.SERVER:
return SERVER_METRIC_NAMESPACE, aliMetricSpecs
case common.REDIS:
return REDIS_METRIC_NAMESPACE, aliRedisMetricSpecs
case common.RDS:
return RDS_METRIC_NAMESPACE, aliRdsMetricSpecs
case common.OSS:
return OSS_METRIC_NAMESPACE, aliOSSMetricSpecs
case common.ELB:
return ELB_METRIC_NAMESPACE, aliElbMetricSpecs
case common.K8S:
return K8S_METRIC_NAMESPACE, aliK8SClusterMetricSpecs
default:
return SERVER_METRIC_NAMESPACE, aliMetricSpecs
}
}
func (self *SAliCloudReport) getDimensionId() *common.DimensionId {
switch common.MonType(self.Operator) {
case common.SERVER:
return &common.DimensionId{
LocalId: "external_id",
ExtId: "instanceId",
}
case common.REDIS:
return &common.DimensionId{
LocalId: "external_id",
ExtId: "instanceId",
}
case common.RDS:
return &common.DimensionId{
LocalId: "external_id",
ExtId: "instanceId",
}
case common.OSS:
return &common.DimensionId{
LocalId: "name",
ExtId: "BucketName",
}
case common.ELB:
return &common.DimensionId{
LocalId: "external_id",
ExtId: "InstanceId",
}
case common.K8S:
return &common.DimensionId{
LocalId: "external_cloud_cluster_id",
ExtId: "cluster",
}
}
return nil
}
func (self *SAliCloudReport) CollectK8sModuleMetric(region cloudprovider.ICloudRegion, cluster jsonutils.JSONObject,
helper common.IK8sClusterModuleHelper) error {
aliReg := region.(*aliyun.SRegion)
since, until, err := common.TimeRangeFromArgs(self.Args)
id, _ := cluster.GetString("id")
resources, err := common.ListK8sClusterModuleResources(helper.MyModuleType(), id, self.Session, nil)
if err != nil {
log.Errorf("ListK8sClusterModuleResources err: %v", err)
return err
}
namespace, metricSpecs := helper.MyNamespaceAndMetrics()
metricNames := make([]string, 0)
for metricName := range metricSpecs {
metricNames = append(metricNames, metricName)
}
dimensionId := helper.MyResDimensionId()
dataList := make([]influxdb.SMetricData, 0)
dataCnt := 0
for metricName, influxDbSpecs := range metricSpecs {
rtnArray, _, err := aliReg.DescribeMetricList(metricName, namespace, since, until, "", nil)
if err != nil {
log.Errorln(err)
continue
}
dataCnt = len(dataList)
if len(rtnArray) > 0 {
for _, rtnMetric := range rtnArray {
for _, resource := range resources {
external_id, _ := resource.GetString(dimensionId.LocalId)
if instanceId, _ := rtnMetric.GetString(dimensionId.ExtId); instanceId == external_id {
serverMetric, err := self.collectMetricFromThisServer(resource, rtnMetric, influxDbSpecs, metricName)
if err != nil {
return err
}
dataList = append(dataList, serverMetric)
}
}
}
}
log.Debugf("%s %s %s report %d metric", self.SProvider.Name, self.Operator, metricName, len(dataList)-dataCnt)
}
err = common.SendMetrics(self.Session, dataList, self.Args.Debug, "")
if err != nil {
log.Errorf("K8s metricName: %s SendMetrics err: %#v", "", err)
}
return nil
}
func (self *SAliCloudReport) getK8sModuleDimensions(helper common.IK8sClusterModuleHelper, module jsonutils.JSONObject,
clusterId string) []aliyun.SResourceLabel {
dimensions := make([]aliyun.SResourceLabel, 0)
dimensionId := helper.MyResDimensionId()
localIds := strings.Split(dimensionId.LocalId, ",")
extIds := strings.Split(dimensionId.ExtId, ",")
if len(localIds) != len(extIds) {
return dimensions
}
for index, localId := range localIds {
localIdKey := strings.Split(localId, ".")
val, _ := module.GetString(localIdKey...)
dimensions = append(dimensions, aliyun.SResourceLabel{
Name: extIds[index],
Value: val,
})
}
return dimensions
}

View File

@@ -1,15 +0,0 @@
// Copyright 2019 Yunion
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package alimon // import "yunion.io/x/onecloud/pkg/cloudmon/collectors/alimon"

View File

@@ -1,86 +0,0 @@
// Copyright 2019 Yunion
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package apsaramon
import (
"yunion.io/x/jsonutils"
"yunion.io/x/onecloud/pkg/apis/compute"
"yunion.io/x/onecloud/pkg/cloudmon/collectors/common"
"yunion.io/x/onecloud/pkg/cloudmon/options"
"yunion.io/x/onecloud/pkg/mcclient"
)
func init() {
factory := SApsaraCloudReportFactory{}
common.RegisterFactory(&factory)
}
type SApsaraCloudReportFactory struct {
common.CommonReportFactory
}
func (self *SApsaraCloudReportFactory) NewCloudReport(provider *common.SProvider, session *mcclient.ClientSession,
args *options.ReportOptions, operatorType string) common.ICloudReport {
return &SApsaraCloudReport{
common.CloudReportBase{
SProvider: provider,
Session: session,
Args: args,
Operator: operatorType,
},
}
}
func (self *SApsaraCloudReportFactory) GetId() string {
return compute.CLOUD_PROVIDER_APSARA
}
type SApsaraCloudReport struct {
common.CloudReportBase
}
func (self *SApsaraCloudReport) Report() error {
var servers []jsonutils.JSONObject
var err error
servers, err = self.GetResourceByOperator()
providerInstance, err := self.InitProviderInstance()
if err != nil {
return err
}
regionList, regionServerMap, err := self.GetAllRegionOfServers(servers, providerInstance)
if err != nil {
return err
}
for _, region := range regionList {
servers := regionServerMap[region.GetGlobalId()]
switch self.Operator {
case "server":
err = self.collectRegionMetricOfHost(region, servers)
case "redis":
err = self.collectRegionMetricOfRedis(region, servers)
case "rds":
err = self.collectRegionMetricOfRds(region, servers)
case "oss":
err = self.collectRegionMetricOfOss(region, servers)
case "elb":
err = self.collectRegionMetricOfElb(region, servers)
}
if err != nil {
return err
}
}
return nil
}

View File

@@ -1,373 +0,0 @@
// Copyright 2019 Yunion
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package apsaramon
import (
"strconv"
"strings"
"sync"
"time"
"yunion.io/x/jsonutils"
"yunion.io/x/log"
"yunion.io/x/pkg/errors"
api "yunion.io/x/onecloud/pkg/apis/compute"
"yunion.io/x/onecloud/pkg/cloudmon/collectors/common"
"yunion.io/x/onecloud/pkg/cloudprovider"
iden_modules "yunion.io/x/onecloud/pkg/mcclient/modules/identity"
"yunion.io/x/onecloud/pkg/multicloud/apsara"
"yunion.io/x/onecloud/pkg/util/influxdb"
)
type SApsaraMetric struct {
Timestamp int64
UserId string
InstanceId string
Maximum float64
Minimum float64
Average float64
NodeId string
}
func (self *SApsaraCloudReport) collectRegionMetricOfHost(region cloudprovider.ICloudRegion, servers []jsonutils.JSONObject) error {
dataList := make([]influxdb.SMetricData, 0)
aliReg := region.(*apsara.SRegion)
since, until, err := common.TimeRangeFromArgs(self.Args)
if err != nil {
return errors.Wrapf(err, "common.TimeRangeFromArgs")
}
instances := []api.ServerDetails{}
instanceMaps := map[string]api.ServerDetails{}
jsonutils.Update(&instances, servers)
for i := range instances {
if len(instances[i].ExternalId) == 0 {
continue
}
instanceMaps[instances[i].ExternalId] = instances[i]
metric, err := common.FillVMCapacity(jsonutils.Marshal(instances[i]).(*jsonutils.JSONDict))
if err != nil {
return errors.Wrapf(err, "common.FillVMCapacity")
}
dataList = append(dataList, metric)
}
err = common.SendMetrics(self.Session, dataList, self.Args.Debug, "")
if err != nil {
log.Errorf("send server base metric error: %v", err)
}
var wg sync.WaitGroup
wg.Add(len(apsaraMetricSpecs))
for _metricName, _influxDbSpecs := range apsaraMetricSpecs {
go func(metricName string, influxDbSpecs []string) {
defer wg.Done()
dataList = []influxdb.SMetricData{}
metricArray, err := aliReg.FetchMetricData(metricName, "acs_ecs_dashboard", since, until)
if err != nil {
log.Errorln(err)
return
}
metrics := []SApsaraMetric{}
jsonutils.Update(&metrics, metricArray)
for _, rtnMetric := range metrics {
server, ok := instanceMaps[rtnMetric.InstanceId]
if ok {
serverMetric, err := self.collectMetricFromThisServer(jsonutils.Marshal(server), rtnMetric, influxDbSpecs)
if err != nil {
log.Errorf("collect %s error: %v", metricName, err)
continue
}
project, err := self.GetResourceById(server.ProjectId, &iden_modules.Projects)
if err != nil {
log.Errorf("server: %s getProject: %s err: %v", server.Name, server.ProjectId, err)
continue
}
metaMap, _ := project.GetMap("metadata")
if len(metaMap) > 0 {
for key, valObj := range metaMap {
if strings.Contains(key, "user:") {
val, _ := valObj.GetString()
serverMetric.Tags = append(serverMetric.Tags, influxdb.SKeyValue{
Key: key,
Value: val,
})
}
}
}
dataList = append(dataList, serverMetric)
}
}
log.Infof("SendMetrics %s length: %d", metricName, len(dataList))
err = common.SendMetrics(self.Session, dataList, self.Args.Debug, "")
if err != nil {
log.Errorf("SendMetrics %s length: %d error: %v", metricName, len(dataList), err)
}
}(_metricName, _influxDbSpecs)
}
wg.Wait()
return nil
}
func (self *SApsaraCloudReport) collectRegionMetricOfRedis(region cloudprovider.ICloudRegion,
servers []jsonutils.JSONObject) error {
dataList := make([]influxdb.SMetricData, 0)
aliReg := region.(*apsara.SRegion)
since, until, err := common.TimeRangeFromArgs(self.Args)
if err != nil {
return err
}
redisDeployType := make(map[string]string)
for _, server := range servers {
local_category, err := server.GetString("local_category")
if err != nil {
return err
}
switch local_category {
case "single":
redisDeployType["single"] = "Standard"
case "master":
redisDeployType["master"] = "Standard"
case "cluster":
redisDeployType["cluster"] = "Sharding"
case "rwsplit":
redisDeployType["rwsplit"] = "Splitrw"
}
}
for metricName, influxDbSpecs := range aliRedisMetricSpecs {
for _, pre := range redisDeployType {
rtnArray, err := aliReg.FetchMetricData(pre+metricName, "acs_kvstore", since, until)
if err != nil {
log.Errorln(err)
continue
}
metrics := []SApsaraMetric{}
jsonutils.Update(&metrics, rtnArray)
for _, rtnMetric := range metrics {
for _, server := range servers {
external_id, _ := server.GetString("external_id")
if rtnMetric.InstanceId == external_id {
serverMetric, err := self.collectMetricFromThisServer(server, rtnMetric, influxDbSpecs)
serverMetric.Tags = append(serverMetric.Tags, influxdb.SKeyValue{Key: "node_id", Value: rtnMetric.NodeId})
if err != nil {
return err
}
dataList = append(dataList, serverMetric)
}
}
}
}
}
return common.SendMetrics(self.Session, dataList, self.Args.Debug, "")
}
func (self *SApsaraCloudReport) collectRegionMetricOfRds(region cloudprovider.ICloudRegion, servers []jsonutils.JSONObject) error {
dataList := make([]influxdb.SMetricData, 0)
aliReg := region.(*apsara.SRegion)
since, until, err := common.TimeRangeFromArgs(self.Args)
if err != nil {
return err
}
for metricName, influxDbSpecs := range aliRdsMetricSpecs {
rtnArray, err := aliReg.FetchMetricData(metricName, "acs_rds_dashboard", since, until)
if err != nil {
log.Errorln(err)
continue
}
metrics := []SApsaraMetric{}
jsonutils.Update(&metrics, rtnArray)
for _, rtnMetric := range metrics {
for _, server := range servers {
external_id, _ := server.GetString("external_id")
if rtnMetric.InstanceId == external_id {
metric, err := common.FillVMCapacity(server.(*jsonutils.JSONDict))
if err != nil {
return err
}
dataList = append(dataList, metric)
serverMetric, err := self.collectMetricFromThisServer(server, rtnMetric, influxDbSpecs)
if err != nil {
return err
}
dataList = append(dataList, serverMetric)
}
}
}
}
return common.SendMetrics(self.Session, dataList, self.Args.Debug, "")
}
func (self *SApsaraCloudReport) collectRegionMetricOfOss(region cloudprovider.ICloudRegion, servers []jsonutils.JSONObject) error {
dataList := make([]influxdb.SMetricData, 0)
aliReg := region.(*apsara.SRegion)
since, until, err := common.TimeRangeFromArgs(self.Args)
if err != nil {
return err
}
for metricName, influxDbSpecs := range aliOSSMetricSpecs {
rtnArray, err := aliReg.FetchMetricData(metricName, "acs_oss", since, until)
if err != nil {
log.Errorln(err)
continue
}
if len(rtnArray) > 0 {
for _, rtnMetric := range rtnArray {
for _, server := range servers {
name, _ := server.GetString("name")
if bucketName, _ := rtnMetric.GetString("BucketName"); bucketName == name {
serverMetric, err := self.collectOssMetricFromThisServer(server, rtnMetric, metricName,
influxDbSpecs)
if err != nil {
return err
}
dataList = append(dataList, serverMetric)
}
}
}
}
}
return common.SendMetrics(self.Session, dataList, self.Args.Debug, "")
}
func (self *SApsaraCloudReport) collectRegionMetricOfElb(region cloudprovider.ICloudRegion, servers []jsonutils.JSONObject) error {
dataList := make([]influxdb.SMetricData, 0)
aliReg := region.(*apsara.SRegion)
since, until, err := common.TimeRangeFromArgs(self.Args)
if err != nil {
return err
}
for metricName, influxDbSpecs := range aliElbMetricSpecs {
rtnArray, err := aliReg.FetchMetricData(metricName, "acs_slb_dashboard", since, until)
if err != nil {
log.Errorln(err)
continue
}
metrics := []SApsaraMetric{}
jsonutils.Update(&metrics, rtnArray)
for _, rtnMetric := range metrics {
for _, server := range servers {
external_id, _ := server.GetString("external_id")
if rtnMetric.InstanceId == external_id {
serverMetric, err := self.collectMetricFromThisServer(server, rtnMetric, influxDbSpecs)
if err != nil {
return err
}
dataList = append(dataList, serverMetric)
}
}
}
log.Infof("SendMetrics %s length: %d", metricName, len(dataList))
}
return common.SendMetrics(self.Session, dataList, self.Args.Debug, "")
}
func (self *SApsaraCloudReport) collectMetricFromThisServer(server jsonutils.JSONObject, rtnMetric SApsaraMetric, influxDbSpecs []string) (influxdb.SMetricData, error) {
metric, err := self.NewMetricFromJson(server)
if err != nil {
return influxdb.SMetricData{}, err
}
metric.Timestamp = time.Unix(rtnMetric.Timestamp/1000, 0)
fieldValue := rtnMetric.Average
//根据条件拼装metric的tag和metirc信息
influxDbSpec := influxDbSpecs[2]
measurement := common.SubstringBefore(influxDbSpec, ".")
var pairsKey string
if strings.Contains(influxDbSpec, ",") {
pairsKey = common.SubstringBetween(influxDbSpec, ".", ",")
} else {
pairsKey = common.SubstringAfter(influxDbSpec, ".")
}
if influxDbSpecs[1] == UNIT_BYTEPS && strings.Contains(pairsKey, UNIT_BPS) {
fieldValue = fieldValue * 8
}
tag := common.SubstringAfter(influxDbSpec, ",")
if tag != "" && strings.Contains(influxDbSpec, "=") {
metric.Tags = append(metric.Tags, influxdb.SKeyValue{
Key: common.SubstringBefore(tag, "="),
Value: common.SubstringAfter(tag, "="),
})
}
cpu_cout, err := server.Get("vcpu_count")
if err == nil {
metric.Metrics = append(metric.Metrics, influxdb.SKeyValue{
Key: "cpu_count",
Value: strconv.FormatInt(cpu_cout.(*jsonutils.JSONInt).Value(), 10),
})
}
metric.Metrics = append(metric.Metrics, influxdb.SKeyValue{
Key: pairsKey,
Value: strconv.FormatFloat(fieldValue, 'E', -1, 64),
})
metric.Name = measurement
return metric, nil
}
func (self *SApsaraCloudReport) collectOssMetricFromThisServer(server jsonutils.JSONObject, rtnMetric jsonutils.JSONObject,
metricName string, influxDbSpecs []string) (influxdb.SMetricData, error) {
metric, err := self.NewMetricFromJson(server)
//metric, err := common.JsonToMetric(server.(*jsonutils.JSONDict), "", common.ServerTags, make([]string, 0))
if err != nil {
return influxdb.SMetricData{}, err
}
timestamp, _ := rtnMetric.Get("timestamp")
metric.Timestamp = time.Unix(timestamp.(*jsonutils.JSONInt).Value()/1000, 0)
fieldValue, err := rtnMetric.Float(metricName)
if err != nil {
return influxdb.SMetricData{}, err
}
//根据条件拼装metric的tag和metirc信息
influxDbSpec := influxDbSpecs[2]
measurement := common.SubstringBefore(influxDbSpec, ".")
var pairsKey string
if strings.Contains(influxDbSpec, ",") {
pairsKey = common.SubstringBetween(influxDbSpec, ".", ",")
} else {
pairsKey = common.SubstringAfter(influxDbSpec, ".")
}
if influxDbSpecs[1] == UNIT_BYTEPS && strings.Contains(pairsKey, UNIT_BPS) {
fieldValue = fieldValue * 8
}
tag := common.SubstringAfter(influxDbSpec, ",")
if tag != "" && strings.Contains(influxDbSpec, "=") {
metric.Tags = append(metric.Tags, influxdb.SKeyValue{
Key: common.SubstringBefore(tag, "="),
Value: common.SubstringAfter(tag, "="),
})
}
cpu_cout, err := server.Get("vcpu_count")
if err == nil {
metric.Metrics = append(metric.Metrics, influxdb.SKeyValue{
Key: "cpu_count",
Value: strconv.FormatInt(cpu_cout.(*jsonutils.JSONInt).Value(), 10),
})
}
metric.Metrics = append(metric.Metrics, influxdb.SKeyValue{
Key: pairsKey,
Value: strconv.FormatFloat(fieldValue, 'E', -1, 64),
})
metric.Name = measurement
return metric, nil
}

View File

@@ -1,190 +0,0 @@
// Copyright 2019 Yunion
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package apsaramon
import "yunion.io/x/onecloud/pkg/cloudmon/collectors/common"
const (
PERIOD = 60
UNIT_AVERAGE = "Average"
DEFAULT_STATISTICS = "Average,Minimum,Maximum"
UNIT_PERCENT = "Percent"
UNIT_BPS = "bps"
UNIT_MBPS = "Mbps"
UNIT_BYTEPS = "Bps"
UNIT_CPS = "cps"
UNIT_COUNT = "count"
UNIT_MEM = "byte"
UNIT_MSEC = "ms"
UNIT_COUNT_SEC = "count/s"
//ESC监控指标
INFLUXDB_FIELD_CPU_USAGE = "vm_cpu.usage_active"
INFLUXDB_FIELD_MEM_USAGE = "vm_mem.used_percent"
INFLUXDB_FIELD_DISK_READ_BPS = "vm_diskio.read_bps"
INFLUXDB_FIELD_DISK_WRITE_BPS = "vm_diskio.write_bps"
INFLUXDB_FIELD_DISK_READ_IOPS = "vm_diskio.read_iops"
INFLUXDB_FIELD_DISK_WRITE_IOPS = "vm_diskio.write_iops"
INFLUXDB_FIELD_NET_BPS_RX = "vm_netio.bps_recv"
INFLUXDB_FIELD_NET_BPS_RX_INTERNET = INFLUXDB_FIELD_NET_BPS_RX + ",net_type=internet"
INFLUXDB_FIELD_NET_BPS_RX_INTRANET = INFLUXDB_FIELD_NET_BPS_RX + ",net_type=intranet"
INFLUXDB_FIELD_NET_BPS_TX = "vm_netio.bps_sent"
INFLUXDB_FIELD_NET_BPS_TX_INTERNET = INFLUXDB_FIELD_NET_BPS_TX + ",net_type=internet"
INFLUXDB_FIELD_NET_BPS_TX_INTRANET = INFLUXDB_FIELD_NET_BPS_TX + ",net_type=intranet"
INFLUXDB_FIELD_WANOUTTRAFFIC = "vm_eipio.bps_out"
INFLUXDB_FIELD_WANINTRAFFIC = "vm_eipio.bps_in"
INFLUXDB_FIELD_WANOUTPKG = "vm_eipio.pps_out"
INFLUXDB_FIELD_WANINPKG = "vm_eipio.pps_in"
//RDS监控指标
INFLUXDB_FIELD_RDS_CPU_USAGE = "rds_cpu.usage_active"
INFLUXDB_FIELD_RDS_MEM_USAGE = "rds_mem.used_percent"
INFLUXDB_FIELD_RDS_NET_BPS_RX = "rds_netio.bps_recv"
INFLUXDB_FIELD_RDS_NET_BPS_RX_MYSQL = INFLUXDB_FIELD_RDS_NET_BPS_RX + ",server_type=mysql"
INFLUXDB_FIELD_RDS_NET_BPS_RX_SQLSERVER = INFLUXDB_FIELD_RDS_NET_BPS_RX + ",server_type=sqlserver"
INFLUXDB_FIELD_RDS_NET_BPS_TX = "rds_netio.bps_sent"
INFLUXDB_FIELD_RDS_NET_BPS_TX_MYSQL = INFLUXDB_FIELD_RDS_NET_BPS_TX + ",server_type=mysql"
INFLUXDB_FIELD_RDS_NET_BPS_TX_SQLSERVER = INFLUXDB_FIELD_RDS_NET_BPS_TX + ",server_type=sqlserver"
INFLUXDB_FIELD_RDS_DISK_USAGE = "rds_disk.used_percent"
INFLUXDB_FIELD_RDS_DISK_READ_BPS = "rds_diskio.read_bps"
INFLUXDB_FIELD_RDS_DISK_WRITE_BPS = "rds_diskio.write_bps"
INFLUXDB_FIELD_RDS_CONN_COUNT = "rds_conn.used_count"
INFLUXDB_FIELD_RDS_CONN_USAGE = "rds_conn.used_percent"
INFLUXDB_FIELD_RDS_QPS = "rds_qps.query_qps"
INFLUXDB_FIELD_RDS_TPS = "rds_tps.trans_qps"
INFLUXDB_FIELD_RDS_INNODB_REDA_BPS = "rds_innodb.read_bps"
INFLUXDB_FIELD_RDS_INNODB_WRITE_BPS = "rds_innodb.write_bps"
//REDIS监控指标
INFLUXDB_FIELD_REDIS_CPU_USAGE = "dcs_cpu.usage_percent"
INFLUXDB_FIELD_REDIS_MEM_USAGE = "dcs_mem.used_percent"
INFLUXDB_FIELD_REDIS_NET_BPS_RX = "dcs_netio.bps_recv"
INFLUXDB_FIELD_REDIS_NET_BPS_TX = "dcs_netio.bps_sent"
INFLUXDB_FIFLD_REDIS_CONN_USAGE = "dcs_conn.used_conn"
INFLUXDB_FIFLD_REDIS_OPT_SES = "dcs_instantopt.opt_sec"
INFLUXDB_FIFLD_REDIS_CACHE_KEYS = "dcs_cachekeys.key_count"
INFLUXDB_FIFLD_REDIS_CACHE_EXP_KEYS = INFLUXDB_FIFLD_REDIS_CACHE_KEYS + ",exp=expire"
INFLUXDB_FIFLD_REDIS_DATA_MEM_USAGE = "dcs_datamem.used_byte"
//对象存储OSS监控指标
INFLUXDB_FIELD_OSS_NET_BPS_RX = "oss_netio.bps_recv"
INFLUXDB_FIELD_OSS_NET_BPS_RX_INTERNET = INFLUXDB_FIELD_OSS_NET_BPS_RX + ",net_type=internet"
INFLUXDB_FIELD_OSS_NET_BPS_RX_INTRANET = INFLUXDB_FIELD_OSS_NET_BPS_RX + ",net_type=intranet"
INFLUXDB_FIELD_OSS_NET_BPS_TX = "oss_netio.bps_sent"
INFLUXDB_FIELD_OSS_NET_BPS_TX_INTERNET = INFLUXDB_FIELD_OSS_NET_BPS_TX + ",net_type=internet"
INFLUXDB_FIELD_OSS_NET_BPS_TX_INTRANET = INFLUXDB_FIELD_OSS_NET_BPS_TX + ",net_type=intranet"
INFLUXDB_FIELD_OSS_LATECY = "oss_latency.req_late"
INFLUXDB_FIELD_OSS_LATECY_GET = INFLUXDB_FIELD_OSS_LATECY + ",request=get"
INFLUXDB_FIELD_OSS_LATECY_POST = INFLUXDB_FIELD_OSS_LATECY + ",request=post"
INFLUXDB_FIELD_OSS_REQ_COUNT = "oss_req.req_count"
INFLUXDB_FIELD_OSS_REQ_COUNT_GET = INFLUXDB_FIELD_OSS_REQ_COUNT + ",request=get"
INFLUXDB_FIELD_OSS_REQ_COUNT_POST = INFLUXDB_FIELD_OSS_REQ_COUNT + ",request=post"
INFLUXDB_FIELD_OSS_REQ_COUNT_5XX = INFLUXDB_FIELD_OSS_REQ_COUNT + ",request=5xx"
INFLUXDB_FIELD_OSS_REQ_COUNT_4XX = INFLUXDB_FIELD_OSS_REQ_COUNT + ",request=4xx"
//负载均衡监控指标
INFLUXDB_FIELD_ELB_NET_BPS_RX = "haproxy.bin"
INFLUXDB_FIELD_ELB_NET_BPS_TX = "haproxy.bout"
INFLUXDB_FIELD_ELB_REQ_RATE = "haproxy.req_rate,request=http"
INFLUXDB_FIELD_ELB_CONN_RATE = "haproxy.conn_rate,request=tcp"
INFLUXDB_FIELD_ELB_DREQ_COUNT = "haproxy.dreq,request=http"
INFLUXDB_FIELD_ELB_DCONN_COUNT = "haproxy.dcon,request=tcp"
INFLUXDB_FIELD_ELB_HRSP_COUNT = "haproxy.hrsp_Nxx"
INFLUXDB_FIELD_ELB_HRSP_COUNT_2XX = INFLUXDB_FIELD_ELB_HRSP_COUNT + ",request=2xx"
INFLUXDB_FIELD_ELB_HRSP_COUNT_3XX = INFLUXDB_FIELD_ELB_HRSP_COUNT + ",request=3xx"
INFLUXDB_FIELD_ELB_HRSP_COUNT_4XX = INFLUXDB_FIELD_ELB_HRSP_COUNT + ",request=4xx"
INFLUXDB_FIELD_ELB_HRSP_COUNT_5XX = INFLUXDB_FIELD_ELB_HRSP_COUNT + ",request=5xx"
INFLUXDB_FIELD_ELB_CHC_STATUS = "haproxy.check_status"
INFLUXDB_FIELD_ELB_CHC_CODE = "haproxy.check_code"
INFLUXDB_FIELD_ELB_LAST_CHC = "haproxy.last_chk"
KEY_VMS = "vms"
KEY_CPUS = "cpus"
KEY_MEMS = "mems"
KEY_DISKS = "disks"
KEY_LIMIT = "limit"
KEY_ADMIN = "admin"
KEY_USABLE = "usable"
)
//multiCloud查询指标列表组装
var aliMetricSpecs = map[string][]string{
"CPUUtilization": {DEFAULT_STATISTICS, UNIT_PERCENT, INFLUXDB_FIELD_CPU_USAGE},
"InternetInRate": {DEFAULT_STATISTICS, UNIT_BPS, INFLUXDB_FIELD_NET_BPS_RX_INTERNET},
"IntranetInRate": {DEFAULT_STATISTICS, UNIT_BPS, INFLUXDB_FIELD_NET_BPS_RX_INTRANET},
"InternetOutRate": {DEFAULT_STATISTICS, UNIT_BPS, INFLUXDB_FIELD_NET_BPS_TX_INTERNET},
"IntranetOutRate": {DEFAULT_STATISTICS, UNIT_BPS, INFLUXDB_FIELD_NET_BPS_TX_INTRANET},
"DiskReadBPS": {DEFAULT_STATISTICS, UNIT_BYTEPS, INFLUXDB_FIELD_DISK_READ_BPS},
"DiskWriteBPS": {DEFAULT_STATISTICS, UNIT_BYTEPS, INFLUXDB_FIELD_DISK_WRITE_BPS},
"DiskReadIOPS": {DEFAULT_STATISTICS, UNIT_CPS, INFLUXDB_FIELD_DISK_READ_IOPS},
"DiskWriteIOPS": {DEFAULT_STATISTICS, UNIT_CPS, INFLUXDB_FIELD_DISK_WRITE_IOPS},
}
var apsaraMetricSpecs = map[string][]string{
"vm.MemoryUtilization": {DEFAULT_STATISTICS, UNIT_PERCENT, INFLUXDB_FIELD_MEM_USAGE},
"vm.CPUUtilization": {DEFAULT_STATISTICS, UNIT_PERCENT, INFLUXDB_FIELD_CPU_USAGE},
"diskusage_utilization": {DEFAULT_STATISTICS, UNIT_PERCENT, common.INFLUXDB_FIELD_DISK_USAGE},
"InternetInRate": {DEFAULT_STATISTICS, UNIT_BPS, INFLUXDB_FIELD_NET_BPS_RX_INTERNET},
"IntranetInRate": {DEFAULT_STATISTICS, UNIT_BPS, INFLUXDB_FIELD_NET_BPS_RX_INTRANET},
"InternetOutRate": {DEFAULT_STATISTICS, UNIT_BPS, INFLUXDB_FIELD_NET_BPS_TX_INTERNET},
"IntranetOutRate": {DEFAULT_STATISTICS, UNIT_BPS, INFLUXDB_FIELD_NET_BPS_TX_INTRANET},
"DiskReadBPS": {DEFAULT_STATISTICS, UNIT_BYTEPS, INFLUXDB_FIELD_DISK_READ_BPS},
"DiskWriteBPS": {DEFAULT_STATISTICS, UNIT_BYTEPS, INFLUXDB_FIELD_DISK_WRITE_BPS},
"DiskReadIOPS": {DEFAULT_STATISTICS, UNIT_CPS, INFLUXDB_FIELD_DISK_READ_IOPS},
"DiskWriteIOPS": {DEFAULT_STATISTICS, UNIT_CPS, INFLUXDB_FIELD_DISK_WRITE_IOPS},
}
var aliRdsMetricSpecs = map[string][]string{
"CpuUsage": {DEFAULT_STATISTICS, UNIT_PERCENT, INFLUXDB_FIELD_RDS_CPU_USAGE},
"MemoryUsage": {DEFAULT_STATISTICS, UNIT_PERCENT, INFLUXDB_FIELD_RDS_MEM_USAGE},
"MySQL_NetworkInNew": {DEFAULT_STATISTICS, UNIT_BPS, INFLUXDB_FIELD_RDS_NET_BPS_RX_MYSQL},
"MySQL_NetworkOutNew": {DEFAULT_STATISTICS, UNIT_BPS, INFLUXDB_FIELD_RDS_NET_BPS_TX_MYSQL},
"DiskUsage": {DEFAULT_STATISTICS, UNIT_PERCENT, INFLUXDB_FIELD_RDS_DISK_USAGE},
"SQLServer_NetworkInNew": {DEFAULT_STATISTICS, UNIT_BPS, INFLUXDB_FIELD_RDS_NET_BPS_RX_SQLSERVER},
"SQLServer_NetworkOutNew": {DEFAULT_STATISTICS, UNIT_BPS, INFLUXDB_FIELD_RDS_NET_BPS_TX_SQLSERVER},
"ConnectionUsage": {DEFAULT_STATISTICS, UNIT_PERCENT, INFLUXDB_FIELD_RDS_CONN_USAGE},
}
var aliRedisMetricSpecs = map[string][]string{
"CpuUsage": {DEFAULT_STATISTICS, UNIT_PERCENT, INFLUXDB_FIELD_REDIS_CPU_USAGE},
"MemoryUsage": {DEFAULT_STATISTICS, UNIT_PERCENT, INFLUXDB_FIELD_REDIS_MEM_USAGE},
"IntranetIn": {DEFAULT_STATISTICS, UNIT_BPS, INFLUXDB_FIELD_REDIS_NET_BPS_RX},
"IntranetOut": {DEFAULT_STATISTICS, UNIT_BPS, INFLUXDB_FIELD_REDIS_NET_BPS_TX},
"UsedConnection": {DEFAULT_STATISTICS, UNIT_COUNT, INFLUXDB_FIFLD_REDIS_CONN_USAGE},
"UsedQPS": {DEFAULT_STATISTICS, UNIT_COUNT, INFLUXDB_FIFLD_REDIS_OPT_SES},
"Keys": {DEFAULT_STATISTICS, UNIT_COUNT, INFLUXDB_FIFLD_REDIS_CACHE_KEYS},
"ExpiredKeys": {DEFAULT_STATISTICS, UNIT_COUNT, INFLUXDB_FIFLD_REDIS_CACHE_EXP_KEYS},
"UsedMemory": {DEFAULT_STATISTICS, UNIT_MEM, INFLUXDB_FIFLD_REDIS_DATA_MEM_USAGE},
}
var aliOSSMetricSpecs = map[string][]string{
"InternetSend": {DEFAULT_STATISTICS, UNIT_MEM, INFLUXDB_FIELD_OSS_NET_BPS_TX_INTERNET},
"InternetRecv": {DEFAULT_STATISTICS, UNIT_MEM, INFLUXDB_FIELD_OSS_NET_BPS_RX_INTERNET},
"IntranetSend": {DEFAULT_STATISTICS, UNIT_MEM, INFLUXDB_FIELD_OSS_NET_BPS_TX_INTRANET},
"IntranetRecv": {DEFAULT_STATISTICS, UNIT_MEM, INFLUXDB_FIELD_OSS_NET_BPS_RX_INTRANET},
"GetObjectE2eLatency": {DEFAULT_STATISTICS, UNIT_MSEC, INFLUXDB_FIELD_OSS_LATECY_GET},
"PostObjectE2eLatency": {DEFAULT_STATISTICS, UNIT_MSEC, INFLUXDB_FIELD_OSS_LATECY_POST},
"GetObjectCount": {DEFAULT_STATISTICS, UNIT_COUNT, INFLUXDB_FIELD_OSS_REQ_COUNT_GET},
"PostObjectCount": {DEFAULT_STATISTICS, UNIT_COUNT, INFLUXDB_FIELD_OSS_REQ_COUNT_POST},
"ServerErrorCount": {DEFAULT_STATISTICS, UNIT_COUNT, INFLUXDB_FIELD_OSS_REQ_COUNT_5XX},
}
var aliElbMetricSpecs = map[string][]string{
"InstanceTrafficRX": {DEFAULT_STATISTICS, UNIT_BPS, INFLUXDB_FIELD_ELB_NET_BPS_RX},
"TrafficRXNew": {DEFAULT_STATISTICS, UNIT_BPS, INFLUXDB_FIELD_ELB_NET_BPS_RX},
"InstanceTrafficTX": {DEFAULT_STATISTICS, UNIT_BPS, INFLUXDB_FIELD_ELB_NET_BPS_TX},
"TrafficTXNew": {DEFAULT_STATISTICS, UNIT_BPS, INFLUXDB_FIELD_ELB_NET_BPS_TX},
"InstanceStatusCode2xx": {DEFAULT_STATISTICS, UNIT_COUNT_SEC, INFLUXDB_FIELD_ELB_HRSP_COUNT_2XX},
"InstanceStatusCode3xx": {DEFAULT_STATISTICS, UNIT_COUNT_SEC, INFLUXDB_FIELD_ELB_HRSP_COUNT_3XX},
"InstanceStatusCode4xx": {DEFAULT_STATISTICS, UNIT_COUNT_SEC, INFLUXDB_FIELD_ELB_HRSP_COUNT_4XX},
"InstanceStatusCode5xx": {DEFAULT_STATISTICS, UNIT_COUNT_SEC, INFLUXDB_FIELD_ELB_HRSP_COUNT_5XX},
}

View File

@@ -1,15 +0,0 @@
// Copyright 2019 Yunion
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package apsaramon // import "yunion.io/x/onecloud/pkg/cloudmon/collectors/apsaramon"

View File

@@ -1,87 +0,0 @@
// Copyright 2019 Yunion
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package awsmon
import (
"yunion.io/x/onecloud/pkg/apis/compute"
"yunion.io/x/onecloud/pkg/cloudmon/collectors/common"
"yunion.io/x/onecloud/pkg/cloudmon/options"
"yunion.io/x/onecloud/pkg/mcclient"
)
func init() {
factory := SAwsCloudReportFactory{}
common.RegisterFactory(&factory)
}
type SAwsCloudReportFactory struct {
common.CommonReportFactory
}
func (self *SAwsCloudReportFactory) NewCloudReport(provider *common.SProvider, session *mcclient.ClientSession,
args *options.ReportOptions, operatorType string) common.ICloudReport {
return &SAwsCloudReport{
common.CloudReportBase{
SProvider: provider,
Session: session,
Args: args,
Operator: operatorType,
},
}
}
func (self *SAwsCloudReportFactory) GetId() string {
return compute.CLOUD_PROVIDER_AWS
}
type SAwsCloudReport struct {
common.CloudReportBase
}
func (self *SAwsCloudReport) Report() error {
servers, err := self.GetResourceByOperator()
//servers, err := self.GetAllserverOfThisProvider(&modules.Servers)
if err != nil {
return err
}
providerInstance, err := self.InitProviderInstance()
if err != nil {
return err
}
regionList, regionServerMap, err := self.GetAllRegionOfServers(servers, providerInstance)
if err != nil {
return err
}
for _, region := range regionList {
servers := regionServerMap[region.GetGlobalId()]
switch self.Operator {
default:
err = common.CollectRegionMetricAsync(self.Args.Batch, region, servers, self)
//err = self.collectRegionMetricOfHost(region, servers)
//case "redis":
// err = self.collectRegionMetricOfRedis(region, servers)
//case "rds":
// err = self.collectRegionMetricOfRds(region, servers)
//case "oss":
// err = self.collectRegionMetricOfOss(region, servers)
//case "elb":
// err = self.collectRegionMetricOfElb(region, servers)
}
if err != nil {
return err
}
}
return nil
}

View File

@@ -1,160 +0,0 @@
// Copyright 2019 Yunion
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package awsmon
import (
"strconv"
"strings"
aws_sdk "github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/cloudwatch"
"yunion.io/x/jsonutils"
"yunion.io/x/log"
"yunion.io/x/onecloud/pkg/cloudmon/collectors/common"
"yunion.io/x/onecloud/pkg/cloudprovider"
"yunion.io/x/onecloud/pkg/multicloud/aws"
"yunion.io/x/onecloud/pkg/util/influxdb"
)
func (self *SAwsCloudReport) CollectRegionMetric(region cloudprovider.ICloudRegion,
servers []jsonutils.JSONObject) error {
var err error
switch self.Operator {
default:
err = self.collectRegionMetricOfHost(region, servers)
}
return err
}
func (self *SAwsCloudReport) collectRegionMetricOfHost(region cloudprovider.ICloudRegion,
servers []jsonutils.JSONObject) error {
dataList := make([]influxdb.SMetricData, 0)
awsRegion := region.(*aws.SRegion)
since, until, err := common.TimeRangeFromArgs(self.Args)
if err != nil {
return err
}
namespace, specs := self.getMetricSpecs(nil)
for metricName, influxDbSpecs := range specs {
for i, server := range servers {
//external_id, _ := servers[i].GetString("external_id")
name, val := self.getDimensionNameAndVal(servers[i])
rtnArray, err := awsRegion.GetMonitorDataByDimensionName(metricName, namespace, name, val,
since, until)
if err != nil {
log.Errorln(err)
continue
}
if len(rtnArray.Datapoints) > 0 {
for _, dataPoint := range rtnArray.Datapoints {
metric, err := common.FillVMCapacity(server.(*jsonutils.JSONDict))
if err != nil {
return err
}
dataList = append(dataList, metric)
serverMetric, err := self.collectMetricFromThisServerForAws(server, dataPoint, influxDbSpecs)
if err != nil {
return err
}
dataList = append(dataList, serverMetric)
}
}
}
err = common.SendMetrics(self.Session, dataList, self.Args.Debug, "")
if err != nil {
log.Errorln(err)
}
}
return nil
}
func (self *SAwsCloudReport) getMetricSpecs(res jsonutils.JSONObject) (string, map[string][]string) {
switch common.MonType(self.Operator) {
case common.SERVER:
return SERVER_METRIC_NAMESPACE, awsMetricSpecs
case common.REDIS:
return REDIS_METRIC_NAMESPACE, awsRedisMetricsSpec
case common.RDS:
return RDS_METRIC_NAMESPACE, awsRdsMetricSpecs
default:
return SERVER_METRIC_NAMESPACE, awsMetricSpecs
}
}
func (self *SAwsCloudReport) getDimensionNameAndVal(res jsonutils.JSONObject) (string, string) {
external_id, _ := res.GetString("external_id")
switch common.MonType(self.Operator) {
case common.SERVER:
return "InstanceId", external_id
case common.REDIS:
external_id, _ = res.GetString("name")
return "CacheClusterId", external_id
case common.RDS:
external_id, _ = res.GetString("name")
return "DBInstanceIdentifier", external_id
default:
return "InstanceId", external_id
}
}
func (self *SAwsCloudReport) collectMetricFromThisServerForAws(server jsonutils.JSONObject, datapoint *cloudwatch.Datapoint,
influxDbSpecs []string) (metric influxdb.SMetricData, err error) {
metric, err = self.NewMetricFromJson(server)
if err != nil {
return metric, err
}
metric.Timestamp = aws_sdk.TimeValue(datapoint.Timestamp)
fieldValue := aws_sdk.Float64Value(datapoint.Average)
//根据条件拼装metric的tag和metirc信息
influxDbSpec := influxDbSpecs[2]
measurement := common.SubstringBefore(influxDbSpec, ".")
var pairsKey string
if strings.Contains(influxDbSpec, ",") {
pairsKey = common.SubstringBetween(influxDbSpec, ".", ",")
} else {
pairsKey = common.SubstringAfter(influxDbSpec, ".")
}
// 300:AWS metric collection period is 5m
if influxDbSpecs[1] == UNIT_COUNT {
fieldValue = (fieldValue / float64(300))
}
if influxDbSpecs[1] == UNIT_MEM {
fieldValue = (fieldValue / float64(300) * 8)
}
if influxDbSpecs[1] == UNIT_BYTEPS {
fieldValue = (fieldValue * 8)
}
tag := common.SubstringAfter(influxDbSpec, ",")
if tag != "" && strings.Contains(influxDbSpec, "=") {
metric.Tags = append(metric.Tags, influxdb.SKeyValue{Key: common.SubstringBefore(tag, "="),
Value: common.SubstringAfter(tag, "=")})
}
cpu_cout, err := server.Get("vcpu_count")
if err != nil {
metric.Metrics = append(metric.Metrics, influxdb.SKeyValue{Key: pairsKey,
Value: strconv.FormatFloat(fieldValue, 'E', -1, 64)})
} else {
metric.Metrics = append(metric.Metrics, influxdb.SKeyValue{Key: "cpu_count",
Value: strconv.FormatInt(cpu_cout.(*jsonutils.JSONInt).Value(), 10)},
influxdb.SKeyValue{Key: pairsKey,
Value: strconv.FormatFloat(fieldValue, 'E', -1, 64)})
}
metric.Name = measurement
return metric, nil
}

View File

@@ -1,158 +0,0 @@
// Copyright 2019 Yunion
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package awsmon
const (
PERIOD = 60
UNIT_AVERAGE = "Average"
DEFAULT_STATISTICS = "Average,Minimum,Maximum"
UNIT_PERCENT = "Percent"
UNIT_BPS = "bps"
UNIT_MBPS = "Mbps"
UNIT_BYTEPS = "Bps"
UNIT_CPS = "cps"
UNIT_COUNT = "count"
UNIT_MEM = "byte"
UNIT_MSEC = "ms"
UNIT_COUNT_SEC = "count/s"
SERVER_METRIC_NAMESPACE = "AWS/EC2"
REDIS_METRIC_NAMESPACE = "AWS/ElastiCache"
RDS_METRIC_NAMESPACE = "AWS/RDS"
//ESC监控指标
INFLUXDB_FIELD_CPU_USAGE = "vm_cpu.usage_active"
INFLUXDB_FIELD_MEM_USAGE = "vm_mem.used_percent"
INFLUXDB_FIELD_DISK_READ_BPS = "vm_diskio.read_bps"
INFLUXDB_FIELD_DISK_WRITE_BPS = "vm_diskio.write_bps"
INFLUXDB_FIELD_DISK_READ_BPS_EBS = INFLUXDB_FIELD_DISK_READ_BPS + ",disk_type=ebs"
INFLUXDB_FIELD_DISK_WRITE_BPS_EBS = INFLUXDB_FIELD_DISK_WRITE_BPS + ",disk_type=ebs"
INFLUXDB_FIELD_DISK_READ_IOPS = "vm_diskio.read_iops"
INFLUXDB_FIELD_DISK_WRITE_IOPS = "vm_diskio.write_iops"
INFLUXDB_FIELD_DISK_READ_IOPS_EBS = INFLUXDB_FIELD_DISK_READ_IOPS + ",disk_type=ebs"
INFLUXDB_FIELD_DISK_WRITE_IOPS_EBS = INFLUXDB_FIELD_DISK_WRITE_IOPS + ",disk_type=ebs"
INFLUXDB_FIELD_NET_BPS_RX = "vm_netio.bps_recv"
INFLUXDB_FIELD_NET_BPS_RX_INTERNET = INFLUXDB_FIELD_NET_BPS_RX + ",net_type=internet"
INFLUXDB_FIELD_NET_BPS_RX_INTRANET = INFLUXDB_FIELD_NET_BPS_RX + ",net_type=intranet"
INFLUXDB_FIELD_NET_BPS_TX = "vm_netio.bps_sent"
INFLUXDB_FIELD_NET_BPS_TX_INTERNET = INFLUXDB_FIELD_NET_BPS_TX + ",net_type=internet"
INFLUXDB_FIELD_NET_BPS_TX_INTRANET = INFLUXDB_FIELD_NET_BPS_TX + ",net_type=intranet"
INFLUXDB_FIELD_WANOUTTRAFFIC = "vm_eipio.bps_out"
INFLUXDB_FIELD_WANINTRAFFIC = "vm_eipio.bps_in"
INFLUXDB_FIELD_WANOUTPKG = "vm_eipio.pps_out"
INFLUXDB_FIELD_WANINPKG = "vm_eipio.pps_in"
//RDS监控指标
INFLUXDB_FIELD_RDS_CPU_USAGE = "rds_cpu.usage_active"
INFLUXDB_FIELD_RDS_MEM_USAGE = "rds_mem.used_percent"
INFLUXDB_FIELD_RDS_NET_BPS_RX = "rds_netio.bps_recv"
INFLUXDB_FIELD_RDS_NET_BPS_RX_MYSQL = INFLUXDB_FIELD_RDS_NET_BPS_RX + ",server_type=mysql"
INFLUXDB_FIELD_RDS_NET_BPS_RX_SQLSERVER = INFLUXDB_FIELD_RDS_NET_BPS_RX + ",server_type=sqlserver"
INFLUXDB_FIELD_RDS_NET_BPS_TX = "rds_netio.bps_send"
INFLUXDB_FIELD_RDS_NET_BPS_TX_MYSQL = INFLUXDB_FIELD_RDS_NET_BPS_TX + ",server_type=mysql"
INFLUXDB_FIELD_RDS_NET_BPS_TX_SQLSERVER = INFLUXDB_FIELD_RDS_NET_BPS_TX + ",server_type=sqlserver"
INFLUXDB_FIELD_RDS_DISK_USAGE = "rds_disk.used_percent"
INFLUXDB_FIELD_RDS_DISK_READ_BPS = "rds_diskio.read_bps"
INFLUXDB_FIELD_RDS_DISK_WRITE_BPS = "rds_diskio.write_bps"
INFLUXDB_FIELD_RDS_CONN_COUNT = "rds_conn.used_count"
INFLUXDB_FIELD_RDS_CONN_USAGE = "rds_conn.used_percent"
INFLUXDB_FIELD_RDS_QPS = "rds_qps.query_qps"
INFLUXDB_FIELD_RDS_TPS = "rds_tps.trans_qps"
INFLUXDB_FIELD_RDS_INNODB_REDA_BPS = "rds_innodb.read_bps"
INFLUXDB_FIELD_RDS_INNODB_WRITE_BPS = "rds_innodb.write_bps"
//REDIS监控指标
INFLUXDB_FIELD_REDIS_CPU_USAGE = "dcs_cpu.usage_percent"
INFLUXDB_FIELD_REDIS_MEM_USAGE = "dcs_mem.used_percent"
INFLUXDB_FIELD_REDIS_NET_BPS_RX = "dcs_netio.bps_recv"
INFLUXDB_FIELD_REDIS_NET_BPS_TX = "dcs_netio.bps_sent"
INFLUXDB_FIFLD_REDIS_CONN_USAGE = "dcs_conn.used_conn"
INFLUXDB_FIFLD_REDIS_OPT_SES = "dcs_instantopt.opt_sec"
INFLUXDB_FIFLD_REDIS_CACHE_KEYS = "dcs_cachekeys.key_count"
INFLUXDB_FIFLD_REDIS_CACHE_KEYS_PERCENT = "dcs_cachekeys.used_percent"
INFLUXDB_FIFLD_REDIS_CACHE_EXP_KEYS = INFLUXDB_FIFLD_REDIS_CACHE_KEYS + ",exp=expire"
INFLUXDB_FIFLD_REDIS_DATA_MEM_USAGE = "dcs_datamem.used_byte"
//对象存储OSS监控指标
INFLUXDB_FIELD_OSS_NET_BPS_RX = "oss_netio.bps_recv"
INFLUXDB_FIELD_OSS_NET_BPS_RX_INTERNET = INFLUXDB_FIELD_OSS_NET_BPS_RX + ",net_type=internet"
INFLUXDB_FIELD_OSS_NET_BPS_RX_INTRANET = INFLUXDB_FIELD_OSS_NET_BPS_RX + ",net_type=intranet"
INFLUXDB_FIELD_OSS_NET_BPS_TX = "oss_netio.bps_sent"
INFLUXDB_FIELD_OSS_NET_BPS_TX_INTERNET = INFLUXDB_FIELD_OSS_NET_BPS_TX + ",net_type=internet"
INFLUXDB_FIELD_OSS_NET_BPS_TX_INTRANET = INFLUXDB_FIELD_OSS_NET_BPS_TX + ",net_type=intranet"
INFLUXDB_FIELD_OSS_LATECY = "oss_latency.req_late"
INFLUXDB_FIELD_OSS_LATECY_GET = INFLUXDB_FIELD_OSS_LATECY + ",request=get"
INFLUXDB_FIELD_OSS_LATECY_POST = INFLUXDB_FIELD_OSS_LATECY + ",request=post"
INFLUXDB_FIELD_OSS_REQ_COUNT = "oss_req.req_count"
INFLUXDB_FIELD_OSS_REQ_COUNT_GET = INFLUXDB_FIELD_OSS_REQ_COUNT + ",request=get"
INFLUXDB_FIELD_OSS_REQ_COUNT_POST = INFLUXDB_FIELD_OSS_REQ_COUNT + ",request=post"
INFLUXDB_FIELD_OSS_REQ_COUNT_5XX = INFLUXDB_FIELD_OSS_REQ_COUNT + ",request=5xx"
INFLUXDB_FIELD_OSS_REQ_COUNT_4XX = INFLUXDB_FIELD_OSS_REQ_COUNT + ",request=4xx"
//负载均衡监控指标
INFLUXDB_FIELD_ELB_NET_BPS_RX = "haproxy.bin"
INFLUXDB_FIELD_ELB_NET_BPS_TX = "haproxy.bout"
INFLUXDB_FIELD_ELB_REQ_RATE = "haproxy.req_rate,request=http"
INFLUXDB_FIELD_ELB_CONN_RATE = "haproxy.conn_rate,request=tcp"
INFLUXDB_FIELD_ELB_DREQ_COUNT = "haproxy.dreq,request=http"
INFLUXDB_FIELD_ELB_DCONN_COUNT = "haproxy.dcon,request=tcp"
INFLUXDB_FIELD_ELB_HRSP_COUNT = "haproxy.hrsp_Nxx"
INFLUXDB_FIELD_ELB_HRSP_COUNT_2XX = INFLUXDB_FIELD_ELB_HRSP_COUNT + ",request=2xx"
INFLUXDB_FIELD_ELB_HRSP_COUNT_3XX = INFLUXDB_FIELD_ELB_HRSP_COUNT + ",request=3xx"
INFLUXDB_FIELD_ELB_HRSP_COUNT_4XX = INFLUXDB_FIELD_ELB_HRSP_COUNT + ",request=4xx"
INFLUXDB_FIELD_ELB_HRSP_COUNT_5XX = INFLUXDB_FIELD_ELB_HRSP_COUNT + ",request=5xx"
INFLUXDB_FIELD_ELB_CHC_STATUS = "haproxy.check_status"
INFLUXDB_FIELD_ELB_CHC_CODE = "haproxy.check_code"
INFLUXDB_FIELD_ELB_LAST_CHC = "haproxy.last_chk"
KEY_VMS = "vms"
KEY_CPUS = "cpus"
KEY_MEMS = "mems"
KEY_DISKS = "disks"
KEY_LIMIT = "limit"
KEY_ADMIN = "admin"
KEY_USABLE = "usable"
)
//multiCloud查询指标列表组装
var awsMetricSpecs = map[string][]string{
"CPUUtilization": {DEFAULT_STATISTICS, UNIT_PERCENT, INFLUXDB_FIELD_CPU_USAGE},
"DiskReadOps": {DEFAULT_STATISTICS, UNIT_COUNT, INFLUXDB_FIELD_DISK_READ_IOPS},
"EBSReadOps": {DEFAULT_STATISTICS, UNIT_COUNT, INFLUXDB_FIELD_DISK_READ_IOPS_EBS},
"DiskWriteOps": {DEFAULT_STATISTICS, UNIT_COUNT, INFLUXDB_FIELD_DISK_WRITE_IOPS},
"EBSWriteOps": {DEFAULT_STATISTICS, UNIT_COUNT, INFLUXDB_FIELD_DISK_WRITE_IOPS_EBS},
"DiskReadBytes": {DEFAULT_STATISTICS, UNIT_MEM, INFLUXDB_FIELD_DISK_READ_BPS},
"EBSReadBytes": {DEFAULT_STATISTICS, UNIT_MEM, INFLUXDB_FIELD_DISK_READ_BPS_EBS},
"DiskWriteBytes": {DEFAULT_STATISTICS, UNIT_MEM, INFLUXDB_FIELD_DISK_WRITE_BPS},
"EBSWriteBytes": {DEFAULT_STATISTICS, UNIT_MEM, INFLUXDB_FIELD_DISK_WRITE_BPS_EBS},
"NetworkIn": {DEFAULT_STATISTICS, UNIT_MEM, INFLUXDB_FIELD_NET_BPS_RX},
"NetworkOut": {DEFAULT_STATISTICS, UNIT_MEM, INFLUXDB_FIELD_NET_BPS_TX},
}
var awsRdsMetricSpecs = map[string][]string{
"CPUUtilization": {DEFAULT_STATISTICS, UNIT_PERCENT, INFLUXDB_FIELD_RDS_CPU_USAGE},
"NetworkReceiveThroughput": {DEFAULT_STATISTICS, UNIT_BYTEPS, INFLUXDB_FIELD_RDS_NET_BPS_RX},
"NetworkTransmitThroughput": {DEFAULT_STATISTICS, UNIT_BYTEPS, INFLUXDB_FIELD_RDS_NET_BPS_TX},
"DatabaseConnections": {DEFAULT_STATISTICS, UNIT_COUNT, INFLUXDB_FIELD_RDS_CONN_COUNT},
}
var awsRedisMetricsSpec = map[string][]string{
"CPUUtilization": {DEFAULT_STATISTICS, UNIT_PERCENT, INFLUXDB_FIELD_REDIS_CPU_USAGE},
"CurrConnections": {DEFAULT_STATISTICS, UNIT_COUNT, INFLUXDB_FIFLD_REDIS_CONN_USAGE},
"Reclaimed": {DEFAULT_STATISTICS, UNIT_COUNT, INFLUXDB_FIFLD_REDIS_CACHE_EXP_KEYS},
"CacheHitRate": {DEFAULT_STATISTICS, UNIT_PERCENT, INFLUXDB_FIFLD_REDIS_CACHE_KEYS_PERCENT},
}

View File

@@ -1,15 +0,0 @@
// Copyright 2019 Yunion
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package awsmon // import "yunion.io/x/onecloud/pkg/cloudmon/collectors/awsmon"

Some files were not shown because too many files have changed in this diff Show More