Compare commits

...

432 Commits

Author SHA1 Message Date
yunion-ci-robot
b8f8c3bae4 Merge pull request #8174 from yousong/automated-cherry-pick-of-#8173-upstream-release-3.4
Automated cherry pick of #8173: dns: isMyDomain: match only strict subdomain of dns_domain
2020-09-30 16:31:49 +08:00
yunion-ci-robot
7f3c0103d0 Merge pull request #8167 from lvyangyang/automated-cherry-pick-of-#8153-upstream-release-3.4
Automated cherry pick of #8153: fix:允许cname record通过policy多值
2020-09-30 16:30:46 +08:00
yunion-ci-robot
499ddeba32 Merge pull request #8169 from swordqiu/automated-cherry-pick-of-#8168-upstream-release-3.4
Automated cherry pick of #8168: fix: emulated wire not sync vpc shared info
2020-09-30 16:17:47 +08:00
Yousong Zhou
7e191a503c dns: isMyDomain: match only strict subdomain of dns_domain 2020-09-30 16:15:59 +08:00
yunion-ci-robot
94eb72fb3c Merge pull request #8172 from ioito/automated-cherry-pick-of-#8171-upstream-release-3.4
Automated cherry pick of #8171: fix: 允许域管理员可以看到共享的dns zone cache列表
2020-09-30 16:13:47 +08:00
Qu Xuan
02bcce195c fix: 允许域管理员可以看到共享的dns zone cache列表 2020-09-30 15:57:51 +08:00
Qiu Jian
5c4423bcbe fix: emulated wire not sync vpc shared info 2020-09-30 15:54:34 +08:00
lvyangyang
9b7fbf33b8 fix:允许cname record通过policy多值 2020-09-30 15:50:13 +08:00
yunion-ci-robot
a7a8ad1931 Merge pull request #8164 from swordqiu/automated-cherry-pick-of-#8163-upstream-release-3.4
Automated cherry pick of #8163: fix: oidc response user's info
2020-09-30 12:11:46 +08:00
yunion-ci-robot
6c8b30e1be Merge pull request #8166 from swordqiu/automated-cherry-pick-of-#8165-upstream-release-3.4
Automated cherry pick of #8165: fix: revert filter-by-owner changes of scoped resource
2020-09-30 12:07:51 +08:00
Qiu Jian
8cdab93c15 fix: oidc response user's info 2020-09-30 11:57:21 +08:00
Qiu Jian
8a28d26271 fix: revert filter-by-owner changes of scoped resource 2020-09-30 11:34:56 +08:00
yunion-ci-robot
29fa258c6e Merge pull request #8162 from tb365/automated-cherry-pick-of-#8159-upstream-release-3.4
Automated cherry pick of #8159: aliyun public elb region fix
2020-09-29 23:28:41 +08:00
TangBin
7a61d77b06 aliyun public elb region fix 2020-09-29 22:05:47 +08:00
yunion-ci-robot
552dd2bfd1 Merge pull request #8148 from lvyangyang/automated-cherry-pick-of-#8145-upstream-release-3.4
Automated cherry pick of #8145: fix:forbid top level public domain name
2020-09-29 20:21:36 +08:00
yunion-ci-robot
60c42975a8 Merge pull request #8158 from zhaoxiangchun/automated-cherry-pick-of-#8076-upstream-release-3.4
Automated cherry pick of #8076: bugfix:commonalert
2020-09-29 19:17:34 +08:00
yunion-ci-robot
ad53ddd84b Merge pull request #8157 from tb365/automated-cherry-pick-of-#8154-upstream-release-3.4
Automated cherry pick of #8154: aliyun public elb brand fix
2020-09-29 18:19:33 +08:00
zhaoxiangchun
e87d2c0e86 bugfix commalert 3.4
1.后端先隐藏rds,redis,oss等相关信息
2.报警通知中规则描述增加单位信息
3.调整优化建议规则相关逻辑
2020-09-29 18:14:05 +08:00
zhaoxiangchun
a9c95cf363 bugfix:commonalert
1.suggestrule cli 调整
2020-09-29 18:14:05 +08:00
TangBin
540f4631f4 aliyun public elb brand fix 2020-09-29 16:49:41 +08:00
yunion-ci-robot
6db3ec81ea Merge pull request #8150 from ioito/automated-cherry-pick-of-#8149-upstream-release-3.4
Automated cherry pick of #8149: fix: allow domain admin view shared dns zone records
2020-09-29 12:23:33 +08:00
yunion-ci-robot
abc2be7e5e Merge pull request #8147 from ioito/automated-cherry-pick-of-#8146-upstream-release-3.4
Automated cherry pick of #8146: fix: avoid sync dns zone cache status is init
2020-09-29 12:20:34 +08:00
Qu Xuan
b0e1d0de23 fix: allow domain admin view shared dns zone records 2020-09-29 11:20:35 +08:00
lvyangyang
fba8349e84 fix:forbid top level public domain name 2020-09-29 11:04:10 +08:00
yunion-ci-robot
9bd70e3cb6 Merge pull request #8102 from rainzm/automated-cherry-pick-of-#8101-upstream-release-3.4
Automated cherry pick of #8101: fix(region): set ownerId as userCred when can't FetchOwnerId
2020-09-29 10:41:39 +08:00
Qu Xuan
f931deb41f fix: avoid sync dns zone cache status is init 2020-09-29 10:39:54 +08:00
yunion-ci-robot
324e7435ac Merge pull request #8144 from zexi/automated-cherry-pick-of-#8143-upstream-release-3.4
Automated cherry pick of #8143: mcclient modules: fix k8s fed rolebinding joint wrong resource manager
2020-09-29 10:35:36 +08:00
Zexi Li
1a1d7c70ad mcclient modules: fix k8s fed rolebinding joint wrong resource manager 2020-09-29 08:28:05 +08:00
yunion-ci-robot
3a773f87d3 Merge pull request #8142 from swordqiu/automated-cherry-pick-of-#8141-upstream-release-3.4
Automated cherry pick of #8141: fix: filter storages by host schedtag
2020-09-29 01:20:35 +08:00
Qiu Jian
11ea89795a fix: filter storages by host schedtag 2020-09-29 00:20:26 +08:00
yunion-ci-robot
288b9e02af Merge pull request #8140 from zhaoxiangchun/automated-cherry-pick-of-#8139-upstream-release-3.4
Automated cherry pick of #8139: bugfix :esxi 多机器环境下拉取监控超时
2020-09-28 18:27:33 +08:00
zhaoxiangchun
b88c114ba6 bugfix :esxi 多机器环境下拉取监控超时
1.简化mo.virtualMachine 实体中的属性
2.批量获取cloudprovider下所有的虚拟机的监控信息
2020-09-28 18:13:27 +08:00
Zexi Li
aa3ff8ac5b Merge pull request #8138 from zexi/automated-cherry-pick-of-#8137-upstream-release-3.4
Automated cherry pick of #8137: region: host specs replace space char to '_'
2020-09-28 17:46:58 +08:00
Zexi Li
3b0ba2caa9 region: host specs replace space char to '_' 2020-09-28 17:38:54 +08:00
Zexi Li
4dff79bdd0 Merge pull request #8136 from zexi/automated-cherry-pick-of-#8135-upstream-release-3.4
Automated cherry pick of #8135: specs: fix specKey url not escape
2020-09-28 17:01:44 +08:00
Zexi Li
a4d7b2b4b3 specs: fix specKey url not escape 2020-09-28 16:55:56 +08:00
yunion-ci-robot
f2b0fa1911 Merge pull request #8134 from rainzm/automated-cherry-pick-of-#8133-upstream-release-3.4
Automated cherry pick of #8133: fix(scheduler): filter InstanceGroup whose enabled is false
2020-09-28 16:40:35 +08:00
yunion-ci-robot
c1a963801f Merge pull request #8128 from lvyangyang/automated-cherry-pick-of-#8086-upstream-release-3.4
Automated cherry pick of #8086: fix:/dnsrecordset重复检查,dnszonevpc数量
2020-09-28 16:30:33 +08:00
yunion-ci-robot
95456e3e08 Merge pull request #8124 from rainzm/automated-cherry-pick-of-#8123-upstream-release-3.4
Automated cherry pick of #8123: fix: suffix template cache key
2020-09-28 16:28:35 +08:00
Zexi Li
41c84ca8ec Merge pull request #8132 from tb365/automated-cherry-pick-of-#8129-upstream-release-3.4
Automated cherry pick of #8129: aliyun create public lb fix
2020-09-28 16:24:36 +08:00
Rain
e6de7be7e1 fix(scheduler): filter InstanceGroup whose enabled is false 2020-09-28 16:06:17 +08:00
TangBin
3ddce26aa0 aliyun create public lb fix 2020-09-28 14:20:57 +08:00
lvyangyang
d94e55501a fix:/dnsrecordset重复检查,dnszonevpc数量 2020-09-28 11:08:41 +08:00
yunion-ci-robot
a9ca6e0a8a Merge pull request #8122 from zexi/automated-cherry-pick-of-#8121-upstream-release-3.4
Automated cherry pick of #8121: region: fix query object by spec not include details
2020-09-27 22:10:35 +08:00
rainzm
ad22483113 fix: suffix template cache key 2020-09-27 21:10:03 +08:00
yunion-ci-robot
4e9af39d73 Merge pull request #8117 from wanyaoqi/automated-cherry-pick-of-#8116-upstream-release-3.4
Automated cherry pick of #8116: umount nfs on detach storage
2020-09-27 21:03:37 +08:00
Zexi Li
a05f50dbf0 region: fix query object by spec not include details 2020-09-27 20:48:47 +08:00
wanyaoqi
adbe292f48 increase rbd check timeout 2020-09-27 20:19:50 +08:00
wanyaoqi
61cc180101 umount nfs on detach storage 2020-09-27 20:19:50 +08:00
yunion-ci-robot
1fd043c99b Merge pull request #8115 from swordqiu/automated-cherry-pick-of-#8114-upstream-release-3.4
Automated cherry pick of #8114: fix: filter cloudprovider/network by host-schedtag-id
2020-09-27 19:56:38 +08:00
Qiu Jian
82c0dcfb38 fix: filter cloudprovider/network by host-schedtag-id 2020-09-27 18:30:36 +08:00
yunion-ci-robot
ea5fbef0c2 Merge pull request #8111 from ioito/automated-cherry-pick-of-#8110-upstream-release-3.4
Automated cherry pick of #8110: fix: dns zone cache owner info
2020-09-27 16:51:34 +08:00
yunion-ci-robot
c1d66fc4e7 Merge pull request #8094 from tb365/automated-cherry-pick-of-#8087-upstream-release-3.4
Automated cherry pick of #8087: huawei snapshot delete fix
2020-09-27 15:11:32 +08:00
Zexi Li
b7423baf1f Merge pull request #8085 from ioito/automated-cherry-pick-of-#8084-upstream-release-3.4
Automated cherry pick of #8084: fix: openstack zone not emulated
2020-09-27 14:46:55 +08:00
Zexi Li
0ca3349d58 Merge pull request #8089 from wanyaoqi/automated-cherry-pick-of-#8088-upstream-release-3.4
Automated cherry pick of #8088: set stagefail on clean fail
2020-09-27 14:46:00 +08:00
yunion-ci-robot
8dde6a6ac4 Merge pull request #8100 from rainzm/automated-cherry-pick-of-#8099-upstream-release-3.4
Automated cherry pick of #8099: fix(esxi): Guarantee the uniqueness of the schedtag for esxi host
2020-09-27 14:45:34 +08:00
yunion-ci-robot
0d2d5b0728 Merge pull request #8108 from ioito/automated-cherry-pick-of-#8107-upstream-release-3.4
Automated cherry pick of #8107: fix: allow create disk prefer manager
2020-09-27 14:44:35 +08:00
Qu Xuan
da8529a00a fix: dns zone cache owner info 2020-09-27 14:35:49 +08:00
Qu Xuan
73aee11474 fix: allow create disk prefer manager 2020-09-27 14:18:44 +08:00
yunion-ci-robot
5229c06dfc Merge pull request #8060 from ioito/automated-cherry-pick-of-#8059-upstream-release-3.4
Automated cherry pick of #8059: fix: avoid serial vm creation
2020-09-26 23:18:33 +08:00
yunion-ci-robot
37b2b30af5 Merge pull request #8105 from zexi/automated-cherry-pick-of-#8104-upstream-release-3.4
Automated cherry pick of #8104: region: fix schedtag joint resource master/slave field wrong order
2020-09-26 08:48:31 +08:00
Zexi Li
7baaf23f84 Merge pull request #8096 from ioito/automated-cherry-pick-of-#8095-upstream-release-3.4
Automated cherry pick of #8095: fix: avoid purge storages
2020-09-25 20:54:42 +08:00
Zexi Li
1b6ac9bc48 region: fix schedtag joint resource master/slave field wrong order 2020-09-25 20:50:49 +08:00
rainzm
1215d723af fix(region): set ownerId as userCred when can't FetchOwnerId 2020-09-25 20:38:23 +08:00
rainzm
4586c82cb2 fix:(region) correct syncSchedtags
1.把extTagName存到metadata里面,这样就算修改tag的name,也能在metadata里面拿到。
2.已经创建的schedtag就不要重复创建了。
2020-09-25 20:28:27 +08:00
rainzm
5460f22444 fix(esxi): Guarantee the uniqueness of the schedtag for esxi host
Replace 'cluster:<clustername>' with
'cluster:/<cloudprovidername>/<dcname>/<clustername>'.
2020-09-25 20:28:27 +08:00
Qu Xuan
f5cf093e0f fix: avoid purge storages 2020-09-25 19:16:21 +08:00
TangBin
77865d894e huawei client request add throttling control 2020-09-25 19:07:41 +08:00
TangBin
454aabca75 huawei elb get params log 2020-09-25 19:07:41 +08:00
TangBin
c6d2149914 qcloud elb create listener fix 2020-09-25 19:07:41 +08:00
TangBin
ebee608109 huawei snapshot delete fix 2020-09-25 19:07:41 +08:00
wanyaoqi
7e2e7ade19 set stagefail on clean fail 2020-09-25 18:42:57 +08:00
Zexi Li
5d39338d60 Merge pull request #8083 from ioito/automated-cherry-pick-of-#8075-upstream-release-3.4
Automated cherry pick of #8075: fix: allow cross doamin resource sync
2020-09-25 16:56:36 +08:00
ioito
3903af786b fix: openstack zone not emulated 2020-09-25 16:15:34 +08:00
ioito
91cac5c217 fix: allow cross doamin resource sync 2020-09-25 15:49:57 +08:00
Zexi Li
12ef953b70 Merge pull request #8078 from ioito/automated-cherry-pick-of-#8077-upstream-release-3.4
Automated cherry pick of #8077: fix: avoid account delete failed
2020-09-25 12:11:43 +08:00
Zexi Li
d029dc22c0 Merge pull request #8018 from rainzm/automated-cherry-pick-of-#8017-upstream-release-3.4
Automated cherry pick of #8017: refactor(region): replace 'ActualCapacity' with 'ActualCapacityUsed'
2020-09-25 12:08:29 +08:00
Zexi Li
0deb8ea928 Merge pull request #8055 from rainzm/automated-cherry-pick-of-#8054-upstream-release-3.4
Automated cherry pick of #8054: feat: add GetSchedtags for ICloudHost
2020-09-25 12:07:13 +08:00
Zexi Li
1ffa6f5295 Merge pull request #8081 from zexi/automated-cherry-pick-of-#8080-upstream-release-3.4
Automated cherry pick of #8080: climc: add k8s fed resource sync action
2020-09-25 12:06:18 +08:00
Zexi Li
37b9a2e53d climc: add k8s fed resource sync action 2020-09-25 11:52:20 +08:00
yunion-ci-robot
f6a620ac46 Merge pull request #8067 from lvyangyang/automated-cherry-pick-of-#8002-upstream-release-3.4
Automated cherry pick of #8002: wait deleted
2020-09-25 11:13:30 +08:00
ioito
5f50314df6 fix: avoid account delete failed 2020-09-25 10:54:25 +08:00
rainzm
9ded6e43f1 feat(region): sync capacityUsed for storage after deploying or deleting guest 2020-09-25 10:35:01 +08:00
rainzm
547b2960b1 feat(region): sync CapacityUsed for Storage 2020-09-25 10:35:01 +08:00
rainzm
116d347c88 feat: add GetCapacityUsedMB for ICloudStorage 2020-09-25 10:35:01 +08:00
rainzm
e0c94daaf7 refactor(region): replace 'ActualCapacity' with 'ActualCapacityUsed' 2020-09-25 10:35:01 +08:00
rainzm
679ccb825a feat(region): sync schedtags when syncing host 2020-09-25 10:31:49 +08:00
rainzm
857e76ab78 feat(esxi): add GetSchedtags implementation for esxi.SHost 2020-09-25 10:31:49 +08:00
rainzm
0d05f9ee18 feat: add GetSchedtags for ICloudHost 2020-09-25 10:31:49 +08:00
Zexi Li
7e362cae3d Merge pull request #8057 from ioito/automated-cherry-pick-of-#8056-upstream-release-3.4
Automated cherry pick of #8056: fix: 仅在可用区故障时可强制挂载磁盘
2020-09-25 01:40:52 +08:00
Zexi Li
54ee77db03 Merge pull request #8066 from lvyangyang/automated-cherry-pick-of-#8013-upstream-release-3.4
Automated cherry pick of #8013: fix: dns 错误信息补全
2020-09-25 01:39:40 +08:00
Zexi Li
95b82d299d Merge pull request #8069 from ioito/automated-cherry-pick-of-#8068-upstream-release-3.4
Automated cherry pick of #8068: fix: avoid compare err with cloudprovider.ErrNotFound direct
2020-09-25 01:38:22 +08:00
Zexi Li
e4605d8c3b Merge pull request #8064 from rainzm/automated-cherry-pick-of-#8063-upstream-release-3.4
Automated cherry pick of #8063: fix(region): fetch correct ownerId in PerformPrepareNets
2020-09-24 21:22:00 +08:00
Zexi Li
652eb65252 Merge pull request #8072 from ioito/automated-cherry-pick-of-#8071-upstream-release-3.4
Automated cherry pick of #8071: fix: sql err
2020-09-24 21:19:26 +08:00
ioito
310baa266b fix: sql err 2020-09-24 20:22:39 +08:00
ioito
5f2c771f73 fix: avoid compare err with cloudprovider.ErrNotFound direct 2020-09-24 20:15:48 +08:00
lvyangyang
d90b661f7e wait deleted 2020-09-24 17:40:21 +08:00
lvyangyang
8d28bfc6d2 fix: dns 错误信息补全 2020-09-24 17:36:58 +08:00
rainzm
c7b8e84ffe fix(region): fetch correct ownerId in PerformPrepareNets 2020-09-24 17:26:17 +08:00
ioito
b5088230bf fix: avoid serial vm creation 2020-09-24 16:41:02 +08:00
ioito
4038bfb8a1 fix: 仅在可用区故障时可强制挂载磁盘 2020-09-24 15:39:09 +08:00
yunion-ci-robot
afb8924762 Merge pull request #8050 from zexi/automated-cherry-pick-of-#8049-upstream-release-3.4
Automated cherry pick of #8049: climc: refactor k8s sub command
2020-09-24 10:59:19 +08:00
yunion-ci-robot
796c3d1d48 Merge pull request #8008 from rainzm/automated-cherry-pick-of-#8007-upstream-release-3.4
Automated cherry pick of #8007: Fix & Feat of Notify or Lang
2020-09-24 10:43:19 +08:00
yunion-ci-robot
57a2258d94 Merge pull request #8053 from zhaoxiangchun/automated-cherry-pick-of-#8051-upstream-release-3.4
Automated cherry pick of #8051: commonalert bugfix 3.4
2020-09-24 10:24:20 +08:00
zhaoxiangchun
365e555c98 commonalert bugfix 3.4 2020-09-24 10:20:58 +08:00
Zexi Li
63603359e7 Merge pull request #8046 from ioito/automated-cherry-pick-of-#8029-upstream-release-3.4
Automated cherry pick of #8029: fix: avoid account delete failed
2020-09-23 23:51:44 +08:00
Zexi Li
fc3b794515 Merge pull request #8052 from swordqiu/automated-cherry-pick-of-#8048-upstream-release-3.4
Automated cherry pick of #8048: fix: scope resource filter by owner
2020-09-23 23:49:38 +08:00
Zexi Li
51020aac04 climc: refactor k8s sub command 2020-09-23 23:43:55 +08:00
yunion-ci-robot
32470e2ad3 Merge pull request #8032 from wanyaoqi/automated-cherry-pick-of-#8031-upstream-release-3.4
Automated cherry pick of #8031: support mutli params
2020-09-23 23:13:23 +08:00
Qiu Jian
975e7fb1e8 fix: scope resource filter by owner 2020-09-23 22:58:52 +08:00
rainzm
1c786a034b fix: use i18n.Table to handle Chinese-English conversion 2020-09-23 21:26:35 +08:00
rainzm
2d5055c908 feat: log err when sending notification via notifyclient 2020-09-23 21:26:35 +08:00
rainzm
471e2b4f13 fix(region): split brand as 'YunionCloud' and '云联壹云' when notify server event 2020-09-23 21:26:35 +08:00
rainzm
8da2d5ff7a feat: inherit lang from ctx fro Task 2020-09-23 21:26:35 +08:00
rainzm
043fdcfec2 fix(notify): modify name of notification to avoid duplication 2020-09-23 21:26:35 +08:00
rainzm
09bebcf5f4 fix(notify): clean verifyNote when mark verified 2020-09-23 21:26:35 +08:00
rainzm
d917e8e386 fix(notify): return correct value when sortContactType 2020-09-23 21:26:35 +08:00
yunion-ci-robot
7d163f63a1 Merge pull request #8025 from swordqiu/automated-cherry-pick-of-#8024-upstream-release-3.4
Automated cherry pick of #8024: fix: apigateway userinfo includes project metadata
2020-09-23 21:24:25 +08:00
yunion-ci-robot
8ce445487b Merge pull request #8015 from wanyaoqi/automated-cherry-pick-of-#8014-upstream-release-3.4
Automated cherry pick of #8014: support search ip
2020-09-23 21:22:21 +08:00
Zexi Li
6cff31add6 Merge pull request #8012 from ioito/automated-cherry-pick-of-#8011-upstream-release-3.4
Automated cherry pick of #8011: fix: 避免添加新账号后长时间未同步iam用户
2020-09-23 21:10:26 +08:00
Zexi Li
7698dcf506 Merge pull request #8010 from ioito/automated-cherry-pick-of-#8009-upstream-release-3.4
Automated cherry pick of #8009: fix: 优化提取显示主账号名
2020-09-23 21:08:35 +08:00
yunion-ci-robot
a7e537f4df Merge pull request #8045 from lvyangyang/automated-cherry-pick-of-#8044-upstream-release-3.4
Automated cherry pick of #8044: fix: error 值重叠
2020-09-23 21:08:22 +08:00
yunion-ci-robot
d23ffbb997 Merge pull request #8035 from swordqiu/automated-cherry-pick-of-#8034-upstream-release-3.4
Automated cherry pick of #8034: fix: role assignment filter by users not working for effective users in groups
2020-09-23 20:59:20 +08:00
ioito
c38cb271f8 fix: avoid account delete failed 2020-09-23 20:58:41 +08:00
yunion-ci-robot
c4c07c4e9d Merge pull request #8033 from yousong/automated-cherry-pick-of-#8030-upstream-release-3.4
Automated cherry pick of #8030: monitor: error fmt
2020-09-23 20:56:19 +08:00
yunion-ci-robot
682fa5e5bd Merge pull request #8037 from rainzm/automated-cherry-pick-of-#8036-upstream-release-3.4
Automated cherry pick of #8036: fix(region): add GetSlaveFieldName for ScalingGroupGuest
2020-09-23 20:52:19 +08:00
yunion-ci-robot
cefe057dc8 Merge pull request #8027 from ioito/automated-cherry-pick-of-#8026-upstream-release-3.4
Automated cherry pick of #8026: fix: 避免腾讯云同步虚拟机ip异常
2020-09-23 20:51:31 +08:00
yunion-ci-robot
1026b74e65 Merge pull request #8042 from zhaoxiangchun/automated-cherry-pick-of-#8041-upstream-release-3.4
Automated cherry pick of #8041: bugfix:esxi collect metric
2020-09-23 20:42:20 +08:00
yunion-ci-robot
ccce0a4be5 Merge pull request #8040 from zhasm/automated-cherry-pick-of-#8039-upstream-release-3.4
Automated cherry pick of #8039: fix esxi-agent dockerfile typo
2020-09-23 20:41:20 +08:00
lvyangyang
9a04238b77 fix: error 值重叠 2020-09-23 20:11:25 +08:00
zhaoxiangchun
a7198dc21b bugfix:esxi collect metric 2020-09-23 19:49:28 +08:00
Zhang Dongliang
78fc35d3a6 fix esxi-agent dockerfile typo 2020-09-23 18:56:28 +08:00
Yousong Zhou
70fd9dfb70 locales: monitor: add translations 2020-09-23 18:43:17 +08:00
Yousong Zhou
572e45968d monitor: error fmt 2020-09-23 18:43:17 +08:00
rainzm
35842df1bd fix(region): add GetSlaveFieldName for ScalingGroupGuest 2020-09-23 18:39:16 +08:00
Qiu Jian
b32eddce03 fix: role assignment filter by users not working for effective users in groups 2020-09-23 18:31:00 +08:00
wanyaoqi
8102e7ed00 support mutli params 2020-09-23 18:25:06 +08:00
ioito
f659ccd0d5 fix: 避免腾讯云同步虚拟机ip异常 2020-09-23 18:17:36 +08:00
yunion-ci-robot
27fe6bc38d Merge pull request #8022 from yousong/automated-cherry-pick-of-#8021-upstream-release-3.4
Automated cherry pick of #8021: elasticips: fix calling FilterByOwner
2020-09-23 17:27:19 +08:00
yunion-ci-robot
b118f341bc Merge pull request #8020 from zhasm/automated-cherry-pick-of-#8019-upstream-release-3.4
Automated cherry pick of #8019: make with ARCH argument
2020-09-23 16:38:18 +08:00
Yousong Zhou
59a5e9201e elasticips: error when we have no usable eip network 2020-09-23 16:22:49 +08:00
Yousong Zhou
430e9cd0fc elasticips: fix calling FilterByOwner 2020-09-23 16:22:49 +08:00
Qiu Jian
5b6b5eeb7d fix: apigateway userinfo includes project metadata 2020-09-23 16:07:00 +08:00
Zhang Dongliang
384e866649 make with ARCH argument 2020-09-23 15:57:49 +08:00
wanyaoqi
884e82a150 support search ip 2020-09-23 14:26:43 +08:00
ioito
b3c235fe30 fix: 避免添加新账号后长时间未同步iam用户 2020-09-23 10:34:04 +08:00
ioito
686df64ea9 fix: 优化提取显示主账号名 2020-09-22 21:24:33 +08:00
yunion-ci-robot
d8fa8a49fb Merge pull request #8006 from tb365/automated-cherry-pick-of-#8003-upstream-release-3.4
Automated cherry pick of #8003: regional network filter bugfix
2020-09-22 21:18:23 +08:00
yunion-ci-robot
1afeca5687 Merge pull request #8001 from ioito/automated-cherry-pick-of-#7990-upstream-release-3.4
Automated cherry pick of #7990: fix: avoid not reture cloudprovider.ErrNotFound error
2020-09-22 21:12:18 +08:00
yunion-ci-robot
304457a3b4 Merge pull request #7999 from ioito/automated-cherry-pick-of-#7998-upstream-release-3.4
Automated cherry pick of #7998: optimized: create eip params
2020-09-22 21:10:18 +08:00
TangBin
0bba6e63f0 regional network filter bugfix 2020-09-22 20:06:48 +08:00
Qu Xuan
bb3317cc32 fix: avoid not reture cloudprovider.ErrNotFound error 2020-09-22 16:49:38 +08:00
Qu Xuan
becf92f6bf optimized: create eip params 2020-09-22 16:47:42 +08:00
yunion-ci-robot
632ab6c2f9 Merge pull request #7987 from zhaoxiangchun/automated-cherry-pick-of-#7986-upstream-release-3.4
Automated cherry pick of #7986: common alert bugfix/3.4
2020-09-22 14:40:18 +08:00
yunion-ci-robot
cb0b0bea41 Merge pull request #7992 from zhaoxiangchun/automated-cherry-pick-of-#7991-upstream-release-3.4
Automated cherry pick of #7991: bugfix: collect esxi metric timout
2020-09-22 14:16:20 +08:00
yunion-ci-robot
6f324b0ea1 Merge pull request #7997 from tb365/automated-cherry-pick-of-#7994-upstream-release-3.4
Automated cherry pick of #7994: ctyun sync secgroup fix & cloudaccount delete fix
2020-09-22 14:08:19 +08:00
TangBin
0acbfc89f3 ctyun sync secgroup fix & cloudaccount delete fix 2020-09-22 13:58:22 +08:00
zhaoxiangchun
477d36f827 common alert bugfix/3.4 2020-09-22 11:37:14 +08:00
zhaoxiangchun
caa26b7567 bugfix: collect esxi metric timout
1.增加批量获取esxi中metric的接口
2020-09-22 11:13:25 +08:00
yunion-ci-robot
d0bb0afa2d Merge pull request #7933 from swordqiu/automated-cherry-pick-of-#7916-upstream-release-3.4
Automated cherry pick of #7916: fix: keystone initialize data skip nil extra fields
2020-09-21 19:54:14 +08:00
yunion-ci-robot
cb3884b1c5 Merge pull request #7919 from swordqiu/automated-cherry-pick-of-#7918-upstream-release-3.4
Automated cherry pick of #7918: fix: lock/unlock cleanup
2020-09-21 19:48:12 +08:00
yunion-ci-robot
10524ecc9a Merge pull request #7989 from wanyaoqi/automated-cherry-pick-of-#7988-upstream-release-3.4
Automated cherry pick of #7988: fix host deployer base image
2020-09-21 18:33:16 +08:00
wanyaoqi
33fb33a589 fix host deployer base image 2020-09-21 17:55:46 +08:00
yunion-ci-robot
a4b2af90c5 Merge pull request #7981 from yousong/automated-cherry-pick-of-#7980-upstream-release-3.4
Automated cherry pick of #7980: httputils: preserve format val types
2020-09-21 16:40:17 +08:00
Yousong Zhou
3f7155c39c logger: actionlog: add GetI18N 2020-09-21 15:22:06 +08:00
Yousong Zhou
b13d0f6035 logger: actionlog: remove redundant comments 2020-09-21 15:22:06 +08:00
Yousong Zhou
62c0c11c30 db: IModel: add GetI18N() method 2020-09-21 15:22:06 +08:00
Yousong Zhou
6bff7caf9b logclient: i18n: en for const 2020-09-21 15:22:06 +08:00
Yousong Zhou
27d0452faf logclient: i18n: cn for const 2020-09-21 15:22:06 +08:00
Yousong Zhou
b1a332fec1 logclient: convert const val to use latin chars 2020-09-21 15:22:06 +08:00
Yousong Zhou
bc066edc09 logclient: move ws list to separate file 2020-09-21 15:22:06 +08:00
Yousong Zhou
0b878134b6 logclient: separate lines 2020-09-21 15:22:06 +08:00
Yousong Zhou
986031fc97 opslog: move const to separate file 2020-09-21 15:22:06 +08:00
Yousong Zhou
8164854fd0 i18n: add ITable 2020-09-21 15:22:06 +08:00
Yousong Zhou
8dc1796768 i18n: move out from httperrors pkg 2020-09-21 15:22:06 +08:00
Yousong Zhou
a54d0e5920 locales: update translation 2020-09-21 15:22:06 +08:00
Yousong Zhou
822fae0095 treewide: avoid variable fmt str 2020-09-21 15:22:06 +08:00
Yousong Zhou
23b9991a7b treewide: fmt error 2020-09-21 15:22:06 +08:00
Yousong Zhou
4fb45676a4 httputils: preserve format val types 2020-09-21 15:22:06 +08:00
yunion-ci-robot
93e5f8ec97 Merge pull request #7977 from swordqiu/automated-cherry-pick-of-#7975-upstream-release-3.4
Automated cherry pick of #7975: fix: get jnlp xml from dell idrac6,7,9
2020-09-21 10:16:12 +08:00
yunion-ci-robot
29dde04145 Merge pull request #7979 from swordqiu/automated-cherry-pick-of-#7978-upstream-release-3.4
Automated cherry pick of #7978: fix: reset user password without check
2020-09-21 10:12:17 +08:00
yunion-ci-robot
b69d04ee20 Merge pull request #7985 from swordqiu/automated-cherry-pick-of-#7984-upstream-release-3.4
Automated cherry pick of #7984: fix: scheduler token not support policy
2020-09-21 10:09:12 +08:00
yunion-ci-robot
d0af7f9b23 Merge pull request #7983 from yousong/automated-cherry-pick-of-#7982-upstream-release-3.4
Automated cherry pick of #7982: locales: update translations
2020-09-20 00:22:14 +08:00
Qiu Jian
e444ab7a15 fix: scheduler token not support policy 2020-09-19 23:47:29 +08:00
Yousong Zhou
c4f4e7d30b locales: update translations 2020-09-19 23:45:19 +08:00
Qiu Jian
5f35bba0d0 fix: reset user password without check 2020-09-19 00:51:02 +08:00
Qiu Jian
760ac9900f fix: get jnlp xml from dell idrac6,7,9 2020-09-19 00:11:02 +08:00
Zexi Li
be00107c12 Merge pull request #7969 from tb365/automated-cherry-pick-of-#7966-upstream-release-3.4
Automated cherry pick of #7966: ctyun add region cn-bj1
2020-09-18 21:05:31 +08:00
yunion-ci-robot
17cd333b64 Merge pull request #7971 from swordqiu/automated-cherry-pick-of-#7970-upstream-release-3.4
Automated cherry pick of #7970: fix: add esxicli vmrc/webmks command
2020-09-18 21:04:11 +08:00
Zexi Li
346c8ec564 Merge pull request #7974 from rainzm/automated-cherry-pick-of-#7973-upstream-release-3.4
Automated cherry pick of #7973: fix(notify): allow normal user create their receiver
2020-09-18 21:04:08 +08:00
rainzm
aecf977801 fix(notify): allow normal user create their receiver 2020-09-18 17:17:38 +08:00
yunion-ci-robot
7a044d1ac1 Merge pull request #7947 from wanyaoqi/automated-cherry-pick-of-#7927-upstream-release-3.4
Automated cherry pick of #7927: host sync storage size
2020-09-18 16:53:48 +08:00
Qiu Jian
5f9088d240 fix: add esxicli vmrc/webmks command 2020-09-18 14:41:38 +08:00
TangBin
12bd187ec9 ctyun add region cn-bj1 2020-09-18 14:26:17 +08:00
Zexi Li
c1a0b8a8b5 Merge pull request #7962 from zexi/automated-cherry-pick-of-#7961-upstream-release-3.4
Automated cherry pick of #7961: region: fix network schedtag not cleanup when network deleted
2020-09-18 12:44:58 +08:00
Zexi Li
1d7ffc704e region: fix network schedtag not cleanup when network deleted 2020-09-18 10:38:33 +08:00
Zexi Li
ebdefa1f23 Merge pull request #7960 from zexi/automated-cherry-pick-of-#7959-upstream-release-3.4
Automated cherry pick of #7959: climc: add k8s federated resource cmd
2020-09-17 15:43:37 +08:00
Zexi Li
02dc68f20d climc: add k8s federated resource cmd 2020-09-17 15:29:55 +08:00
Zexi Li
9047c8de39 Merge pull request #7956 from zexi/automated-cherry-pick-of-#7954-upstream-release-3.4
Automated cherry pick of #7954: cloudcommon: get joint model should aware fieldname
2020-09-17 10:33:57 +08:00
yunion-ci-robot
ae3073da48 Merge pull request #7942 from zhaoxiangchun/automated-cherry-pick-of-#7941-upstream-release-3.4
Automated cherry pick of #7941: suggest rule modify:
2020-09-16 21:42:20 +08:00
Zexi Li
ab2567d17d Merge pull request #7955 from wanyaoqi/automated-cherry-pick-of-#7953-upstream-release-3.4
Automated cherry pick of #7953: fix set host image cache properties
2020-09-16 21:38:16 +08:00
Zexi Li
ba03954e50 Merge pull request #7949 from wanyaoqi/automated-cherry-pick-of-#7948-upstream-release-3.4
Automated cherry pick of #7948: fix update image status after save failed
2020-09-16 21:36:15 +08:00
Zexi Li
6c6b7bb6fa Merge pull request #7913 from ioito/automated-cherry-pick-of-#7912-upstream-release-3.4
Automated cherry pick of #7912: fix: 支持自动根据云上项目修改本地项目名称
2020-09-16 21:35:01 +08:00
yunion-ci-robot
b3f62ee186 Merge pull request #7944 from lvyangyang/automated-cherry-pick-of-#7943-upstream-release-3.4
Automated cherry pick of #7943: dup record process
2020-09-16 21:04:51 +08:00
yunion-ci-robot
bc66fd558a Merge pull request #7946 from wanyaoqi/automated-cherry-pick-of-#7945-upstream-release-3.4
Automated cherry pick of #7945: scheduler: fix fillter isolated device
2020-09-16 20:58:12 +08:00
Zexi Li
4164bf58c1 cloudcommon: get joint model should aware fieldname 2020-09-16 20:52:19 +08:00
wanyaoqi
5593b88e98 fix set host image cache properties 2020-09-16 20:51:52 +08:00
wanyaoqi
785da09d62 fix update image status after save failed 2020-09-16 19:14:07 +08:00
wanyaoqi
585ef58332 host sync storage size 2020-09-16 19:02:27 +08:00
wanyaoqi
8e0f47aa0c scheduler: fix fillter isolated device 2020-09-16 18:32:05 +08:00
lvyangyang
4487867f53 dup record process 2020-09-16 18:31:12 +08:00
zhaoxiangchun
9b12c675d2 suggest rule modify:
1.规则由后端初始化,默认禁用
2.规则period默认为12h,扫描范围timeFrom默认为14d
3.增加notify相关的模版文件
4.更改消息重复发送的问题
2020-09-16 12:56:58 +08:00
Zexi Li
a2d7bd16a2 Merge pull request #7940 from zhaoxiangchun/automated-cherry-pick-of-#7938-upstream-release-3.4
Automated cherry pick of #7938: bugfix vmware monitor
2020-09-16 11:35:06 +08:00
Zexi Li
10625a4b26 Merge pull request #7936 from swordqiu/automated-cherry-pick-of-#7935-upstream-release-3.4
Automated cherry pick of #7935: fix: disable qcloud verifyAppId temporarily
2020-09-16 11:33:53 +08:00
Zexi Li
e64ac81f87 Merge pull request #7911 from rainzm/automated-cherry-pick-of-#7910-upstream-release-3.4
Automated cherry pick of #7910: Feat & Fix of Notify
2020-09-16 11:32:46 +08:00
Zexi Li
e42afce6f3 Merge pull request #7926 from ioito/automated-cherry-pick-of-#7925-upstream-release-3.4
Automated cherry pick of #7925: fix: 避免名称重复
2020-09-16 11:31:52 +08:00
Zexi Li
ad0b9e3bd3 Merge pull request #7932 from swordqiu/automated-cherry-pick-of-#7931-upstream-release-3.4
Automated cherry pick of #7931: fix: omit empty fail reason
2020-09-16 11:31:20 +08:00
yunion-ci-robot
d4e2158caf Merge pull request #7930 from swordqiu/automated-cherry-pick-of-#7929-upstream-release-3.4
Automated cherry pick of #7929: fix: enable generate name caused compability issue
2020-09-16 11:30:09 +08:00
Zexi Li
a09932d8ac Merge pull request #7922 from ioito/automated-cherry-pick-of-#7921-upstream-release-3.4
Automated cherry pick of #7921: fix: bucket object cnt fix
2020-09-16 11:30:04 +08:00
zhaoxiangchun
2a680f99a7 bugfix vmware monitor 2020-09-16 10:28:59 +08:00
Qiu Jian
7601ca437a fix: disable qcloud verifyAppId temporarily 2020-09-16 02:21:22 +08:00
Qiu Jian
967d46bbf6 fix: keystone initialize data skip nil extra fields 2020-09-16 01:59:27 +08:00
Qiu Jian
a475a7b416 fix: omit empty fail reason 2020-09-16 01:56:02 +08:00
Qiu Jian
0d798412e1 fix: enable generate name caused compability issue 2020-09-16 01:36:33 +08:00
Qu Xuan
a1ba06a927 fix: 避免名称重复 2020-09-15 19:30:24 +08:00
Qu Xuan
cc5e0cd7ca fix: bucket object cnt fix 2020-09-15 19:13:38 +08:00
Qiu Jian
ada7352469 fix: lock/unlock cleanup 2020-09-15 12:26:47 +08:00
yunion-ci-robot
ef9dac1a86 Merge pull request #7917 from zexi/automated-cherry-pick-of-#7915-upstream-release-3.4
Automated cherry pick of #7915: cloudcommon: joint model list should add field_name into query
2020-09-15 10:27:12 +08:00
yunion-ci-robot
f71d26d2b2 Merge pull request #7906 from wanyaoqi/automated-cherry-pick-of-#7905-upstream-release-3.4
Automated cherry pick of #7905: webconsole: fix defer order to release zombie process
2020-09-15 10:26:10 +08:00
Zexi Li
82e38b8f51 cloudcommon: joint model list should add field_name into query 2020-09-14 23:38:11 +08:00
Qu Xuan
5c71349fe2 fix: 支持自动根据云上项目修改本地项目名称 2020-09-14 21:13:27 +08:00
rainzm
f24950da96 feat(notify): sort the returned contact type array 2020-09-14 20:35:12 +08:00
rainzm
0308ce2882 feat: notify user when failing to change config 2020-09-14 20:35:12 +08:00
rainzm
cee07e7861 feat: add NotifyError in notifyclient
NotifyError send error message to user from userCred.
2020-09-14 20:35:12 +08:00
rainzm
8eba2c369f feat: add WithCtx version to notifyclient function 2020-09-14 20:35:12 +08:00
rainzm
5a10f9dd9c feat(region): divide notify templates into Chinese and English versions
Chinese version: content@cn, title@cn
English version: content@en, title@en
2020-09-14 20:35:12 +08:00
rainzm
c542249c7c feat(region): replace 虚拟机 with 主机 or 云主机 2020-09-14 20:35:12 +08:00
wanyaoqi
fa2d8723a6 webconsole: fix defer order to release zombie process 2020-09-14 18:20:47 +08:00
Zexi Li
523b0d132f Merge pull request #7903 from rainzm/automated-cherry-pick-of-#7902-upstream-release-3.4
Automated cherry pick of #7902: fix(esxi): return when host.Vm is empty
2020-09-14 16:28:08 +08:00
rainzm
6bfca36cb7 fix(esxi): return when host.Vm is empty 2020-09-14 16:26:34 +08:00
yunion-ci-robot
e41c29e6d0 Merge pull request #7900 from ioito/automated-cherry-pick-of-#7899-upstream-release-3.4
Automated cherry pick of #7899: fix: cos use proxy
2020-09-14 14:03:14 +08:00
Zexi Li
6010b253f2 Merge pull request #7896 from wanyaoqi/automated-cherry-pick-of-#7895-upstream-release-3.4
Automated cherry pick of #7895: disk: check disk is need renew on guest set renew
2020-09-14 13:02:07 +08:00
Qu Xuan
0a5ee4ca67 fix: cos use proxy 2020-09-14 13:01:07 +08:00
wanyaoqi
77f479ce60 disk: check disk is need renew on guest set renew 2020-09-14 12:07:48 +08:00
yunion-ci-robot
f8b7d96c62 Merge pull request #7894 from swordqiu/automated-cherry-pick-of-#7893-upstream-release-3.4
Automated cherry pick of #7893: fix: check host sharing status when considering whether a host is assignable
2020-09-12 23:58:08 +08:00
yunion-ci-robot
fda5c3aaa5 Merge pull request #7891 from swordqiu/automated-cherry-pick-of-#7890-upstream-release-3.4
Automated cherry pick of #7890: fix: disable webkms for esxi older than 6.5
2020-09-12 23:55:21 +08:00
yunion-ci-robot
0e88ac81c3 Merge pull request #7888 from yousong/automated-cherry-pick-of-#7887-upstream-release-3.4
Automated cherry pick of #7887: elasticips: filter by owner when doing auto allocation
2020-09-12 23:54:09 +08:00
Qiu Jian
6b5339900b fix: check host sharing status when considering whether a host is assignable 2020-09-12 20:52:09 +08:00
yunion-ci-robot
60b1eddfd8 Merge pull request #7886 from zexi/automated-cherry-pick-of-#7885-upstream-release-3.4
Automated cherry pick of #7885: scheduler: ignore network type when specified
2020-09-12 17:34:08 +08:00
Qiu Jian
7cf5ad9133 fix: disable webkms for esxi older than 6.5 2020-09-12 17:29:50 +08:00
Yousong Zhou
8a0f940b38 elasticips: filter by owner when doing auto allocation 2020-09-12 17:14:41 +08:00
Zexi Li
a1c7a291d5 scheduler: ignore network type when specified 2020-09-12 15:59:17 +08:00
Zexi Li
891b7223f1 Merge pull request #7884 from rainzm/automated-cherry-pick-of-#7883-upstream-release-3.4
Automated cherry pick of #7883: feat(region): change fomat 'id' to 'name(id)' in scheduledtasks' log
2020-09-11 21:06:38 +08:00
yunion-ci-robot
9ef5a43513 Merge pull request #7877 from ioito/automated-cherry-pick-of-#7876-upstream-release-3.4
Automated cherry pick of #7876: fix: 默认不自动合并安全组
2020-09-11 21:05:58 +08:00
Zexi Li
490a0a7fe5 Merge pull request #7880 from ioito/automated-cherry-pick-of-#7879-upstream-release-3.4
Automated cherry pick of #7879: fix: avoid sync natgateway eip panic
2020-09-11 21:03:40 +08:00
Zexi Li
06c27791bb Merge pull request #7871 from rainzm/automated-cherry-pick-of-#7870-upstream-release-3.4
Automated cherry pick of #7870: fix(esxiagent): add HostDelayTaskWorkerCount
2020-09-11 20:55:33 +08:00
Zexi Li
690c3b23a4 Merge pull request #7863 from wanyaoqi/automated-cherry-pick-of-#7836-upstream-release-3.4
Automated cherry pick of #7836: host: fix rbd storage cache iso image
2020-09-11 20:54:17 +08:00
Zexi Li
6bc6309253 Merge pull request #7868 from ioito/automated-cherry-pick-of-#7862-upstream-release-3.4
Automated cherry pick of #7862: fix: add dns recordset dns value check
2020-09-11 20:53:28 +08:00
rainzm
7b67554dcc feat(region): change fomat 'id' to 'name(id)' in scheduledtasks' log 2020-09-11 20:37:54 +08:00
Qu Xuan
ce777855a2 fix: 默认不自动合并安全组 2020-09-11 19:23:15 +08:00
Qu Xuan
9607420298 fix: avoid sync natgateway eip panic 2020-09-11 19:17:25 +08:00
rainzm
4e7e8a59dc fix(esxiagent): add HostDelayTaskWorkerCount
之前,HostDelayWorker 是通过 hostutils.InitWorkerManager 来初始化,
worker的数量依赖于options.HostOptions.DefaultRequestWorkerCount, 因为
这个options没有经过初始化,所以就是0,导致worker count的数量变为1。

现在增加了 HostDelayTaskWorkerCount 来管理这个count,默认值为8。
2020-09-11 17:19:46 +08:00
Qu Xuan
2e93ee3d6d fix: add dns recordset dns value check 2020-09-11 14:26:01 +08:00
wanyaoqi
6a7cf0608d host: fix rbd storage cache iso image 2020-09-10 23:13:58 +08:00
yunion-ci-robot
5f7734b0c3 Merge pull request #7860 from ioito/automated-cherry-pick-of-#7859-upstream-release-3.4
Automated cherry pick of #7859: fix: 平滑迁移数据
2020-09-10 21:42:53 +08:00
yunion-ci-robot
413ba9ddd4 Merge pull request #7858 from lvyangyang/automated-cherry-pick-of-#7762-upstream-release-3.4
Automated cherry pick of #7762: dns access
2020-09-10 21:37:56 +08:00
yunion-ci-robot
0048507211 Merge pull request #7856 from ioito/automated-cherry-pick-of-#7855-upstream-release-3.4
Automated cherry pick of #7855: fix: optimized qcloud keypair
2020-09-10 21:34:33 +08:00
Qu Xuan
d6d490af6c fix: 平滑迁移数据 2020-09-10 17:39:40 +08:00
lvyangyang
70297e3130 dns access 2020-09-10 17:33:17 +08:00
Qu Xuan
5576819f01 fix: 腾讯云不支持同时设置秘钥和密码,若设置秘钥,则将密码置空 2020-09-10 17:25:32 +08:00
Qu Xuan
dc20313ef5 fix: optimized qcloud keypair 2020-09-10 17:25:32 +08:00
yunion-ci-robot
fb7b5d5a95 Merge pull request #7854 from rainzm/automated-cherry-pick-of-#7832-upstream-release-3.4
Automated cherry pick of #7832: refactor(region): optimize preparenet of cloudaccount
2020-09-10 16:04:55 +08:00
rainzm
3f77c01e6b refactor(region): optimize preparenet of cloudaccount
1. 从vcenter中获取host和vm的信息时,只需要获取网络相关的字段就可以了。
2. 每个host的vms,单独启用一个goroutine。
3. 优化了处理vms ip的逻辑,现在的时间复杂度是O(n)。
2020-09-10 15:41:13 +08:00
yunion-ci-robot
5ec2490be5 Merge pull request #7853 from rainzm/automated-cherry-pick-of-#7852-upstream-release-3.4
Automated cherry pick of #7852: fix(notify): pull contact for workwx, dingtalk and feishu
2020-09-10 15:18:01 +08:00
rainzm
dba92d4b0b fix(notify): pull contact for workwx, dingtalk and feishu 2020-09-10 14:41:27 +08:00
yunion-ci-robot
6f77c22573 Merge pull request #7835 from ioito/automated-cherry-pick-of-#7834-upstream-release-3.4
Automated cherry pick of #7834: fix: uniform cachedimage active status
2020-09-10 14:36:02 +08:00
yunion-ci-robot
f653b36733 Merge pull request #7851 from ioito/automated-cherry-pick-of-#7837-upstream-release-3.4
Automated cherry pick of #7837: fix: optimzed clouduser password
2020-09-10 14:33:55 +08:00
Qu Xuan
aa26c6ec99 fix: optimzed clouduser password 2020-09-10 10:24:21 +08:00
yunion-ci-robot
0e0df0999b Merge pull request #7844 from ioito/automated-cherry-pick-of-#7843-upstream-release-3.4
Automated cherry pick of #7843: fix: optimzed clouduser
2020-09-10 09:49:23 +08:00
yunion-ci-robot
5f0b86950b Merge pull request #7842 from ioito/automated-cherry-pick-of-#7841-upstream-release-3.4
Automated cherry pick of #7841: fix: avoid create public zone failed
2020-09-10 09:47:56 +08:00
yunion-ci-robot
d1660c83a9 Merge pull request #7839 from swordqiu/automated-cherry-pick-of-#7831-upstream-release-3.4
Automated cherry pick of #7831: fix: recode project-role rpc handle to support group role assignment results by user or project
2020-09-10 09:46:54 +08:00
yunion-ci-robot
f302756eda Merge pull request #7840 from zhaoxiangchun/automated-cherry-pick-of-#7838-upstream-release-3.4
Automated cherry pick of #7838: commonalert bugfix:
2020-09-10 09:44:53 +08:00
yunion-ci-robot
90185c0074 Merge pull request #7846 from rainzm/automated-cherry-pick-of-#7845-upstream-release-3.4
Automated cherry pick of #7845: Feat & Fix & Refactor for ESXi
2020-09-10 09:41:58 +08:00
rainzm
55b2b29001 fix(region): add RequestSyncstatusOnHost for SESXiGuestDriver
esxi 平台 Guest 进行 syncstatus 和其他平台有所区别,Vcenter 可能会更改
 VM 所在的 Host,所以在 Host 上寻找 VM 可能会出现 ErrNotFound。此时,应该
主动去整个 datacenter 中寻找 VM,然后更改 Host,进行同步。
2020-09-09 21:53:51 +08:00
rainzm
ac69f8a590 fix(esxi): fetch templatevm from datacenter before clone vm
这里应该和image_cache那里保持一直,对template的获取应该从datacenter
中获取,而不是host。
2020-09-09 21:53:51 +08:00
rainzm
42faf34f15 refactor(esxi): replace GetTemplateVMById with FetchTemplateVMById
FetchTemplateVMById 更好,因为它更轻量,更快。
2020-09-09 21:53:51 +08:00
rainzm
3f8f9e6c56 feat(esxicli): better vm operator
现在,可以通过Datacenter来获取vm,不一定要指定HostIp,
Datacenter和HostIp必须指定一个。
2020-09-09 21:53:51 +08:00
rainzm
6b340264e4 feat(esxi): support fetchVM form datacenter 2020-09-09 21:53:51 +08:00
rainzm
ef8768fcef refactor(esxi): fetchVms and fetchHardwareInfo
1. fetchHardwareInfo 只有一种error,原因是moVM的某些字段为nil,这种情况下,完全可以打印日志直接返回。
2. fetchVms 现在只返回[]*SVirtualMachine, 进一步的过滤(是不是template)交给调用者。
2020-09-09 21:53:51 +08:00
Qu Xuan
9281c54294 fix: optimzed clouduser 2020-09-09 20:12:40 +08:00
Qu Xuan
2ad1a4afe5 fix: avoid create public zone failed 2020-09-09 19:54:45 +08:00
zhaoxiangchun
1a323667ad commonalet bugfix:
1.报警接受人通知渠道调整:由notify中解释发送到对应的channel
2.报警恢复增加对应的evalmatch,保存对应的metricvalue
3.报警记录中增加description相关信息
4.其他代码调整
2020-09-09 18:32:56 +08:00
Qiu Jian
0268d95853 fix: recode project-role rpc handle to support group role assignment results by user or project 2020-09-09 18:19:36 +08:00
Qu Xuan
025eca548f fix: uniform cachedimage active status 2020-09-09 15:21:43 +08:00
yunion-ci-robot
4cea5a1c9f Merge pull request #7829 from swordqiu/automated-cherry-pick-of-#7828-upstream-release-3.4
Automated cherry pick of #7828: fix: wire usage stats incorrect
2020-09-08 20:28:56 +08:00
yunion-ci-robot
cb1c8d7961 Merge pull request #7827 from swordqiu/automated-cherry-pick-of-#7820-upstream-release-3.4
Automated cherry pick of #7820: fix: ignore 409 error when doing redfish power on
2020-09-08 20:26:52 +08:00
yunion-ci-robot
408f975f40 Merge pull request #7822 from rainzm/automated-cherry-pick-of-#7821-upstream-release-3.4
Automated cherry pick of #7821: fix(esxiagent): return image extid not id
2020-09-08 20:23:55 +08:00
Qiu Jian
621c2796d6 fix: wire usage stats incorrect 2020-09-08 16:41:48 +08:00
Qiu Jian
d10adf22d7 fix: ignore 409 error when doing redfish power on 2020-09-08 15:34:59 +08:00
rainzm
3ef91f92e5 fix(esxiagent): return image extid not id
调用 disk/image_cache 接口的Task StorageCacheImageTask 会根据回调
回来数据中的 image_id,来设置 storagecachedimage 中的 externalid,
所以这里的 image_id 应该是 externalid。
2020-09-08 15:33:18 +08:00
yunion-ci-robot
e75e5a9b95 Merge pull request #7803 from rainzm/automated-cherry-pick-of-#7802-upstream-release-3.4
Automated cherry pick of #7802: Optimization of the scheduler
2020-09-08 14:59:53 +08:00
rainzm
348ca46a08 fix(scheduler): more standardized testing 2020-09-08 14:28:09 +08:00
rainzm
6000874b3c refactor(scheduler): make forcast result clearer
forcast 的返回值包括:
1. CanCreate: 是否可以创建
2. FilteredCandidate: 被过滤掉的candidate(宿主机),并记录了
   过滤其的 filter 的名字以及给出的原因。
3. ReqCount: 请求的机器数量
4. AllowCount: 允许的机器数量
5. NotAllowReasons: 不允许的原因,每一个不被允许的都会被列出原因。
2020-09-08 14:28:09 +08:00
rainzm
89980b6267 Add mock test for genericScheudler.Schedule 2020-09-08 14:28:09 +08:00
rainzm
d086161a68 feat: Add method 'Sku' to CandidatePropertyGetter 2020-09-08 14:28:09 +08:00
rainzm
39fed764fe feat: Add IResultHelper
1. Adjust the package structure about pkg/scheduler/core and
pkg/scheduler/manager

2. Add IResultHelper

3. Change the signature of genericScheduler.Schedule
func (*Unit, []Candidater) (*SchedResultItemList, error) ==>
func (*Unit, []Candidater, IResultHelper) (*ScheduleResult, error)
2020-09-08 14:28:09 +08:00
yunion-ci-robot
426699ada9 Merge pull request #7819 from wanyaoqi/automated-cherry-pick-of-#7810-upstream-release-3.4
Automated cherry pick of #7810: fix host error output
2020-09-08 10:03:18 +08:00
yunion-ci-robot
82d297eb77 Merge pull request #7809 from swordqiu/automated-cherry-pick-of-#7808-upstream-release-3.4
Automated cherry pick of #7808: fix: check assign-host previliges
2020-09-08 10:01:56 +08:00
yunion-ci-robot
92ecdb5f8d Merge pull request #7818 from wanyaoqi/automated-cherry-pick-of-#7817-upstream-release-3.4
Automated cherry pick of #7817: isolated devices info reenterable
2020-09-08 09:59:54 +08:00
wanyaoqi
ada6c870d8 fix host error output 2020-09-07 21:08:13 +08:00
yunion-ci-robot
86dd4804a3 Merge pull request #7816 from rainzm/automated-cherry-pick-of-#7807-upstream-release-3.4
Automated cherry pick of #7807: fix(notify): break down permissions of notifyconfigs
2020-09-07 21:06:03 +08:00
yunion-ci-robot
cecaa127ea Merge pull request #7805 from yousong/automated-cherry-pick-of-#7804-upstream-release-3.4
Automated cherry pick of #7804: vpcagent: guard against foul eip records
2020-09-07 21:05:46 +08:00
yunion-ci-robot
4d68b5fb61 Merge pull request #7797 from ioito/automated-cherry-pick-of-#7796-upstream-release-3.4
Automated cherry pick of #7796: fix: sync groups for user
2020-09-07 21:03:50 +08:00
yunion-ci-robot
8a329b2b29 Merge pull request #7790 from wanyaoqi/automated-cherry-pick-of-#7789-upstream-release-3.4
Automated cherry pick of #7789: fix get ubuntu version
2020-09-07 21:01:53 +08:00
yunion-ci-robot
c50659a1e4 Merge pull request #7815 from yousong/automated-cherry-pick-of-#7814-upstream-release-3.4
Automated cherry pick of #7814: httperrors: add Error type
2020-09-07 20:59:46 +08:00
yunion-ci-robot
a30df54cb9 Merge pull request #7799 from wanyaoqi/automated-cherry-pick-of-#7798-upstream-release-3.4
Automated cherry pick of #7798: guest short desc add backup host id
2020-09-07 20:57:45 +08:00
yunion-ci-robot
b192e949de Merge pull request #7813 from swordqiu/automated-cherry-pick-of-#7811-upstream-release-3.4
Automated cherry pick of #7811: fix: prevent users in disabled idp from login
2020-09-07 20:55:43 +08:00
yunion-ci-robot
a33a21f712 Merge pull request #7794 from ioito/automated-cherry-pick-of-#7793-upstream-release-3.4
Automated cherry pick of #7793: fix: aliyun wulanchabu region
2020-09-07 20:55:14 +08:00
wanyaoqi
78f9db1ba0 isolated devices info reenterable 2020-09-07 20:46:26 +08:00
rainzm
72276d038d fix(notify): break down permissions of notifyconfigs
1. Only allow admin to create, list, update or delete.
2. Allow user to get types.
2020-09-07 18:56:59 +08:00
Yousong Zhou
f1995a46d8 treewide: DeleteFailReason as an object with translated details 2020-09-07 18:53:07 +08:00
Yousong Zhou
918dce80e8 httperrors: HTTPError: use Error type 2020-09-07 18:53:07 +08:00
Yousong Zhou
12899ab007 httperrors: add Error type 2020-09-07 18:53:07 +08:00
Qiu Jian
e758c4aa97 fix: prevent users in disabled idp from login 2020-09-07 18:25:39 +08:00
Qiu Jian
623c71b143 fix: check assign-host previliges 2020-09-07 18:15:03 +08:00
Yousong Zhou
f0faf07b61 vpcagent: guard against foul eip records 2020-09-07 17:27:12 +08:00
wanyaoqi
8c4941ea70 guest short desc add backup host id 2020-09-07 17:05:34 +08:00
Qu Xuan
4cd73c16ca fix: sync groups for user 2020-09-07 16:35:47 +08:00
Qu Xuan
0a79d1d23e fix: aliyun wulanchabu region 2020-09-07 16:10:37 +08:00
wanyaoqi
d22676906c fix get ubuntu version 2020-09-07 15:40:33 +08:00
yunion-ci-robot
74b3bf2c6a Merge pull request #7787 from rainzm/automated-cherry-pick-of-#7786-upstream-release-3.4
Automated cherry pick of #7786: fix(scheduler): fix array out of bounds when sorting hosts
2020-09-07 15:31:43 +08:00
yunion-ci-robot
c94a90398e Merge pull request #7783 from rainzm/automated-cherry-pick-of-#7782-upstream-release-3.4
Automated cherry pick of #7782: fix(notify): Replace String() with GetString()
2020-09-07 15:28:41 +08:00
yunion-ci-robot
b57bbc66c7 Merge pull request #7781 from swordqiu/automated-cherry-pick-of-#7780-upstream-release-3.4
Automated cherry pick of #7780: fix: user idps attributes includes template name
2020-09-07 15:24:41 +08:00
rainzm
4f9c37239e fix(scheduler): fix array out of bounds when sorting hosts 2020-09-07 15:18:51 +08:00
rainzm
8524fda7f8 fix(notify): Replace String() with GetString()
The String() of jsonutils.JSONObject will add a pair of
double quotes around the content. The GetString() will
get a clean content.
2020-09-07 15:10:54 +08:00
Qiu Jian
bfa4ce38e0 fix: user idps attributes includes template name 2020-09-07 13:01:23 +08:00
yunion-ci-robot
70d790187e Merge pull request #7778 from ioito/automated-cherry-pick-of-#7729-upstream-release-3.4
Automated cherry pick of #7729: optimized cachedimages sync
2020-09-07 11:08:42 +08:00
Qu Xuan
7095ea8f8b optimized cachedimages sync 2020-09-07 10:16:33 +08:00
yunion-ci-robot
4edff8ae34 Merge pull request #7770 from swordqiu/automated-cherry-pick-of-#7769-upstream-release-3.4
Automated cherry pick of #7769: fix: network address list respect privilige of user
2020-09-05 15:50:42 +08:00
yunion-ci-robot
fd750e0a9c Merge pull request #7773 from swordqiu/automated-cherry-pick-of-#7772-upstream-release-3.4
Automated cherry pick of #7772: fix: skup syncing lb, rds, redis instances in tasks
2020-09-05 15:48:43 +08:00
Zexi Li
f0ae739747 Merge pull request #7777 from zexi/automated-cherry-pick-of-#7776-upstream-release-3.4
Automated cherry pick of #7776: climc: k8s cluster grafana componet support subpath
2020-09-05 15:37:48 +08:00
Zexi Li
7f5124bdf2 climc: k8s cluster grafana componet support subpath 2020-09-05 14:47:04 +08:00
Qiu Jian
c5c2b4b699 fix: skup syncing lb, rds, redis instances in tasks 2020-09-05 14:30:07 +08:00
Qiu Jian
29edf83293 fix: network address list respect privilige of user 2020-09-05 12:01:01 +08:00
yunion-ci-robot
1c3bbb70a3 Merge pull request #7768 from ioito/automated-cherry-pick-of-#7767-upstream-release-3.4
Automated cherry pick of #7767: fix: cloudid optimized
2020-09-05 10:32:46 +08:00
Qu Xuan
390d6f07e1 fix: cloudid optimized 2020-09-04 20:23:18 +08:00
yunion-ci-robot
41e2757973 Merge pull request #7766 from tb365/automated-cherry-pick-of-#7764-upstream-release-3.4
Automated cherry pick of #7764: pex register add optional column mac_access
2020-09-04 20:15:41 +08:00
yunion-ci-robot
a7160e7518 Merge pull request #7763 from ioito/automated-cherry-pick-of-#7739-upstream-release-3.4
Automated cherry pick of #7739: fix: valid update name and update dns recordset
2020-09-04 20:14:14 +08:00
yunion-ci-robot
01f07c6044 Merge pull request #7761 from swordqiu/automated-cherry-pick-of-#7760-upstream-release-3.4
Automated cherry pick of #7760: fix: scheduler aware policy
2020-09-04 16:20:40 +08:00
TangBin
24af17757d pex register add optional column mac_access 2020-09-04 15:57:38 +08:00
Qu Xuan
b4252c7c25 fix: valid update name and update dns recordset 2020-09-04 14:10:14 +08:00
Qiu Jian
4853883947 fix: scheduler aware policy 2020-09-04 11:10:36 +08:00
Zexi Li
82795f2daf Merge pull request #7752 from ioito/automated-cherry-pick-of-#7751-upstream-release-3.4
Automated cherry pick of #7751: fix: optimized cloudid
2020-09-04 10:33:20 +08:00
Zexi Li
cf056fe42a Merge pull request #7750 from rainzm/automated-cherry-pick-of-#7748-upstream-release-3.4
Automated cherry pick of #7748: feat(esxi): correctly judge whether inet is nil
2020-09-04 10:32:32 +08:00
Zexi Li
1aa16871eb Merge pull request #7755 from swordqiu/automated-cherry-pick-of-#7740-upstream-release-3.4
Automated cherry pick of #7740: fix: find correct esxi host access ip
2020-09-04 10:31:54 +08:00
Zexi Li
4dfd459b14 Merge pull request #7758 from swordqiu/automated-cherry-pick-of-#7757-upstream-release-3.4
Automated cherry pick of #7757: fix: support VirtualDiskRawDiskMappingVer1BackingInfo
2020-09-04 10:31:17 +08:00
Zexi Li
3d1bce5f51 Merge pull request #7754 from swordqiu/automated-cherry-pick-of-#7753-upstream-release-3.4
Automated cherry pick of #7753: fix: remove redundant auth cookie in sso login
2020-09-04 10:30:47 +08:00
Zexi Li
5ff14eb618 Merge pull request #7745 from wanyaoqi/automated-cherry-pick-of-#7744-upstream-release-3.4
Automated cherry pick of #7744: glance: check min disk size on update
2020-09-04 10:29:49 +08:00
Zexi Li
57c0706d9e Merge pull request #7742 from swordqiu/automated-cherry-pick-of-#7741-upstream-release-3.4
Automated cherry pick of #7741: fix: search by chs projectname or domainname
2020-09-04 10:29:00 +08:00
Zexi Li
4dfa6f8b19 Merge pull request #7736 from rainzm/automated-cherry-pick-of-#7735-upstream-release-3.4
Automated cherry pick of #7735: fix(compute): return InputParameterError while ValidateCreateData
2020-09-04 10:27:46 +08:00
Qiu Jian
0619da6f14 fix: support VirtualDiskRawDiskMappingVer1BackingInfo 2020-09-04 00:15:14 +08:00
yunion-ci-robot
f62912dd5b Merge pull request #7734 from rainzm/automated-cherry-pick-of-#7733-upstream-release-3.4
Automated cherry pick of #7733: Feature & Fix for Notify
2020-09-04 00:03:42 +08:00
Qiu Jian
29a3db9ff6 fix: find correct esxi host access ip 2020-09-03 23:56:30 +08:00
Qiu Jian
c50497090e fix: remove redundant auth cookie in sso login 2020-09-03 23:54:15 +08:00
yunion-ci-robot
47f5f9edc1 Merge pull request #7731 from swordqiu/automated-cherry-pick-of-#7730-upstream-release-3.4
Automated cherry pick of #7730: fix: compatiblity fixes with lenovo RD620 and huawei 2288 fix: compatiblity fixes with lenovo RD620 and huawei 2288
2020-09-03 21:54:51 +08:00
rainzm
ff52e00448 feat(notify): Allow use topic to filter notification 2020-09-03 21:25:05 +08:00
rainzm
7c6e053a08 feat(notify): Add TNotifyChannel const of robot 2020-09-03 21:25:05 +08:00
rainzm
8c6fdd1106 feat(notify): replace VerifiedContactTypes with VerifiedInfos in ReceiverDetails
VerifiedInfos will provide Note to display.
2020-09-03 21:25:05 +08:00
rainzm
beee6e2c9f feat(notify): Support trigger-verify for feishu, dingtalk and workwx 2020-09-03 21:25:04 +08:00
rainzm
60412cf7e8 feat(notify): Add VerifiedNote for SSubContact
VerifiedNote will be 'ok' if SSubContact verified successfully.
Otherwise, there will be there value for VerifiedNote:
1. no such mobile: mobile is not exist, change and try again.
2. incomplete config: tell admin to improve the configuration.
3. service exceptions: try again or connect to admin.
2020-09-03 21:25:04 +08:00
rainzm
90b84e995b feat(notify): break down error from UseridByMobile 2020-09-03 21:25:04 +08:00
rainzm
851b2d4bb7 fix(notify): Set default priority 'normal' when creating notification 2020-09-03 21:25:04 +08:00
rainzm
ab02e166e9 fix(notify): Mark verified not enabled in MarkContactTypeVerified 2020-09-03 21:25:04 +08:00
rainzm
10caff1d9c refactor(notify): hide SSunContact webconsole
Every receiver has webconsole type contact that is equal with
receiverid.
Now, make webconsole invisible, and it does exist.
2020-09-03 21:25:04 +08:00
rainzm
82b7e659ad fix(notify): Allow user list receivers 2020-09-03 21:25:04 +08:00
rainzm
9e1a7c5e12 fix(notify): use AfterSend for contact with succuessful sending 2020-09-03 21:25:04 +08:00
Qu Xuan
5cc25ae10a fix: optimzed sync 2020-09-03 21:18:30 +08:00
Qu Xuan
cfd76b23a3 fix: optimized cloudid 2020-09-03 21:18:30 +08:00
rainzm
65ca3ace74 feat(esxi): correctly judge whether inet is nil 2020-09-03 20:35:32 +08:00
wanyaoqi
00265fedda glance: check min disk size on update 2020-09-03 20:00:45 +08:00
Qiu Jian
976dbd7796 fix: search by chs projectname or domainname 2020-09-03 18:38:48 +08:00
rainzm
c050629ba2 fix(compute): return InputParameterError while ValidateCreateData 2020-09-03 15:24:03 +08:00
Qiu Jian
949e2ebed9 fix: compatiblity fixes with lenovo RD620 and huawei 2288 2020-09-03 11:50:00 +08:00
yunion-ci-robot
dc19a10323 Merge pull request #7728 from tb365/automated-cherry-pick-of-#7725-upstream-release-3.4
Automated cherry pick of #7725: create classic vpc fix
2020-09-03 10:32:41 +08:00
TangBin
612ad9286b create classic vpc fix 2020-09-02 18:26:16 +08:00
yunion-ci-robot
32bc9b45a1 Merge pull request #7721 from ioito/automated-cherry-pick-of-#7587-upstream-release-3.4
Automated cherry pick of #7587: feature: add dns interface
2020-09-02 18:00:06 +08:00
Qu Xuan
03456eaaa9 fix: avoid nil panic 2020-09-02 17:27:24 +08:00
Qu Xuan
d03fddcd7d fix: avoid policy value not save 2020-09-02 17:27:24 +08:00
Qu Xuan
893085a2c6 fix: climc params 2020-09-02 17:27:24 +08:00
Qu Xuan
a85a1aecd4 feature: add dns interface 2020-09-02 17:27:24 +08:00
yunion-ci-robot
c3d7168622 Merge pull request #7717 from zhaoxiangchun/automated-cherry-pick-of-#7716-upstream-release-3.4
Automated cherry pick of #7716: alert record bugfix
2020-09-02 16:33:42 +08:00
yunion-ci-robot
06c0ada74c Merge pull request #7719 from wanyaoqi/automated-cherry-pick-of-#7718-upstream-release-3.4
Automated cherry pick of #7718: vmware disk support deploy lvm partition
2020-09-02 16:31:45 +08:00
yunion-ci-robot
6e5f5b2ea3 Merge pull request #7723 from wanyaoqi/automated-cherry-pick-of-#7722-upstream-release-3.4
Automated cherry pick of #7722: update host status to unknown on host offline
2020-09-02 16:28:40 +08:00
Rain Zheng
eb9d794fab Automated cherry pick of #7714: Feature & Fix for Notify (#7715)
* feat(notify): Add 'get-types' action for ConfigManager

The List interface is only open to administrators,
because we don't want anyone other than administrators
to see the details of the notify configuration.
To let general user to kown available notification channels,
add 'get-types' actions of ConfigManager.

* feat(notify): Check the availability of contact type before creating notification

Creating notification with unconfigured contact type will fail at
sending message. Now, prevent creation in advance.

* feat(notify): Add workwx for NotifyNormal/Important/Critical

* feat(notify): Add Notify about robot in notifyclient

* fix(notify): Init ParentContactType for SSubContact

1. ParentContactType of SSubContact with webconsole type is empty.
2. ParentContactType of others SSubContact is mobile.

* fix(notify): Unverify SSubContact when ParentContactType match

* fix(notify): When no data is initialized, exit directly
2020-09-02 16:10:38 +08:00
wanyaoqi
20b949091e update host status to unknown on host offline 2020-09-02 13:09:24 +08:00
wanyaoqi
43ce3b5455 vmware disk support deploy lvm partition 2020-09-01 21:15:22 +08:00
zhaoxiangchun
d95e64e593 listfilter by alert_id 2020-09-01 20:47:18 +08:00
zhaoxiangchun
06bd735f0b alert record bugfix
1.return details fix
2020-09-01 20:47:18 +08:00
wanyaoqi
607e3d8fdc hostinfo: try create network add is_on_premise (#7707) 2020-09-01 20:10:37 +08:00
屈轩
800dd26c60 fix: add details for account delete (#7703)
Co-authored-by: Qu Xuan <quxuan@yunionyun.com>
2020-09-01 20:09:47 +08:00
Yousong Zhou
77a5c1ff85 Automated cherry pick of #7712: httperrors: support setting lang with X-Yunion-Lang (#7713)
* httperrors: support setting lang with X-Yunion-Lang

* mcclient: session: set lang
2020-09-01 19:52:38 +08:00
Yousong Zhou
bde5e1b96a httperrors: use existing details if id is not present (#7711) 2020-09-01 18:32:37 +08:00
Zexi Li
82942006b6 Merge pull request #7665 from ioito/automated-cherry-pick-of-#7664-upstream-release-3.4
Automated cherry pick of #7664: fix: avoid delete aws iam user failed
2020-09-01 12:19:25 +08:00
Jian Qiu
836151eee3 fix: vmware esxi host detects vnic portgroup info (#7660)
Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
2020-09-01 10:51:41 +08:00
Jian Qiu
0566e1dec7 fix: apigateway user info add is_local attribtue (#7695)
Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
2020-09-01 10:49:36 +08:00
Rain Zheng
b03c8ce506 Automated cherry pick of #7692: feat(notify): Support update for notify config (#7693)
* feat(notify): Support update for notify config

* fix(notify): Be compatible with the email configuration

Email config key text changed:
mail.username => username
mail.password => password
mail.smtp.hostname => hostname
mail.smtp.hostport => hostport

* fix(notify): Give users permission to operate receiver

* fix(notify): Allow negative update for receiver

Now, input.Email and input.Mobile can be empty which means
that do not update the corresponding field.

* feat(notify): Support for triggering validation on feishu, dingtalk and worwx

Triggering validation on these contact types means repulling a Contact about them.

* feat(notify): Adds validity period for verify

Verification beyond the expiration date will fail.

* fix(notify): SQuery of scopedomain in FilterByOwner
2020-09-01 10:48:37 +08:00
Rain Zheng
c914dafa75 Automated cherry pick of #7661: fix(host-deployer): Exit correctly after mounting (#7672)
* fix(esxi): Fetch full templates of datastoreImageCache

Datastore 和 DatastoreImageCache 是一对一的关系。
每一个 Datastore 可能有多个对应的 Host,所以 GetIIMages 里面获取
Templates 的逻辑应该尝试去获取所有 Host 的 Templates。

* fix(host-deployer): Exit correctly after mounting

MountRootfs的返回值为nil时,还是需要Umount的操作来正确退出(比如VDDK)。
VDDK的Mount分为两步,第一步会挂在remote
disk到fuse下,然后挂载fuse/xxx/flat
到块设备上。第一步成功,第二部失败也应该正确退出。

* fix(host-deployer): Kill process

* opt(host-deployer): Increase timeout of waiting mount

* opt(host-deployer): Add debug log print command to mount

* fix(esxi): Support multi agent in different zone
2020-09-01 10:47:39 +08:00
Zexi Li
6c30c1c789 Merge pull request #7681 from wanyaoqi/automated-cherry-pick-of-#7680-upstream-release-3.4
Automated cherry pick of #7680: snapshot list by guest
2020-09-01 10:47:14 +08:00
Zexi Li
adf8885a7a Merge pull request #7671 from zhaoxiangchun/automated-cherry-pick-of-#7667-upstream-release-3.4
Automated cherry pick of #7667: monitor commonalert bugfix
2020-09-01 10:46:24 +08:00
Jian Qiu
cca2267389 fix: server purge may fail (#7698)
Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
2020-09-01 10:33:06 +08:00
Jian Qiu
538bc873a0 fix: http error limit request body length fix: http error limit request body length (#7700)
Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
2020-09-01 10:18:36 +08:00
屈轩
9812864bce fix: 不限制openstack系统盘类型 (#7675)
Co-authored-by: Qu Xuan <quxuan@yunionyun.com>
2020-09-01 01:24:36 +08:00
wanyaoqi
4af4bcb963 fix host get guests (#7683) 2020-09-01 01:14:09 +08:00
wanyaoqi
b85fb98297 fix get storage capacity on init' (#7687) 2020-09-01 01:03:37 +08:00
Yousong Zhou
19ba4b9755 vpcagent: respect guest src check settings (#7678)
mac   ip    dhcp    ping    xipping    xmacping
  on    on    y       y       n          n
  on    off   y       y       y          n
  off   off   y       y       y          y

external access depends on source routing, changing ip address will
fail that

note dst mac address of reply packet when changing only mac address
with vpc ip remains the same
2020-08-31 16:39:37 +08:00
wanyaoqi
438c1ced5f snapshot list by guest 2020-08-31 15:27:27 +08:00
zhaoxiangchun
be5bf11ebe commonalert bugfix 2020-08-31 10:28:23 +08:00
zhaoxiangchun
6cea2883ab 统一监控查询面板保存 2020-08-31 10:28:23 +08:00
Jian Qiu
5647a6842d fix: cleanup logic for nics of pending_deleted guests (#7669)
Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
2020-08-31 09:33:35 +08:00
Zexi Li
fba76c6392 Merge pull request #7663 from wanyaoqi/automated-cherry-pick-of-#7662-upstream-release-3.4
Automated cherry pick of #7662: update host deployer base image version
2020-08-28 20:36:42 +08:00
Qu Xuan
6ed3a48333 fix: avoid delete aws iam user failed 2020-08-28 20:24:53 +08:00
wanyaoqi
53a6c40a8a update host deployer base image version 2020-08-28 20:19:15 +08:00
wanyaoqi
eee193165e baremetal colloct isolated devices info (#7658) 2020-08-28 12:10:34 +08:00
Zexi Li
5987b56297 Merge pull request #7652 from tb365/automated-cherry-pick-of-#7650-upstream-release-3.4
Automated cherry pick of #7650: eip & vpc manager match fix
2020-08-28 12:09:20 +08:00
wanyaoqi
8e83ab4768 fix mount fetcher fs (#7657) 2020-08-28 12:08:35 +08:00
wanyaoqi
b977641336 remove backup metadata on delete backup (#7654) 2020-08-28 12:01:37 +08:00
TangBin
132c583790 eip & vpc manager match fix 2020-08-28 10:20:24 +08:00
wanyaoqi
557240155d fix build baremetal agent image (#7647) 2020-08-27 11:02:34 +08:00
屈轩
3243e5a035 fix: aovid truncated data (#7644)
Co-authored-by: Qu Xuan <quxuan@yunionyun.com>
2020-08-26 21:45:34 +08:00
Jian Qiu
e3fe66e8eb fix: add keystone sync user debug info (#7639)
Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
2020-08-26 18:42:37 +08:00
Jian Qiu
de80f17053 fix: turn off some default project policies (#7637)
Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
2020-08-26 18:41:35 +08:00
屈轩
aef249ea8e fix: avoid openstack image-list failed (#7641)
Co-authored-by: Qu Xuan <quxuan@yunionyun.com>
2020-08-26 18:33:33 +08:00
895 changed files with 85585 additions and 12952 deletions

View File

@@ -314,7 +314,7 @@ VERSION ?= $(shell git describe --exact-match 2> /dev/null || \
git describe --match=$(git rev-parse --short=8 HEAD) --always --dirty --abbrev=8)
image:
TAG=$(VERSION) REGISTRY=$(REGISTRY) $(ROOT_DIR)/scripts/docker_push.sh $(filter-out $@,$(MAKECMDGOALS))
DEBUG=$(DEBUG) ARCH=$(ARCH) TAG=$(VERSION) REGISTRY=$(REGISTRY) $(ROOT_DIR)/scripts/docker_push.sh $(filter-out $@,$(MAKECMDGOALS))
.PHONY: image

View File

@@ -1,4 +1,4 @@
FROM registry.cn-beijing.aliyuncs.com/yunionio/baremetal-base:v0.0.1
FROM registry.cn-beijing.aliyuncs.com/yunionio/baremetal-base:v0.2
MAINTAINER "Zexi Li <lizexi@yunionyun.com>"

View File

@@ -5,13 +5,16 @@ MAINTAINER "Yaoqi Wan <wanyaoqi@yunionyun.com>"
RUN mkdir -p /opt/yunion/bin
RUN apk update && \
apk add --no-cache ipmitool ethtool tzdata ca-certificates && \
apk add --no-cache ipmitool ethtool tzdata ca-certificates cdrkit coreutils && \
rm -rf /var/cache/apk/*
RUN cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
RUN mkdir -p /opt/cloud/yunion/baremetal
# udpate latest pci.ids
RUN wget -O /opt/cloud/yunion/baremetal/pci.ids http://pci-ids.ucw.cz/v2.2/pci.ids
# download baremetal-pxerom-*.x86_64.rpm and unpack rpm in current directory
COPY ./opt/cloud/yunion/baremetal/bootia32.efi /opt/cloud/yunion/baremetal
COPY ./opt/cloud/yunion/baremetal/bootx64.efi /opt/cloud/yunion/baremetal
@@ -27,13 +30,3 @@ COPY ./opt/cloud/yunion/baremetal/libutil.c32 /opt/cloud/yunion/baremetal
COPY ./opt/cloud/yunion/baremetal/lpxelinux.0 /opt/cloud/yunion/baremetal
COPY ./opt/cloud/yunion/baremetal/menu.c32 /opt/cloud/yunion/baremetal
COPY ./opt/cloud/yunion/baremetal/pxelinux.0 /opt/cloud/yunion/baremetal
# add mkisofs with bundles libraries
ADD ./mkisofs /bin/mkisofs
ADD ./.mkisofs.bin /bin/.mkisofs.bin
ADD ./bundles/mkisofs /bin/bundles/mkisofs
# use GNU timeout command replace busybox timeout command
RUN rm /usr/bin/timeout
ADD ./timeout /bin/timeout
ADD ./.timeout.bin /bin/.timeout.bin
ADD ./bundles/timeout /bin/bundles/timeout

View File

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

View File

@@ -1,3 +1,4 @@
FROM registry.cn-beijing.aliyuncs.com/yunionio/onecloud-base:v0.2
COPY ./build/monitor/root/opt/ /opt/
ADD ./_output/alpine-build/bin/monitor /opt/yunion/bin/monitor

View File

@@ -7,7 +7,7 @@ COPY . /root/go/src/yunion.io/x/onecloud
WORKDIR /root/go/src/yunion.io/x/onecloud
RUN make cmd/esxi-agent
FROM FROM registry.cn-beijing.aliyuncs.com/yunionio/onecloud-base:v0.2
FROM registry.cn-beijing.aliyuncs.com/yunionio/onecloud-base:v0.2
MAINTAINER "Yaoqi Wan wanyaoqi@yunionyun.com"

View File

@@ -0,0 +1,17 @@
## {{.title}}
- 时间: {{.start_time}}
- 级别: {{.level}}
{{ range .matches}}
- 指标: {{.metric}}
- 触发值: {{html .value_str}}
### 触发条件:
- {{html $.description}}
### 标签
> 名称: {{ index .tags "name" }}
> ip: {{ index .tags "ip" }}
> 平台: {{ index .tags "brand" }}
------
{{- end}}

View File

@@ -0,0 +1,138 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>{{.Title}}</title>
</head>
<style>
.title {
height: 40px;
line-height: 40px;
width: 960px;
background-color: #4da1ff;
color: #fff;
font-size: 16px;
text-align: center;
margin: 0 auto;
}
.table {
width: 960px;
margin: 0 auto;
padding: 10px 30px 0px 30px;
font-family:'微软雅黑',Helvetica,Arial,sans-serif;
font-size:14px;
background-color: #fbfbfb;
}
.tr-title {
height: 10px;
border-left: 5px solid #4da1ff;
margin-left: 10px;
padding: 3px 8px;
font-weight: bold;
}
.td {
width: 80px;
padding-left: 20px;
height: 35px;
font-weight: 400;
}
.link {
text-decoration: none;
color: #3591FF;
}
.thead-tr td {
border-left: 1px solid #d7d7d7;
border-top: 1px solid #d7d7d7;
height: 32px;
font-size: 14px;
background-color: #d7d7d7;
text-align: center;
}
.tbody-tr td {
border-left: 1px solid #d7d7d7;
border-top: 1px solid #d7d7d7;
height: 32px;
font-size: 14px;
font-weight: 400;
text-align: center;
}
.pb-3 {
padding-bottom: 30px;
}
.resouce-table {
width: 98%;
color: #717171;
border-right: 1px solid #d7d7d7;
border-bottom: 1px solid #d7d7d7;
}
</style>
<body>
<h3 class="title">报警提醒</h3>
<table border="0" cellspacing="0" cellpadding="0" class="table">
<tr><td colspan="4" class="tr-title">报警信息</td></tr>
<tr><td style="height: 10px;"></td></tr>
<tr>
<td class="td">报警策略:</td>
<td>{{.name}}</td>
</tr>
<tr>
<td class="td">报警级别:</td>
<td>{{.level}}</td>
</tr>
<tr>
<td class="td">报警时间:</td>
<td>{{.start_time}}</td>
</tr>
<tr>
<td class="td">策略详情:</td>
<td>{{.description}}</td>
</tr>
</table>
<table class="table" style="padding-top: 6px; padding-bottom: 10px;">
<tr>
<td style="padding-left: 20px; font-size: 14px;">若要查看详情信息,<a class="link" target="_blank" href="{{.web_url}}/commonalerts
">请登录平台进行查看</a></td>
</tr>
</table>
<table border="0" cellspacing="0" cellpadding="0" class="table pb-3">
<tr><td colspan="4" class="tr-title">报警资源</td></tr>
<tr><td style="height: 10px;"></td></tr>
<tr>
<td colspan="4" style="padding: 10px 0 0 20px;">
<table cellspacing="0" cellpadding="0" class="resouce-table">
<thead>
<tr class="thead-tr">
<td>名称</td>
<td>IP</td>
<td>平台</td>
<td>触发值</td>
</tr>
</thead>
<tbody>
{{- range $i, $Matche := .matches}}
<tr class="tbody-tr">
<td>
{{- index .tags "name"}}
</td>
<td>
{{ index .tags "ip" }}
</td>
<td>
{{ index .tags "brand" }}
</td>
<td>{{$Matche.value_str}}</td>
</tr>
{{end}}
</tbody>
</table>
</td>
</tr>
<tr><td style="height: 10px;"></td></tr>
</table>
<p style="width: 960px; height: 40px; line-height: 40px; margin: 0 auto; background-color: #4da1ff; color: #fff; font-size: 12px; text-align: center; ">本邮件由系统自动发送,请勿直接回复!</p>
</body>
</html>

View File

@@ -0,0 +1,17 @@
## {{.title}}
- Time: {{.start_time}}
- Level: {{.level}}
{{ range .matches}}
- Metric: {{.metric}}
- Trigger value: {{html .value_str}}
### Trigger condition:
- {{html $.description }}
### Label
> Name: {{ index .tags "name" }}
> IP: {{ index .tags "ip" }}
> Brand: {{ index .tags "brand" }}
------
{{- end}}

View File

@@ -0,0 +1,145 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>{{.Title}}</title>
</head>
<style>
.title {
height: 40px;
line-height: 40px;
width: 960px;
background-color: #4da1ff;
color: #fff;
font-size: 16px;
text-align: center;
margin: 0 auto;
}
.table {
width: 960px;
margin: 0 auto;
padding: 10px 30px 0px 30px;
font-family:'微软雅黑',Helvetica,Arial,sans-serif;
font-size:14px;
background-color: #fbfbfb;
}
.tr-title {
height: 10px;
border-left: 5px solid #4da1ff;
margin-left: 10px;
padding: 3px 8px;
font-weight: bold;
}
.td {
width: 80px;
padding-left: 20px;
height: 35px;
font-weight: 400;
}
.link {
text-decoration: none;
color: #3591FF;
}
.thead-tr td {
border-left: 1px solid #d7d7d7;
border-top: 1px solid #d7d7d7;
height: 32px;
font-size: 14px;
background-color: #d7d7d7;
text-align: center;
}
.tbody-tr td {
border-left: 1px solid #d7d7d7;
border-top: 1px solid #d7d7d7;
height: 32px;
font-size: 14px;
font-weight: 400;
text-align: center;
}
.pb-3 {
padding-bottom: 30px;
}
.resouce-table {
width: 98%;
color: #717171;
border-right: 1px solid #d7d7d7;
border-bottom: 1px solid #d7d7d7;
}
</style>
<body>
<h3 class="title">Alert</h3>
<table border="0" cellspacing="0" cellpadding="0" class="table">
<tr><td colspan="4" class="tr-title">Alert info</td></tr>
<tr><td style="height: 10px;"></td></tr>
<tr>
<td class="td">Alarm strategy</td>
<td>{{.name}}</td>
</tr>
<tr>
<td class="td">Alarm level</td>
<td>{{.level}}</td>
</tr>
<tr>
<td class="td">Alarm time</td>
<td>{{.start_time}}</td>
</tr>
<tr>
<td class="td">Strategy details</td>
<td>{{.description}}</td>
</tr>
</table>
<table class="table" style="padding-top: 6px; padding-bottom: 10px;">
<tr>
<td style="padding-left: 20px; font-size: 14px;">To view details<a class="link" target="_blank" href="{{.web_url}}/commonalerts
">Please log in to the platform to view</a></td>
</tr>
</table>
<table border="0" cellspacing="0" cellpadding="0" class="table pb-3">
<tr><td colspan="4" class="tr-title">Alarm resources</td></tr>
<tr><td style="height: 10px;"></td></tr>
<tr>
<td colspan="4" style="padding: 10px 0 0 20px;">
<table cellspacing="0" cellpadding="0" class="resouce-table">
<thead>
<tr class="thead-tr">
<td>Name</td>
<td>IP</td>
<td>Brand</td>
<td>Trigger value</td>
</tr>
</thead>
<tbody>
{{- range $i, $Matche := .matches}}
<tr class="tbody-tr">
<td>
{{- index .tags "name"}}
</td>
<td>
{{ index .tags "ip" }}
</td>
<td>
{{ index .tags "brand" }}
</td>
<td>{{$Matche.value_str}}</td>
</tr>
{{end}}
</tbody>
</table>
</td>
</tr>
<tr><td style="height: 10px;"></td></tr>
</table>
<p style="width: 960px; height: 40px; line-height: 40px; margin: 0 auto; background-color: #4da1ff; color: #fff; font-size: 12px; text-align: center; ">This email is sent automatically by the system. Please do not reply directly</p>
</body>
</html>

View File

@@ -0,0 +1 @@
{{.title}}

View File

@@ -0,0 +1 @@
{{.title}}

View File

@@ -1 +0,0 @@
您的{{ .brand }}主机{{ .name }}的套餐类型已经更改为 CPU:{{ index .flavor_info "cpu" }}核,内存:{{ index .flavor_info "memory" }}M数据盘:{{ index .flavor_info "datadisk" }}G带宽: {{ index .flavor_info "ebw" }}M。

View File

@@ -1 +0,0 @@
您的{{ .brand }}主机{{ .name }}已经创建成功服务器IP地址为{{ .ips }}{{ if .account }}初始帐号为{{ .account }}{{ end }}{{ if .keypair }}访问ssh密钥为{{ .keypair }}{{ end }}{{ if .password }}初始密码为{{ .password }}{{ end }}请使用{{ if .windows }}远程桌面连接器(RDC){{ else }}SSH{{ end }}或控制面板控制台访问云主机。

View File

@@ -1 +0,0 @@
项目{{ .tenant }}的{{ .brand }}主机{{ .name }}已经创建成功。

View File

@@ -1 +0,0 @@
您的{{ .brand }}主机{{ .name }}已经删除。

View File

@@ -1 +0,0 @@
项目{{ .tenant }}的{{ .brand }}主机{{ .name }}已经删除。

View File

@@ -1 +0,0 @@
您的{{ .brand }}主机{{ .name }}系统崩溃了: {{ .reason }}

View File

@@ -1 +0,0 @@
您的{{ .brand }}主机{{ .name }}重装系统成功,{{ if .account }}初始帐号为{{ .account }}{{ end }}{{ if .keypair }}访问密钥为{{ .keypair }}{{ end }}{{ if .password }}初始密码为{{ .password }}{{ end }}请使用{{ if .windows }}远程桌面连接器(RDC){{ else }}SSH{{ end }}或控制面板控制台访问云主机。

View File

@@ -0,0 +1 @@
您的{{ .brand }}虚拟机{{ .name }}的套餐类型已经更改为 CPU:{{ index .flavor_info "cpu" }}核,内存:{{ index .flavor_info "memory" }}M数据盘:{{ index .flavor_info "datadisk" }}G带宽: {{ index .flavor_info "ebw" }}M。

View File

@@ -0,0 +1 @@
您的{{ .brand }}虚拟机{{ .name }}已经创建成功虚拟机IP地址为{{ .ips }}{{ if .account }}初始帐号为{{ .account }}{{ end }}{{ if .keypair }}访问ssh密钥为{{ .keypair }}{{ end }}{{ if .password }}初始密码为{{ .password }}{{ end }}请使用{{ if .windows }}远程桌面连接器(RDC){{ else }}SSH{{ end }}或控制面板控制台访问虚拟机。

View File

@@ -0,0 +1 @@
项目{{ .tenant }}的{{ .brand }}虚拟机{{ .name }}已经创建成功。

View File

@@ -0,0 +1 @@
您的{{ .brand }}虚拟机{{ .name }}已经删除。

View File

@@ -0,0 +1 @@
项目{{ .tenant }}的{{ .brand }}虚拟机{{ .name }}已经删除。

View File

@@ -0,0 +1 @@
您的{{ .brand }}虚拟机{{ .name }}系统崩溃了: {{ .reason }}

View File

@@ -0,0 +1 @@
您的{{ .brand }}虚拟机{{ .name }}重装系统成功,{{ if .account }}初始帐号为{{ .account }}{{ end }}{{ if .keypair }}访问密钥为{{ .keypair }}{{ end }}{{ if .password }}初始密码为{{ .password }}{{ end }}请使用{{ if .windows }}远程桌面连接器(RDC){{ else }}SSH{{ end }}或控制面板控制台访问虚拟机。

View File

@@ -0,0 +1 @@
The instance type of your {{ .brand }} virtual machine {{ .name }} has been changed to: {{ index .flavor_info "cpu" }}-core CPU, {{ index .flavor_info "memory" }}M memory, {{ index .flavor_info "datadisk" }}G data disk, {{ index .flavor_info "ebw" }}M bandwidth.

View File

@@ -0,0 +1 @@
Your {{ .brand }} virtual machine {{ .name }} has been created successfully. The VM's IP address is {{ .ips }}, {{ if .account }}initial account is {{ .account }}, {{ end }}{{ if .keypair }}the access ssh key is {{ .keypair }}, {{ end }}{{ if .password }}the initial password is {{ .password }}, {{ end }}and please use {{ if .windows }}Remote Desktop Connector (RDC){{ else }}SSH{{ end }} or the control panel console to access the VM.

View File

@@ -0,0 +1 @@
The {{ .brand }} virtual machine {{ .name }} of the project {{ .tenant }} has been created successfully.

View File

@@ -0,0 +1 @@
Your {{ .brand }} virtual machine {{ .name }} has been deleted.

View File

@@ -0,0 +1 @@
The {{ .brand }} virtual machine {{ .name }} of the project {{ .tenant }} has been deleted.

View File

@@ -0,0 +1 @@
Your {{ .brand }} virtual machine {{ .name }} system crashed: {{ .reason }}

View File

@@ -0,0 +1 @@
Your {{ .brand }} virtual machine {{ .name }} is successfully reinstalled. The VM's {{ if .account }}initial account is {{ .account }}, {{ end }}{{ if .keypair }}the access key is {{ .keypair }}, {{ end }}{{ if .password }}the initial password is {{ .password }}, {{ end }}and please use {{ if .windows }}remote desktop connection (RDC){{ else }}SSH{{ end }} or the control panel console to access the virtual machine.

View File

@@ -0,0 +1,6 @@
System error message
Resource: {{ .name}}
Resource ID: {{ .id }}
Event: {{ .event }}
Reason: {{ .reason }}
Time: {{ .created }}

View File

@@ -0,0 +1,6 @@
System warning message
Resource: {{ .name}}
Resource ID: {{ .id }}
Event: {{ .event }}
Reason: {{ .reason }}
Time: {{ .created }}

View File

@@ -1 +0,0 @@
您的{{ .brand }}主机{{ .name }}的套餐类型已经更改为 CPU:{{ index .flavor_info "cpu" }}核,内存:{{ index .flavor_info "memory" }}M数据盘:{{ index .flavor_info "datadisk" }}G带宽: {{ index .flavor_info "ebw" }}M。

View File

@@ -1 +0,0 @@
{{ .brand }}主机{{ .Name }}创建成功

View File

@@ -1 +0,0 @@
项目{{ .tenant }}的{{ .brand }}主机{{ .name }}已经创建成功

View File

@@ -1 +0,0 @@
{{ .brand }}主机{{ .name }}删除通知

View File

@@ -1 +0,0 @@
项目{{ .tenant }}的{{ .brand }}主机{{ .name }}已经删除

View File

@@ -1 +0,0 @@
您的{{ .brand }}主机{{ .name }}系统崩溃了

View File

@@ -1 +0,0 @@
{{ .brand }}主机{{ .name }}重装系统成功

View File

@@ -0,0 +1 @@
您的{{ .brand }}虚拟机{{ .name }}的套餐类型已经更改为 CPU:{{ index .flavor_info "cpu" }}核,内存:{{ index .flavor_info "memory" }}M数据盘:{{ index .flavor_info "datadisk" }}G带宽: {{ index .flavor_info "ebw" }}M。

View File

@@ -0,0 +1 @@
{{ .brand }}虚拟机{{ .Name }}创建成功

View File

@@ -0,0 +1 @@
项目{{ .tenant }}的{{ .brand }}虚拟机{{ .name }}已经创建成功

View File

@@ -0,0 +1 @@
{{ .brand }}虚拟机{{ .name }}删除通知

View File

@@ -0,0 +1 @@
项目{{ .tenant }}的{{ .brand }}虚拟机{{ .name }}已经删除

View File

@@ -0,0 +1 @@
您的{{ .brand }}虚拟机{{ .name }}系统崩溃了

View File

@@ -0,0 +1 @@
{{ .brand }}虚拟机{{ .name }}重装系统成功

View File

@@ -0,0 +1 @@
The instance type of your {{ .brand }} virtual machine {{ .name }} has been changed to: {{ index .flavor_info "cpu" }}-core CPU, {{ index .flavor_info "memory" }}M memory, {{ index .flavor_info "datadisk" }}G data disk, {{ index .flavor_info "ebw" }}M bandwidth

View File

@@ -0,0 +1 @@
The {{ .brand }} virtual machine {{ .Name }} created successfully

View File

@@ -0,0 +1 @@
The {{ .brand }} virtual machine {{ .name }} of the project {{ .tenant }} has been created successfully

View File

@@ -0,0 +1 @@
The {{ .brand }} virtual machine {{ .name }} has been deleted

View File

@@ -0,0 +1 @@
The {{ .brand }} virtual machine {{ .name }} of the project {{ .tenant }} has been deleted

View File

@@ -0,0 +1 @@
Your {{ .brand }} virtual machine {{ .name }} system crashed

View File

@@ -0,0 +1 @@
The {{ .brand }} virtual machine {{ .name }} successfully reinstalled the system

View File

@@ -0,0 +1 @@
System error message {{ .name }} {{ .event }}

View File

@@ -0,0 +1 @@
System warning message {{ .name }} {{ .event }}

View File

@@ -32,6 +32,7 @@ func init() {
cmd.Perform("attach-policy", &options.ClouduserPolicyOptions{})
cmd.Perform("detach-policy", &options.ClouduserPolicyOptions{})
cmd.Perform("change-owner", &options.ClouduserChangeOwnerOptions{})
cmd.Perform("reset-password", &options.ClouduserResetPasswordOptions{})
cmd.Perform("cloud-user-join-group", &options.ClouduserGroupOptions{})
cmd.Perform("cloud-user-leave-group", &options.ClouduserGroupOptions{})
}

View File

@@ -35,6 +35,8 @@ func init() {
NoObjectStorage bool `help:"filter cloudproviders that has no object storage"`
Capability []string `help:"capability filter" choices:"project|compute|network|loadbalancer|objectstore|rds|cache|event"`
Cloudregion string `help:"filter cloudproviders by cloudregion"`
HostSchedtagId string `help:"filter by host schedtag"`
}
R(&CloudproviderListOptions{}, "cloud-provider-list", "List cloud providers", func(s *mcclient.ClientSession, args *CloudproviderListOptions) error {
var params *jsonutils.JSONDict
@@ -62,6 +64,10 @@ func init() {
if len(args.Cloudregion) > 0 {
params.Add(jsonutils.NewString(args.Cloudregion), "cloudregion")
}
if len(args.HostSchedtagId) > 0 {
params.Add(jsonutils.NewString(args.HostSchedtagId), "host_schedtag_id")
}
}
result, err := modules.Cloudproviders.List(s, params)
if err != nil {

View File

@@ -0,0 +1,33 @@
// 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"
"yunion.io/x/onecloud/pkg/mcclient/modules"
"yunion.io/x/onecloud/pkg/mcclient/options"
)
func init() {
cmd := shell.NewResourceCmd(&modules.DnsRecordSets).WithKeyword("dns-recordset")
cmd.List(&options.DnsRecordSetListOptions{})
cmd.Create(&options.DnsRecordSetCreateOptions{})
cmd.Update(&options.DnsRecordSetUpdateOptions{})
cmd.Show(&options.DnsRecordSetIdOptions{})
cmd.Delete(&options.DnsRecordSetIdOptions{})
cmd.Perform("enable", &options.DnsRecordSetIdOptions{})
cmd.Perform("disable", &options.DnsRecordSetIdOptions{})
cmd.Perform("set-traffic-policies", &options.DnsRecordSetTrafficPolicyOptions{})
}

View File

@@ -0,0 +1,27 @@
// 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"
"yunion.io/x/onecloud/pkg/mcclient/modules"
"yunion.io/x/onecloud/pkg/mcclient/options"
)
func init() {
cmd := shell.NewResourceCmd(&modules.DnsTrafficPolicies).WithKeyword("dns-trafficpolicy")
cmd.List(&options.DnsTrafficPolicyListOptions{})
cmd.Create(&options.DnsTrafficPolicyCreateOptions{})
}

View File

@@ -0,0 +1,37 @@
// 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"
"yunion.io/x/onecloud/pkg/mcclient/modules"
"yunion.io/x/onecloud/pkg/mcclient/options"
)
func init() {
cmd := shell.NewResourceCmd(&modules.DnsZones).WithKeyword("dns-zone")
cmd.List(&options.SDnsZoneListOptions{})
cmd.Show(&options.SDnsZoneIdOptions{})
cmd.ClassShow(&options.DnsZoneCapabilitiesOptions{})
cmd.Delete(&options.SDnsZoneIdOptions{})
cmd.Create(&options.DnsZoneCreateOptions{})
cmd.Perform("syncstatus", &options.SDnsZoneIdOptions{})
cmd.Perform("sync-recordsets", &options.SDnsZoneIdOptions{})
cmd.Perform("cache", &options.DnsZoneCacheOptions{})
cmd.Perform("uncache", &options.DnsZoneUncacheOptions{})
cmd.Perform("purge", &options.SDnsZoneIdOptions{})
cmd.Perform("add-vpcs", &options.DnsZoneAddVpcsOptions{})
cmd.Perform("remove-vpcs", &options.DnsZoneRemoveVpcsOptions{})
}

View File

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

View File

@@ -20,6 +20,7 @@ import (
"yunion.io/x/jsonutils"
"yunion.io/x/onecloud/cmd/climc/shell"
api "yunion.io/x/onecloud/pkg/apis/compute"
"yunion.io/x/onecloud/pkg/mcclient"
"yunion.io/x/onecloud/pkg/mcclient/modulebase"
"yunion.io/x/onecloud/pkg/mcclient/modules"
@@ -203,15 +204,18 @@ func init() {
type NetworkAddressOptions struct {
NETWORK string `help:"id or name of network to query"`
api.GetNetworkAddressesInput
}
R(&NetworkAddressOptions{}, "network-addresses", "Query used addresses of network", func(s *mcclient.ClientSession, args *NetworkAddressOptions) error {
result, err := modules.Networks.GetSpecific(s, args.NETWORK, "addresses", nil)
result, err := modules.Networks.GetSpecific(s, args.NETWORK, "addresses", jsonutils.Marshal(args.GetNetworkAddressesInput))
if err != nil {
return err
}
addrList, err := result.GetArray("addresses")
if err != nil {
return err
addrList, _ := result.GetArray("addresses")
if addrList == nil {
fmt.Println("no result")
return nil
}
listResult := modulebase.ListResult{Data: addrList}
printList(&listResult, nil)

View File

@@ -15,194 +15,23 @@
package compute
import (
"fmt"
"yunion.io/x/jsonutils"
"yunion.io/x/onecloud/pkg/mcclient"
"yunion.io/x/onecloud/cmd/climc/shell"
"yunion.io/x/onecloud/pkg/mcclient/modules"
"yunion.io/x/onecloud/pkg/mcclient/options"
)
func init() {
type SecGroupsListOptions struct {
Equals string `help:"Secgroup ID or Name, filter secgroups whose rules equals the specified one"`
Server string `help:"Filter secgroups bound to specified server"`
options.BaseListOptions
Ip string `help:"Filter secgroup by ip"`
Ports string `help:"Filter secgroup by ports"`
Direction string `help:"Filter secgroup by ports" choices:"all|in|out"`
}
R(&SecGroupsListOptions{}, "secgroup-list", "List all security group", func(s *mcclient.ClientSession, args *SecGroupsListOptions) error {
params, err := options.ListStructToParams(args)
if err != nil {
return err
}
result, err := modules.SecGroups.List(s, params)
if err != nil {
return err
}
printList(result, modules.SecGroups.GetColumns(s))
return nil
})
type SecGroupsCreateOptions struct {
NAME string `help:"Name of security group to create"`
RULES []string `help:"security rule to create"`
Desc string `help:"Description"`
}
R(&SecGroupsCreateOptions{}, "secgroup-create", "Create a security group", func(s *mcclient.ClientSession, args *SecGroupsCreateOptions) error {
params := jsonutils.NewDict()
params.Add(jsonutils.NewString(args.NAME), "name")
if len(args.Desc) > 0 {
params.Add(jsonutils.NewString(args.Desc), "description")
}
for i, a := range args.RULES {
params.Add(jsonutils.NewString(a), fmt.Sprintf("rule.%d", i))
}
secgroups, err := modules.SecGroups.Create(s, params)
if err != nil {
return err
}
printObject(secgroups)
return nil
})
type SecGroupsUnionOptions struct {
ID string `help:"ID or Name of security group destination"`
SECGROUPS []string `help:"source IDs or Names of secgroup"`
}
R(&SecGroupsUnionOptions{}, "secgroup-union", "Union secgroups to one secgroup", func(s *mcclient.ClientSession, args *SecGroupsUnionOptions) error {
params := jsonutils.NewDict()
secgroups := jsonutils.NewArray()
for i := 0; i < len(args.SECGROUPS); i++ {
secgroups.Add(jsonutils.NewString(args.SECGROUPS[i]))
}
params.Add(secgroups, "secgroups")
secgroup, err := modules.SecGroups.PerformAction(s, args.ID, "union", params)
if err != nil {
return err
}
printObject(secgroup)
return nil
})
type SecGroupsDetailOptions struct {
ID string `help:"ID or Name of security group"`
}
R(&SecGroupsDetailOptions{}, "secgroup-show", "Show details of a security group", func(s *mcclient.ClientSession, args *SecGroupsDetailOptions) error {
result, err := modules.SecGroups.Get(s, args.ID, nil)
if err != nil {
return err
}
printObject(result)
return nil
})
R(&SecGroupsDetailOptions{}, "secgroup-delete", "Delete a security group", func(s *mcclient.ClientSession, args *SecGroupsDetailOptions) error {
secgroups, err := modules.SecGroups.Delete(s, args.ID, nil)
if err != nil {
return err
}
printObject(secgroups)
return nil
})
R(&SecGroupsDetailOptions{}, "secgroup-public", "Make a security group publicly available", func(s *mcclient.ClientSession, args *SecGroupsDetailOptions) error {
result, err := modules.SecGroups.PerformAction(s, args.ID, "public", nil)
if err != nil {
return err
}
printObject(result)
return nil
})
R(&SecGroupsDetailOptions{}, "secgroup-private", "Make a security group private", func(s *mcclient.ClientSession, args *SecGroupsDetailOptions) error {
result, err := modules.SecGroups.PerformAction(s, args.ID, "private", nil)
if err != nil {
return err
}
printObject(result)
return nil
})
type SecGroupsUpdateOptions struct {
ID string `help:"ID of security group"`
Name string `help:"Name of security group to update"`
Desc string `help:"Description of security groups"`
}
R(&SecGroupsUpdateOptions{}, "secgroup-update", "Update details of a security group", func(s *mcclient.ClientSession, args *SecGroupsUpdateOptions) error {
params := jsonutils.NewDict()
if len(args.Name) > 0 {
params.Add(jsonutils.NewString(args.Name), "name")
}
if len(args.Desc) > 0 {
params.Add(jsonutils.NewString(args.Desc), "description")
}
secgroups, err := modules.SecGroups.Update(s, args.ID, params)
if err != nil {
return err
}
printObject(secgroups)
return nil
})
type SecGroupsAddRuleOptions struct {
ID string `help:"ID or Name of security group"`
DIRECTION string `help:"Direction of rule" choices:"in|out"`
PROTOCOL string `help:"Protocol of rule" choices:"any|tcp|udp|icmp"`
ACTION string `help:"Actin of rule" choices:"allow|deny"`
PRIORITY int `help:"Priority for rule, range 1 ~ 100"`
Cidr string `help:"IP or CIRD for rule"`
Description string `help:"Desciption for rule"`
Ports string `help:"Port for rule"`
}
R(&SecGroupsAddRuleOptions{}, "secgroup-add-rule", "Add rule for a security group", func(s *mcclient.ClientSession, args *SecGroupsAddRuleOptions) error {
params, err := options.StructToParams(args)
secgroups, err := modules.SecGroups.PerformAction(s, args.ID, "add-rule", params)
if err != nil {
return err
}
printObject(secgroups)
return nil
})
type SecurityGroupCacheSecurityGroup struct {
ID string `help:"ID or Name of security group"`
VPC string `help:"ID or Name of vpc"`
Classic *bool `help:"Is classic vpc"`
}
R(&SecurityGroupCacheSecurityGroup{}, "secgroup-cache-secgroup", "Cache security group for special vpc", func(s *mcclient.ClientSession, args *SecurityGroupCacheSecurityGroup) error {
params, err := options.StructToParams(args)
secgroups, err := modules.SecGroups.PerformAction(s, args.ID, "cache-secgroup", params)
if err != nil {
return err
}
printObject(secgroups)
return nil
})
type SecurityGroupUncacheSecurityGroup struct {
ID string `help:"ID or Name of security group"`
CACHE string `help:"ID of secgroup cache"`
}
R(&SecurityGroupUncacheSecurityGroup{}, "secgroup-uncache-secgroup", "Unache special secgroup cache", func(s *mcclient.ClientSession, args *SecurityGroupUncacheSecurityGroup) error {
params := jsonutils.NewDict()
params.Add(jsonutils.NewString(args.CACHE), "secgroupcache")
secgroups, err := modules.SecGroups.PerformAction(s, args.ID, "uncache-secgroup", params)
if err != nil {
return err
}
printObject(secgroups)
return nil
})
cmd := shell.NewResourceCmd(&modules.SecGroups)
cmd.List(&options.SecgroupListOptions{})
cmd.Create(&options.SecgroupCreateOptions{})
cmd.Show(&options.SecgroupIdOptions{})
cmd.Update(&options.BaseUpdateOptions{})
cmd.Delete(&options.SecgroupIdOptions{})
cmd.Perform("merge", &options.SecgroupMergeOptions{})
cmd.Perform("public", &options.SecgroupIdOptions{})
cmd.Perform("private", &options.SecgroupIdOptions{})
cmd.Perform("add-rule", &options.SecgroupsAddRuleOptions{})
cmd.Perform("cache-secgroup", &options.SecurityGroupCacheOptions{})
cmd.Perform("uncache-secgroup", &options.SecurityGroupUncacheSecurityGroup{})
cmd.Perform("purge", &options.SecgroupIdOptions{})
}

View File

@@ -31,6 +31,7 @@ func init() {
Local *bool `help:"Show local snapshots"`
Share *bool `help:"Show shared snapshots"`
DiskType string `help:"Filter by disk type" choices:"sys|data"`
Server string `help:"Filter by server" json:"server_id"`
}
R(&SnapshotsListOptions{}, "snapshot-list", "Show snapshots", func(s *mcclient.ClientSession, args *SnapshotsListOptions) error {
params, err := options.ListStructToParams(args)

View File

@@ -70,13 +70,15 @@ func init() {
type HostsQueryOptions struct {
options.BaseListOptions
HostType string `help:"Host type filter" choices:"baremetal|hypervisor|esxi|kubelet|hyperv"`
Ncpu int64 `help:"#CPU count of host" metavar:"<CPU_COUNT>"`
MemSize int64 `help:"Memory MB size"`
DiskSpec []string `help:"Disk spec string, like 'Linux_adapter0_HDD_111Gx4'"`
Nic int64 `help:"#Nics count of host" metavar:"<NIC_COUNT>"`
GpuModel []string `help:"GPU model, like 'GeForce GTX 1050 Ti'"`
Occupied bool `help:"show occupid host" json:"-"`
HostType string `help:"Host type filter" choices:"baremetal|hypervisor|esxi|kubelet|hyperv"`
Ncpu int64 `help:"#CPU count of host" metavar:"<CPU_COUNT>"`
MemSize int64 `help:"Memory MB size"`
DiskSpec []string `help:"Disk spec string, like 'Linux_adapter0_HDD_111Gx4'"`
Nic int64 `help:"#Nics count of host" metavar:"<NIC_COUNT>"`
GpuModel []string `help:"GPU model, like 'GeForce GTX 1050 Ti'"`
Occupied bool `help:"Show occupid host" json:"-"`
Manufacture string `help:"Manufacture of host"`
Model string `help:"Model of host"`
}
R(&HostsQueryOptions{}, "spec-hosts-list", "List hosts according by specs", func(s *mcclient.ClientSession, args *HostsQueryOptions) error {
newHostSpecKeys := func() []string {
@@ -90,6 +92,12 @@ func init() {
if args.Nic > 0 {
keys = append(keys, fmt.Sprintf("nic:%d", args.Nic))
}
if args.Manufacture != "" {
keys = append(keys, fmt.Sprintf("manufacture:%s", args.Manufacture))
}
if args.Model != "" {
keys = append(keys, fmt.Sprintf("model:%s", args.Model))
}
for _, gm := range args.GpuModel {
keys = append(keys, fmt.Sprintf("gpu_model:%s", gm))
}

View File

@@ -35,6 +35,8 @@ func init() {
Zone string `help:"List storages in zone" json:"-"`
Region string `help:"List storages in region"`
Schedtag string `help:"filter storage by schedtag"`
HostSchedtagId string `help:"filter storage by host schedtag"`
}
R(&StorageListOptions{}, "storage-list", "List storages", func(s *mcclient.ClientSession, opts *StorageListOptions) error {
params, err := options.ListStructToParams(opts)

View File

@@ -15,235 +15,24 @@
package compute
import (
"fmt"
"yunion.io/x/jsonutils"
"yunion.io/x/onecloud/pkg/mcclient"
"yunion.io/x/onecloud/pkg/mcclient/modulebase"
"yunion.io/x/onecloud/cmd/climc/shell"
"yunion.io/x/onecloud/pkg/mcclient/modules"
"yunion.io/x/onecloud/pkg/mcclient/options"
)
func init() {
type VpcListOptions struct {
options.BaseListOptions
Usable *bool `help:"Filter usable vpcs"`
Region string `help:"ID or Name of region" json:"-"`
Globalvpc string `help:"Filter by globalvpc"`
ExternalAccessMode string `help:"Filter by external access mode" choices:"distgw|eip|eip-distgw"`
}
R(&VpcListOptions{}, "vpc-list", "List VPCs", func(s *mcclient.ClientSession, opts *VpcListOptions) error {
params, err := options.ListStructToParams(opts)
if err != nil {
return err
}
var result *modulebase.ListResult
if len(opts.Region) > 0 {
result, err = modules.Vpcs.ListInContext(s, params, &modules.Cloudregions, opts.Region)
} else {
result, err = modules.Vpcs.List(s, params)
}
if err != nil {
return err
}
if len(opts.ExportFile) > 0 {
exportList(result, opts.ExportFile, opts.ExportKeys, opts.ExportTexts, modules.Vpcs.GetColumns(s))
} else {
printList(result, modules.Vpcs.GetColumns(s))
}
return nil
})
type VpcCreateOptions struct {
REGION string `help:"ID or name of the region where the VPC is created"`
Id string `help:"ID of the new VPC"`
NAME string `help:"Name of the VPC"`
CIDR string `help:"CIDR block"`
Default bool `help:"default VPC for the region" default:"false"`
Desc string `help:"Description of the VPC"`
Manager string `help:"ID or Name of Cloud provider"`
ExternalAccessMode string `help:"Filter by external access mode" choices:"distgw|eip|eip-distgw" default:"eip-distgw"`
}
R(&VpcCreateOptions{}, "vpc-create", "Create a VPC", func(s *mcclient.ClientSession, args *VpcCreateOptions) error {
params := jsonutils.NewDict()
params.Add(jsonutils.NewString(args.NAME), "name")
params.Add(jsonutils.NewString(args.CIDR), "cidr_block")
if len(args.Id) > 0 {
params.Add(jsonutils.NewString(args.Id), "id")
}
if len(args.ExternalAccessMode) > 0 {
params.Add(jsonutils.NewString(args.ExternalAccessMode), "external_access_mode")
}
if len(args.Desc) > 0 {
params.Add(jsonutils.NewString(args.Desc), "description")
}
if args.Default {
params.Add(jsonutils.JSONTrue, "is_default")
}
if len(args.Manager) > 0 {
params.Add(jsonutils.NewString(args.Manager), "manager")
}
results, err := modules.Vpcs.CreateInContext(s, params, &modules.Cloudregions, args.REGION)
if err != nil {
return err
}
printObject(results)
return nil
})
type VpcShowOptions struct {
ID string `help:"ID or name of the region"`
}
R(&VpcShowOptions{}, "vpc-show", "Show a VPC", func(s *mcclient.ClientSession, args *VpcShowOptions) error {
results, err := modules.Vpcs.Get(s, args.ID, nil)
if err != nil {
return err
}
printObject(results)
return nil
})
R(&VpcShowOptions{}, "vpc-delete", "Delete a VPC", func(s *mcclient.ClientSession, args *VpcShowOptions) error {
results, err := modules.Vpcs.Delete(s, args.ID, nil)
if err != nil {
return err
}
printObject(results)
return nil
})
type VpcUpdateOptions struct {
ID string `help:"ID or name of the VPC"`
Name string `help:"New name of the VPC"`
Desc string `help:"Description of the VPC"`
ExternalAccessMode string `help:"Filter by external access mode" choices:"distgw|eip|eip-distgw"`
}
R(&VpcUpdateOptions{}, "vpc-update", "Update a VPC", func(s *mcclient.ClientSession, args *VpcUpdateOptions) error {
params := jsonutils.NewDict()
if len(args.Name) > 0 {
params.Add(jsonutils.NewString(args.Name), "name")
}
if len(args.ExternalAccessMode) > 0 {
params.Add(jsonutils.NewString(args.ExternalAccessMode), "external_access_mode")
}
if len(args.Desc) > 0 {
params.Add(jsonutils.NewString(args.Desc), "description")
}
results, err := modules.Vpcs.Update(s, args.ID, params)
if err != nil {
return err
}
printObject(results)
return nil
})
type VpcUpdateStatusOptions struct {
ID string `help:"ID or name of the VPC"`
}
R(&VpcUpdateStatusOptions{}, "vpc-available", "Make vpc status available", func(s *mcclient.ClientSession, args *VpcUpdateStatusOptions) error {
params := jsonutils.NewDict()
params.Add(jsonutils.NewString("available"), "status")
result, err := modules.Vpcs.PerformAction(s, args.ID, "status", params)
if err != nil {
return err
}
printObject(result)
return nil
})
R(&VpcUpdateStatusOptions{}, "vpc-pending", "Make vpc status pending", func(s *mcclient.ClientSession, args *VpcUpdateStatusOptions) error {
params := jsonutils.NewDict()
params.Add(jsonutils.NewString("pending"), "status")
result, err := modules.Vpcs.PerformAction(s, args.ID, "status", params)
if err != nil {
return err
}
printObject(result)
return nil
})
R(&VpcUpdateStatusOptions{}, "vpc-purge", "Purge a managed VPC, not delete the remote entity", func(s *mcclient.ClientSession, args *VpcUpdateStatusOptions) error {
result, err := modules.Vpcs.PerformAction(s, args.ID, "purge", nil)
if err != nil {
return err
}
printObject(result)
return nil
})
R(&VpcUpdateStatusOptions{}, "vpc-sync", "Synchronize the status of a vpc", func(s *mcclient.ClientSession, args *VpcUpdateStatusOptions) error {
result, err := modules.Vpcs.PerformAction(s, args.ID, "sync", nil)
if err != nil {
return err
}
printObject(result)
return nil
})
R(&VpcUpdateStatusOptions{}, "vpc-syncstatus", "Sync the status of a vpc", func(s *mcclient.ClientSession, args *VpcUpdateStatusOptions) error {
result, err := modules.Vpcs.PerformAction(s, args.ID, "syncstatus", nil)
if err != nil {
return err
}
printObject(result)
return nil
})
type VpcPublicOptions struct {
ID string `help:"ID or name of vpc" json:"-"`
Scope string `help:"sharing scope" choices:"system|domain"`
SharedDomains []string `help:"share to domains"`
}
R(&VpcPublicOptions{}, "vpc-public", "Make vpc public", func(s *mcclient.ClientSession, args *VpcPublicOptions) error {
params := jsonutils.Marshal(args)
result, err := modules.Vpcs.PerformAction(s, args.ID, "public", params)
if err != nil {
return err
}
printObject(result)
return nil
})
type VpcPrivateOptions struct {
ID string `help:"ID or name of vpc" json:"-"`
}
R(&VpcPrivateOptions{}, "vpc-private", "Make vpc private", func(s *mcclient.ClientSession, args *VpcPrivateOptions) error {
params := jsonutils.Marshal(args)
result, err := modules.Vpcs.PerformAction(s, args.ID, "private", params)
if err != nil {
return err
}
printObject(result)
return nil
})
R(&VpcShowOptions{}, "vpc-change-owner-candidate-domains", "Show candiate domains of a vpc for changing owner", func(s *mcclient.ClientSession, args *VpcShowOptions) error {
result, err := modules.Vpcs.GetSpecific(s, args.ID, "change-owner-candidate-domains", nil)
if err != nil {
return err
}
printObject(result)
return nil
})
type VpcChangeOwnerOptions struct {
ID string `help:"ID or name of vpc" json:"-"`
ProjectDomain string `json:"project_domain" help:"target domain"`
}
R(&VpcChangeOwnerOptions{}, "vpc-change-owner", "Change owner domain of vpc", func(s *mcclient.ClientSession, args *VpcChangeOwnerOptions) error {
if len(args.ProjectDomain) == 0 {
return fmt.Errorf("empty project_domain")
}
params := jsonutils.Marshal(args)
ret, err := modules.Vpcs.PerformAction(s, args.ID, "change-owner", params)
if err != nil {
return err
}
printObject(ret)
return nil
})
cmd := shell.NewResourceCmd(&modules.Vpcs).WithContextManager(&modules.Cloudregions)
cmd.List(&options.VpcListOptions{})
cmd.Create(&options.VpcCreateOptions{})
cmd.Show(&options.VpcIdOptions{})
cmd.Delete(&options.VpcIdOptions{})
cmd.Update(&options.VpcUpdateOptions{})
cmd.Perform("status", &options.VpcStatusOptions{})
cmd.Perform("purge", &options.VpcIdOptions{})
cmd.Perform("sync", &options.VpcIdOptions{})
cmd.Perform("syncstatus", &options.VpcIdOptions{})
cmd.Perform("private", &options.VpcIdOptions{})
cmd.Perform("public", &options.BasePublicOptions{})
cmd.Perform("change-owner", &options.VpcChangeOwnerOptions{})
cmd.Get("vpc-change-owner-candidate-domains", &options.VpcIdOptions{})
}

View File

@@ -20,7 +20,6 @@ import (
"yunion.io/x/onecloud/pkg/mcclient"
"yunion.io/x/onecloud/pkg/mcclient/modulebase"
"yunion.io/x/onecloud/pkg/mcclient/modules"
"yunion.io/x/onecloud/pkg/mcclient/modules/k8s"
)
type BaseEventListOptions struct {
@@ -54,23 +53,19 @@ type TypeEventListOptions struct {
ID string `help:"" metavar:"OBJ_ID"`
}
func doK8sEventList(s *mcclient.ClientSession, args *EventListOptions) error {
return doEventList(*k8s.Logs.ResourceManager, s, args)
}
func doComputeEventList(s *mcclient.ClientSession, args *EventListOptions) error {
return doEventList(modules.Logs, s, args)
return DoEventList(modules.Logs, s, args)
}
func doImageEventList(s *mcclient.ClientSession, args *EventListOptions) error {
return doEventList(modules.ImageLogs, s, args)
return DoEventList(modules.ImageLogs, s, args)
}
func doIdentityEventList(s *mcclient.ClientSession, args *EventListOptions) error {
return doEventList(modules.IdentityLogs, s, args)
return DoEventList(modules.IdentityLogs, s, args)
}
func doEventList(man modulebase.ResourceManager, s *mcclient.ClientSession, args *EventListOptions) error {
func DoEventList(man modulebase.ResourceManager, s *mcclient.ClientSession, args *EventListOptions) error {
params := jsonutils.NewDict()
if len(args.Type) > 0 {
params.Add(jsonutils.NewStringArray(args.Type), "obj_type")
@@ -190,16 +185,6 @@ func init() {
return doComputeEventList(s, &nargs)
})
R(&TypeEventListOptions{}, "kubecluster-event", "Show operation event logs of kubernetes cluster", func(s *mcclient.ClientSession, args *TypeEventListOptions) error {
nargs := EventListOptions{BaseEventListOptions: args.BaseEventListOptions, Id: args.ID, Type: []string{"kubecluster"}}
return doK8sEventList(s, &nargs)
})
R(&TypeEventListOptions{}, "kubemachine-event", "Show operation event logs of kubernetes machine", func(s *mcclient.ClientSession, args *TypeEventListOptions) error {
nargs := EventListOptions{BaseEventListOptions: args.BaseEventListOptions, Id: args.ID, Type: []string{"kubemachine"}}
return doK8sEventList(s, &nargs)
})
R(&TypeEventListOptions{}, "image-event", "Show operation event logs of glance images", func(s *mcclient.ClientSession, args *TypeEventListOptions) error {
nargs := EventListOptions{BaseEventListOptions: args.BaseEventListOptions, Id: args.ID, Type: []string{"image"}}
return doImageEventList(s, &nargs)

View File

@@ -78,7 +78,7 @@ type ICreateOpt interface {
IOpt
}
func (cmd ResourceCmd) runWithDesc(action, desc string, args interface{}, callback interface{}) {
func (cmd ResourceCmd) RunWithDesc(action, desc string, args interface{}, callback interface{}) {
man := cmd.manager
prefix := cmd.prefix
if prefix != "" {
@@ -98,8 +98,8 @@ func (cmd ResourceCmd) runWithDesc(action, desc string, args interface{}, callba
R(args, fmt.Sprintf("%s%s-%s", prefix, cmd.keyword, action), desc, callback)
}
func (cmd ResourceCmd) run(action string, args interface{}, callback interface{}) {
cmd.runWithDesc(action, "", args, callback)
func (cmd ResourceCmd) Run(action string, args interface{}, callback interface{}) {
cmd.RunWithDesc(action, "", args, callback)
}
func (cmd ResourceCmd) List(args IListOpt) {
@@ -130,7 +130,7 @@ func (cmd ResourceCmd) List(args IListOpt) {
printList(result, man.GetColumns(s))
return nil
}
cmd.run("list", args, callback)
cmd.Run("list", args, callback)
}
func (cmd ResourceCmd) Create(args ICreateOpt) {
@@ -147,7 +147,7 @@ func (cmd ResourceCmd) Create(args ICreateOpt) {
printObject(ret)
return nil
}
cmd.run("create", args, callback)
cmd.Run("create", args, callback)
}
type IIdOpt interface {
@@ -177,7 +177,24 @@ func (cmd ResourceCmd) Show(args IShowOpt) {
printObject(ret)
return nil
}
cmd.runWithDesc("show", fmt.Sprintf("Show details of a %s", man.GetKeyword()), args, callback)
cmd.RunWithDesc("show", fmt.Sprintf("Show details of a %s", man.GetKeyword()), args, callback)
}
func (cmd ResourceCmd) ClassShow(args IShowOpt) {
man := cmd.manager
callback := func(s *mcclient.ClientSession, args IShowOpt) error {
params, err := args.Params()
if err != nil {
return err
}
ret, err := man.(modulebase.Manager).Get(s, args.GetId(), params)
if err != nil {
return err
}
printObject(ret)
return nil
}
cmd.RunWithDesc(args.GetId(), fmt.Sprintf("Show %s of a %s", args.GetId(), man.GetKeyword()), args, callback)
}
type IGetActionOpt interface {
@@ -230,7 +247,7 @@ func (cmd ResourceCmd) Custom(action TCustomAction, funcname string, args IGetAc
}
return nil
}
cmd.runWithDesc(funcname, fmt.Sprintf("Get %s of a %s", funcname, man.GetKeyword()), args, callback)
cmd.RunWithDesc(funcname, fmt.Sprintf("Get %s of a %s", funcname, man.GetKeyword()), args, callback)
}
type IDeleteOpt interface {
@@ -252,7 +269,7 @@ func (cmd ResourceCmd) Delete(args IDeleteOpt) {
printObject(ret)
return nil
}
cmd.runWithDesc("delete", fmt.Sprintf("Delete %s", man.GetKeyword()), args, callback)
cmd.RunWithDesc("delete", fmt.Sprintf("Delete %s", man.GetKeyword()), args, callback)
}
type IWithDescOpt interface {
@@ -278,7 +295,7 @@ func (cmd ResourceCmd) Perform(action string, args IPerformOpt) {
printObject(ret)
return nil
}
cmd.run(action, args, callback)
cmd.Run(action, args, callback)
}
func (cmd ResourceCmd) PerformClass(action string, args IOpt) {
@@ -295,7 +312,7 @@ func (cmd ResourceCmd) PerformClass(action string, args IOpt) {
printObject(ret)
return nil
}
cmd.run(action, args, callback)
cmd.Run(action, args, callback)
}
type IBatchPerformOpt interface {
@@ -314,7 +331,7 @@ func (cmd ResourceCmd) BatchPerform(action string, args IBatchPerformOpt) {
printBatchResults(ret, man.GetColumns(s))
return nil
}
cmd.run(action, args, callback)
cmd.Run(action, args, callback)
}
type IGetOpt interface {
@@ -336,7 +353,7 @@ func (cmd ResourceCmd) Get(specific string, args IGetOpt) {
printObject(ret)
return nil
}
cmd.runWithDesc(specific, fmt.Sprintf("Get %s of a %s", specific, man.GetKeyword()), args, callback)
cmd.RunWithDesc(specific, fmt.Sprintf("Get %s of a %s", specific, man.GetKeyword()), args, callback)
}
type IUpdateOpt interface {
@@ -358,7 +375,7 @@ func (cmd ResourceCmd) Update(args IUpdateOpt) {
printObject(ret)
return nil
}
cmd.run("update", args, callback)
cmd.Run("update", args, callback)
}
type IMetadataOpt interface {
@@ -380,7 +397,7 @@ func (cmd ResourceCmd) GetMetadata(args IMetadataOpt) {
printObject(ret)
return nil
}
cmd.runWithDesc("metadata", fmt.Sprintf("Show metadata of a %s", man.GetKeyword()), args, callback)
cmd.RunWithDesc("metadata", fmt.Sprintf("Show metadata of a %s", man.GetKeyword()), args, callback)
}
type IBatchDeleteOpt interface {
@@ -399,7 +416,7 @@ func (cmd ResourceCmd) BatchDelete(args IBatchDeleteOpt) {
printBatchResults(ret, man.GetColumns(s))
return nil
}
cmd.run("delete", args, callback)
cmd.Run("delete", args, callback)
}
type IBatchDeleteWithParamOpt interface {
@@ -422,7 +439,7 @@ func (cmd ResourceCmd) BatchDeleteWithParam(args IBatchDeleteWithParamOpt) {
printBatchResults(ret, man.GetColumns(s))
return nil
}
cmd.run("delete", args, callback)
cmd.Run("delete", args, callback)
}
type IBatchPutOpt interface {
@@ -441,7 +458,7 @@ func (cmd ResourceCmd) BatchPut(args IBatchPutOpt) {
printBatchResults(ret, man.GetColumns(s))
return nil
}
cmd.run("update", args, callback)
cmd.Run("update", args, callback)
}
type JointCmd struct {
@@ -481,7 +498,7 @@ func (cmd JointCmd) List(args IJointListOpt) {
printList(result, man.GetColumns(s))
return nil
}
cmd.runWithDesc("list", fmt.Sprintf("list %s %s pairs", man.MasterManager().KeyString(), man.SlaveManager().KeyString()), args, callback)
cmd.RunWithDesc("list", fmt.Sprintf("list %s %s pairs", man.MasterManager().KeyString(), man.SlaveManager().KeyString()), args, callback)
}
type IJointShowOpt interface {
@@ -504,5 +521,5 @@ func (cmd JointCmd) Show(args IJointShowOpt) {
printObject(result)
return nil
}
cmd.run("show", args, callback)
cmd.Run("show", args, callback)
}

View File

@@ -23,20 +23,25 @@ import (
func init() {
type RoleAssignmentsOptions struct {
Effective bool `help:"Include role assignment of group members"`
System bool `help:"Include system user account"`
Policy bool `help:"Show matched policies"`
Domain string `help:"Role assignments for domain"`
User string `help:"For user"`
UserDomain string `help:"Domain for user"`
Group string `help:"For group"`
GroupDomain string `help:"Domain for group"`
Project string `help:"Role assignments for project"`
ProjectDomain string `help:"Domain for project"`
Role string `help:"Role assignments for role"`
RoleDomain string `help:"Domain for role"`
Limit int64 `help:"maximal returned number of rows"`
Offset int64 `help:"offset index of returned results"`
Effective bool `help:"Include role assignment of group members"`
System bool `help:"Include system user account"`
Policy bool `help:"Show matched policies"`
Domain string `help:"Role assignments for domain"`
User string `help:"For user"`
UserDomain string `help:"Domain for user"`
Group string `help:"For group"`
GroupDomain string `help:"Domain for group"`
Project string `help:"Role assignments for project"`
ProjectDomain string `help:"Domain for project"`
Role string `help:"Role assignments for role"`
RoleDomain string `help:"Domain for role"`
Limit int64 `help:"maximal returned number of rows"`
Offset int64 `help:"offset index of returned results"`
Users []string `help:"fitler by users id or name"`
Groups []string `help:"fitler by users id or name"`
Roles []string `help:"fitler by users id or name"`
Projects []string `help:"fitler by users id or name"`
Domains []string `help:"fitler by users id or name"`
}
R(&RoleAssignmentsOptions{}, "role-assignments", "List all role assignments", func(s *mcclient.ClientSession, args *RoleAssignmentsOptions) error {
query := jsonutils.NewDict()
@@ -85,6 +90,21 @@ func init() {
}
query.Add(jsonutils.NewString(rid), "role", "id")
}
if len(args.Users) > 0 {
query.Add(jsonutils.NewStringArray(args.Users), "users")
}
if len(args.Groups) > 0 {
query.Add(jsonutils.NewStringArray(args.Groups), "groups")
}
if len(args.Roles) > 0 {
query.Add(jsonutils.NewStringArray(args.Roles), "roles")
}
if len(args.Projects) > 0 {
query.Add(jsonutils.NewStringArray(args.Projects), "projects")
}
if len(args.Domains) > 0 {
query.Add(jsonutils.NewStringArray(args.Domains), "domains")
}
if args.Limit > 0 {
query.Add(jsonutils.NewInt(args.Limit), "limit")
}

View File

@@ -262,6 +262,8 @@ func init() {
// DefaultProject string `help:"Default project"`
// Option []string `help:"User options"`
SkipPasswordComplexityCheck bool `help:"skip_password_complexity_check"`
}
R(&UserUpdateOptions{}, "user-update", "Update a user", func(s *mcclient.ClientSession, args *UserUpdateOptions) error {
query := jsonutils.NewDict()
@@ -282,6 +284,9 @@ func init() {
}
if args.Password != nil {
params.Add(jsonutils.NewString(*args.Password), "password")
if args.SkipPasswordComplexityCheck {
params.Add(jsonutils.JSONTrue, "skip_password_complexity_check")
}
}
if len(args.Displayname) > 0 {
params.Add(jsonutils.NewString(args.Displayname), "displayname")

View File

@@ -15,27 +15,11 @@
package k8s
import (
"fmt"
"yunion.io/x/onecloud/pkg/mcclient"
"yunion.io/x/onecloud/pkg/mcclient/modules/k8s"
o "yunion.io/x/onecloud/pkg/mcclient/options/k8s"
)
func initKubeCerts() {
cmdN := func(action string) string {
return fmt.Sprintf("kubecert-%s", action)
}
R(&o.CertListOptions{}, cmdN("list"), "List k8s cluster certificates key pairs", func(s *mcclient.ClientSession, args *o.CertListOptions) error {
params, err := args.Params()
if err != nil {
return err
}
ret, err := k8s.KubeCerts.List(s, params)
if err != nil {
return err
}
printList(ret, k8s.KubeCerts.GetColumns(s))
return nil
})
cmd := NewK8sResourceCmd(k8s.KubeCerts)
cmd.List(new(o.CertListOptions))
}

View File

@@ -26,38 +26,24 @@ import (
func initKubeCluster() {
cmdN := func(action string) string {
return fmt.Sprintf("kubecluster-%s", action)
return fmt.Sprintf("k8s-cluster-%s", action)
}
R(&o.ClusterListOptions{}, cmdN("list"), "List k8s clusters", func(s *mcclient.ClientSession, args *o.ClusterListOptions) error {
result, err := k8s.KubeClusters.List(s, args.Params())
if err != nil {
return err
}
printList(result, k8s.KubeClusters.GetColumns(s))
return nil
})
R(&o.IdentOptions{}, cmdN("show"), "Show details of a cluster", func(s *mcclient.ClientSession, args *o.IdentOptions) error {
result, err := k8s.KubeClusters.Get(s, args.ID, nil)
if err != nil {
return err
}
printObject(result)
return nil
})
R(&o.KubeClusterCreateOptions{}, cmdN("create"), "Create k8s cluster", func(s *mcclient.ClientSession, args *o.KubeClusterCreateOptions) error {
params, err := args.Params()
if err != nil {
return err
}
cluster, err := k8s.KubeClusters.Create(s, params)
if err != nil {
return err
}
printObject(cluster)
return nil
})
cmd := NewK8sResourceCmd(k8s.KubeClusters)
cmd.SetKeyword("cluster")
cmd.ShowEvent()
cmd.List(new(o.ClusterListOptions))
cmd.Show(new(o.IdentOptions))
cmd.Create(new(o.KubeClusterCreateOptions))
cmd.Perform("sync", new(o.ClusterSyncOptions))
cmd.Perform("syncstatus", new(o.IdentOptions))
cmd.Get("components-status", new(o.IdentOptions))
cmd.Get("api-resources", new(o.IdentOptions))
cmd.Get("cluster-users", new(o.IdentOptions))
cmd.Get("cluster-user-groups", new(o.IdentOptions))
cmd.Perform("purge", new(o.ClusterPurgeOptions))
cmd.Perform("delete-machines", new(o.KubeClusterDeleteMachinesOptions))
cmd.Perform("add-machines", new(o.KubeClusterAddMachinesOptions))
cmd.PerformClass("gc", new(o.ClusterGCOpts))
R(&o.KubeClusterImportOptions{}, cmdN("import"), "Import k8s cluster", func(s *mcclient.ClientSession, args *o.KubeClusterImportOptions) error {
params, err := args.Params()
@@ -78,41 +64,6 @@ func initKubeCluster() {
return nil
})
R(&o.KubeClusterAddMachinesOptions{}, cmdN("add-machines"), "Add machines to cluster", func(s *mcclient.ClientSession, args *o.KubeClusterAddMachinesOptions) error {
params, err := args.Params()
if err != nil {
return err
}
ret, err := k8s.KubeClusters.PerformAction(s, args.ID, "add-machines", params)
if err != nil {
return err
}
printObject(ret)
return nil
})
R(&o.KubeClusterDeleteMachinesOptions{}, cmdN("delete-machines"), "Delete machines in cluster", func(s *mcclient.ClientSession, args *o.KubeClusterDeleteMachinesOptions) error {
params, err := args.Params()
if err != nil {
return err
}
ret, err := k8s.KubeClusters.PerformAction(s, args.ID, "delete-machines", params)
if err != nil {
return err
}
printObject(ret)
return nil
})
R(&o.IdentOptions{}, cmdN("terminate"), "Terminate cluster", func(s *mcclient.ClientSession, args *o.IdentOptions) error {
ret, err := k8s.KubeClusters.PerformAction(s, args.ID, "terminate", nil)
if err != nil {
return err
}
printObject(ret)
return nil
})
R(&o.IdentOptions{}, cmdN("kubeconfig"), "Generate kubeconfig of a cluster", func(s *mcclient.ClientSession, args *o.IdentOptions) error {
ret, err := k8s.KubeClusters.GetSpecific(s, args.ID, "kubeconfig", nil)
if err != nil {
@@ -179,55 +130,6 @@ func initKubeCluster() {
return nil
})
R(&o.IdentOptions{}, cmdN("syncstatus"), "Sync cluster status", func(s *mcclient.ClientSession, args *o.IdentOptions) error {
ret, err := k8s.KubeClusters.PerformAction(s, args.ID, "syncstatus", nil)
if err != nil {
return err
}
printObject(ret)
return nil
})
R(&o.ClusterSyncOptions{}, cmdN("sync"), "Sync cluster k8s resources", func(s *mcclient.ClientSession, args *o.ClusterSyncOptions) error {
param, err := args.Params()
if err != nil {
return err
}
ret, err := k8s.KubeClusters.PerformAction(s, args.ID, "sync", param)
if err != nil {
return err
}
printObject(ret)
return nil
})
R(&o.IdentOptions{}, cmdN("public"), "Make cluster public", func(s *mcclient.ClientSession, args *o.IdentOptions) error {
ret, err := k8s.KubeClusters.PerformAction(s, args.ID, "public", nil)
if err != nil {
return err
}
printObject(ret)
return nil
})
R(&o.IdentOptions{}, cmdN("private"), "Make cluster private", func(s *mcclient.ClientSession, args *o.IdentOptions) error {
ret, err := k8s.KubeClusters.PerformAction(s, args.ID, "private", nil)
if err != nil {
return err
}
printObject(ret)
return nil
})
R(&o.IdentOptions{}, cmdN("components-status"), "Get cluster component status", func(s *mcclient.ClientSession, args *o.IdentOptions) error {
ret, err := k8s.KubeClusters.GetSpecific(s, args.ID, "components-status", nil)
if err != nil {
return err
}
printObject(ret)
return nil
})
R(&o.ClusterComponentTypeOptions{}, cmdN("component-setting"), "Get cluster component setting", func(s *mcclient.ClientSession, args *o.ClusterComponentTypeOptions) error {
q := jsonutils.NewDict()
q.Add(jsonutils.NewString(args.TYPE), "type")

View File

@@ -16,8 +16,11 @@ package k8s
import (
"yunion.io/x/onecloud/pkg/mcclient/modules/k8s"
o "yunion.io/x/onecloud/pkg/mcclient/options/k8s"
)
func initConfigMap() {
initK8sNamespaceResource("configmap", k8s.ConfigMaps)
cmd := NewK8sResourceCmd(k8s.ConfigMaps)
cmd.Create(&o.ConfigMapCreateOptions{})
}

View File

@@ -15,30 +15,11 @@
package k8s
import (
"yunion.io/x/onecloud/pkg/mcclient"
"yunion.io/x/onecloud/pkg/mcclient/modules/k8s"
o "yunion.io/x/onecloud/pkg/mcclient/options/k8s"
)
func initCronJob() {
cmd := initK8sNamespaceResource("cronjob", k8s.CronJobs)
cmdN := cmd.CommandNameFactory
createCmd := NewCommand(
&o.CronJobCreateOptions{},
cmdN("create"),
"Create cronjob resource",
func(s *mcclient.ClientSession, args *o.CronJobCreateOptions) error {
params, err := args.Params()
if err != nil {
return err
}
ret, err := k8s.CronJobs.Create(s, params)
if err != nil {
return err
}
printObject(ret)
return nil
})
cmd.AddR(createCmd)
cmd.Create(new(o.CronJobCreateOptions))
}

View File

@@ -15,48 +15,12 @@
package k8s
import (
"yunion.io/x/onecloud/pkg/mcclient"
"yunion.io/x/onecloud/pkg/mcclient/modules/k8s"
o "yunion.io/x/onecloud/pkg/mcclient/options/k8s"
)
func initDeployment() {
cmd := initK8sNamespaceResource("deployment", k8s.Deployments)
cmdN := cmd.CommandNameFactory
createCmd := NewCommand(
&o.DeploymentCreateOptions{},
cmdN("create"),
"Create deployment resource",
func(s *mcclient.ClientSession, args *o.DeploymentCreateOptions) error {
params, err := args.Params()
if err != nil {
return err
}
ret, err := k8s.Deployments.Create(s, params)
if err != nil {
return err
}
printObject(ret)
return nil
})
updateCmd := NewCommand(
&o.DeploymentUpdateOptions{},
cmdN("update"),
"Update deployment resource",
func(s *mcclient.ClientSession, args *o.DeploymentUpdateOptions) error {
params, err := args.Params()
if err != nil {
return err
}
ret, err := k8s.Deployments.Update(s, args.NAME, params)
if err != nil {
return err
}
printObjectYAML(ret)
return nil
})
cmd.AddR(createCmd, updateCmd)
cmd.Create(new(o.DeploymentCreateOptions))
cmd.Update(new(o.DeploymentUpdateOptions))
}

View File

@@ -0,0 +1,37 @@
// 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 k8s
import (
"yunion.io/x/onecloud/pkg/mcclient/modules/k8s"
options "yunion.io/x/onecloud/pkg/mcclient/options/k8s"
)
func init() {
cmd := newFedResourceCmd(k8s.FederatedClusterRoles)
cmd.Create(new(options.FedClusterRoleCreateOptions)).
List(new(options.FedResourceListOptions)).
Show(new(options.IdentOptions)).
Delete(new(options.IdentOptions)).
AttachCluster(new(options.FedResourceJointClusterAttachOptions)).
DetachCluster(new(options.FedResourceJointClusterDetachOptions)).
SyncCluster(new(options.FedResourceJointClusterDetachOptions)).
Sync(new(options.FedResourceIdOptions)).
ShowEvent()
cmd.ClassShow(new(options.FedApiResourecesOptions))
cmd.ClassShow(new(options.FedClusterUsersOptions))
cmd.ClassShow(new(options.FedClusterUserGroupsOptions))
}

View File

@@ -0,0 +1,27 @@
// 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 k8s
import (
"yunion.io/x/onecloud/pkg/mcclient/modules/k8s"
options "yunion.io/x/onecloud/pkg/mcclient/options/k8s"
)
func init() {
cmd := NewK8sJointCmd(&k8s.FederatedClusterRoleClusters)
cmd.List(new(options.FedJointClusterBaseListOptions))
cmd.Show(new(options.FedResourceJointClusterShowOptions))
}

View File

@@ -0,0 +1,33 @@
// 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 k8s
import (
"yunion.io/x/onecloud/pkg/mcclient/modules/k8s"
options "yunion.io/x/onecloud/pkg/mcclient/options/k8s"
)
func init() {
cmd := newFedResourceCmd(k8s.FederatedClusterRoleBindings)
cmd.Create(new(options.FedClusterRoleBindingCreatOpt)).
List(new(options.FedResourceListOptions)).
Show(new(options.IdentOptions)).
Delete(new(options.IdentOptions)).
AttachCluster(new(options.FedResourceJointClusterAttachOptions)).
DetachCluster(new(options.FedResourceJointClusterDetachOptions)).
SyncCluster(new(options.FedResourceJointClusterDetachOptions)).
Sync(new(options.FedResourceIdOptions)).
ShowEvent()
}

View File

@@ -0,0 +1,71 @@
// 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 k8s
import (
"yunion.io/x/onecloud/cmd/climc/shell"
"yunion.io/x/onecloud/pkg/mcclient/modulebase"
)
type fedResourceCmd struct {
*K8sResourceCmd
}
func newFedResourceCmd(manager modulebase.IBaseManager) *fedResourceCmd {
cmd := NewK8sResourceCmd(manager)
return &fedResourceCmd{
K8sResourceCmd: cmd,
}
}
func (c *fedResourceCmd) List(args shell.IListOpt) *fedResourceCmd {
c.K8sResourceCmd.List(args)
return c
}
func (c *fedResourceCmd) Show(args shell.IShowOpt) *fedResourceCmd {
c.K8sResourceCmd.Show(args)
return c
}
func (c *fedResourceCmd) Create(args shell.ICreateOpt) *fedResourceCmd {
c.K8sResourceCmd.Create(args)
return c
}
func (c *fedResourceCmd) Delete(args shell.IDeleteOpt) *fedResourceCmd {
c.K8sResourceCmd.Delete(args)
return c
}
func (c *fedResourceCmd) AttachCluster(args shell.IPerformOpt) *fedResourceCmd {
c.K8sResourceCmd.Perform("attach-cluster", args)
return c
}
func (c *fedResourceCmd) DetachCluster(args shell.IPerformOpt) *fedResourceCmd {
c.K8sResourceCmd.Perform("detach-cluster", args)
return c
}
func (c *fedResourceCmd) SyncCluster(args shell.IPerformOpt) *fedResourceCmd {
c.K8sResourceCmd.Perform("sync-cluster", args)
return c
}
func (c *fedResourceCmd) Sync(args shell.IPerformOpt) *fedResourceCmd {
c.K8sResourceCmd.Perform("sync", args)
return c
}

View File

@@ -0,0 +1,34 @@
// 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 k8s
import (
"yunion.io/x/onecloud/pkg/mcclient/modules/k8s"
options "yunion.io/x/onecloud/pkg/mcclient/options/k8s"
)
func init() {
cmd := newFedResourceCmd(k8s.FederatedNamespaces)
cmd.List(new(options.FedNamespaceListOptions)).
Show(new(options.IdentOptions)).
Create(new(options.FedNamespaceCreateOptions)).
Delete(new(options.IdentOptions)).
AttachCluster(new(options.FedResourceJointClusterAttachOptions)).
DetachCluster(new(options.FedResourceJointClusterDetachOptions)).
SyncCluster(new(options.FedResourceJointClusterDetachOptions)).
Sync(new(options.IdentOptions)).
ShowEvent()
}

View File

@@ -0,0 +1,27 @@
// 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 k8s
import (
"yunion.io/x/onecloud/pkg/mcclient/modules/k8s"
options "yunion.io/x/onecloud/pkg/mcclient/options/k8s"
)
func init() {
cmd := NewK8sJointCmd(&k8s.FederatedNamespaceClusters)
cmd.List(new(options.FedNamespaceClusterListOptions))
cmd.Show(new(options.FedResourceJointClusterShowOptions))
}

View File

@@ -0,0 +1,37 @@
// 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 k8s
import (
"yunion.io/x/onecloud/pkg/mcclient/modules/k8s"
options "yunion.io/x/onecloud/pkg/mcclient/options/k8s"
)
func init() {
cmd := newFedResourceCmd(k8s.FederatedRoles)
cmd.Create(new(options.FedRoleCreateOptions)).
List(new(options.FedRoleListOptions)).
Show(new(options.IdentOptions)).
Delete(new(options.IdentOptions)).
AttachCluster(new(options.FedResourceJointClusterAttachOptions)).
DetachCluster(new(options.FedResourceJointClusterDetachOptions)).
SyncCluster(new(options.FedResourceJointClusterDetachOptions)).
Sync(new(options.IdentOptions)).
ShowEvent()
cmd.ClassShow(new(options.FedApiResourecesOptions))
cmd.ClassShow(new(options.FedClusterUsersOptions))
cmd.ClassShow(new(options.FedClusterUserGroupsOptions))
}

View File

@@ -0,0 +1,27 @@
// 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 k8s
import (
"yunion.io/x/onecloud/pkg/mcclient/modules/k8s"
options "yunion.io/x/onecloud/pkg/mcclient/options/k8s"
)
func init() {
cmd := NewK8sJointCmd(&k8s.FederatedRoleClusters)
cmd.List(new(options.FedNamespaceJointClusterListOpt))
cmd.Show(new(options.FedResourceJointClusterShowOptions))
}

View File

@@ -0,0 +1,34 @@
// 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 k8s
import (
"yunion.io/x/onecloud/pkg/mcclient/modules/k8s"
options "yunion.io/x/onecloud/pkg/mcclient/options/k8s"
)
func init() {
cmd := newFedResourceCmd(k8s.FederatedRoleBindings)
cmd.Create(new(options.FedRoleBindingCreateOpt)).
List(new(options.FedNamespaceResourceListOptions)).
Show(new(options.IdentOptions)).
Delete(new(options.IdentOptions)).
AttachCluster(new(options.FedResourceJointClusterAttachOptions)).
DetachCluster(new(options.FedResourceJointClusterDetachOptions)).
SyncCluster(new(options.FedResourceJointClusterDetachOptions)).
Sync(new(options.IdentOptions)).
ShowEvent()
}

View File

@@ -0,0 +1,136 @@
// 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 k8s
import (
"fmt"
"io/ioutil"
"os"
"os/exec"
"github.com/ghodss/yaml"
"yunion.io/x/jsonutils"
"yunion.io/x/onecloud/cmd/climc/shell"
"yunion.io/x/onecloud/cmd/climc/shell/events"
"yunion.io/x/onecloud/pkg/mcclient"
"yunion.io/x/onecloud/pkg/mcclient/modulebase"
"yunion.io/x/onecloud/pkg/mcclient/modules/k8s"
)
type K8sResourceCmd struct {
*shell.ResourceCmd
manager modulebase.IBaseManager
}
func NewK8sResourceCmd(manager modulebase.IBaseManager) *K8sResourceCmd {
cmd := new(K8sResourceCmd)
cmd.ResourceCmd = shell.NewResourceCmd(manager).SetPrefix("k8s")
cmd.manager = manager
return cmd
}
func (cmd *K8sResourceCmd) GetClusterResManager() k8s.IClusterResourceManager {
return cmd.manager.(k8s.IClusterResourceManager)
}
func (cmd *K8sResourceCmd) ShowEvent() *K8sResourceCmd {
callback := func(s *mcclient.ClientSession, opt *events.TypeEventListOptions) error {
args := &events.EventListOptions{BaseEventListOptions: opt.BaseEventListOptions, Id: opt.ID, Type: []string{cmd.manager.GetKeyword()}}
return events.DoEventList(*k8s.Logs.ResourceManager, s, args)
}
cmd.RunWithDesc("event", fmt.Sprintf("Show operation event logs of k8s %s", cmd.manager.GetKeyword()), new(events.TypeEventListOptions), callback)
return cmd
}
func (cmd *K8sResourceCmd) EditRaw(opt shell.IGetOpt) *K8sResourceCmd {
man := cmd.GetClusterResManager()
callback := func(s *mcclient.ClientSession, args shell.IGetOpt) error {
params, err := opt.Params()
if err != nil {
return err
}
rawData, err := man.GetRaw(s, args.GetId(), params.(*jsonutils.JSONDict))
if err != nil {
return err
}
yamlBytes := rawData.YAMLString()
tempfile, err := ioutil.TempFile("", fmt.Sprintf("k8s-%s*.yaml", args.GetId()))
if err != nil {
return err
}
defer os.Remove(tempfile.Name())
if _, err := tempfile.Write([]byte(yamlBytes)); err != nil {
return err
}
if err := tempfile.Close(); err != nil {
return err
}
cmd := exec.Command("vim", tempfile.Name())
cmd.Stdin = os.Stdin
cmd.Stdout = os.Stdout
if err := cmd.Run(); err != nil {
return err
}
content, err := ioutil.ReadFile(tempfile.Name())
if err != nil {
return err
}
jsonBytes, err := yaml.YAMLToJSON(content)
if err != nil {
return err
}
body, err := jsonutils.Parse(jsonBytes)
if err != nil {
return err
}
params, err = args.Params()
if err != nil {
return err
}
if _, err := man.UpdateRaw(s, args.GetId(), params.(*jsonutils.JSONDict), body.(*jsonutils.JSONDict)); err != nil {
return err
}
return nil
}
cmd.RunWithDesc("edit-raw", fmt.Sprintf("Edit and update k8s %s by raw data", man.GetKeyword()), opt, callback)
return cmd
}
func (cmd *K8sResourceCmd) ShowRaw(args shell.IGetOpt) *K8sResourceCmd {
man := cmd.GetClusterResManager()
callback := func(s *mcclient.ClientSession, args shell.IGetOpt) error {
params, err := args.Params()
if err != nil {
return err
}
ret, err := man.GetRaw(s, args.GetId(), params.(*jsonutils.JSONDict))
if err != nil {
return err
}
printObjectYAML(ret)
return nil
}
cmd.RunWithDesc("show-raw", fmt.Sprintf("Show k8s %s raw data", man.GetKeyword()), args, callback)
return cmd
}
func NewK8sJointCmd(manager modulebase.JointManager) *shell.JointCmd {
cmd := shell.NewJointCmd(manager)
cmd.SetPrefix("k8s")
return cmd
}

View File

@@ -15,25 +15,11 @@
package k8s
import (
"yunion.io/x/onecloud/pkg/mcclient"
"yunion.io/x/onecloud/pkg/mcclient/modules/k8s"
o "yunion.io/x/onecloud/pkg/mcclient/options/k8s"
)
func initIngress() {
cmdN := initK8sNamespaceResource("ingress", k8s.Ingresses)
createCmd := NewCommand(
&o.IngressCreateOptions{},
cmdN.CommandNameFactory("create"),
"Create ingress rules to service",
func(s *mcclient.ClientSession, args *o.IngressCreateOptions) error {
spec := args.Params()
ret, err := k8s.Ingresses.Create(s, spec)
if err != nil {
return err
}
printObject(ret)
return nil
})
cmdN.AddR(createCmd)
cmd := initK8sNamespaceResource("ingress", k8s.Ingresses)
cmd.Create(new(o.IngressCreateOptions))
}

View File

@@ -15,31 +15,12 @@
package k8s
import (
"yunion.io/x/onecloud/pkg/mcclient"
"yunion.io/x/onecloud/pkg/mcclient/modules/k8s"
o "yunion.io/x/onecloud/pkg/mcclient/options/k8s"
)
func initJob() {
cmd := initK8sNamespaceResource("job", k8s.Jobs)
cmdN := cmd.CommandNameFactory
createCmd := NewCommand(
&o.JobCreateOptions{},
cmdN("create"),
"Create job resource",
func(s *mcclient.ClientSession, args *o.JobCreateOptions) error {
params, err := args.Params()
if err != nil {
return err
}
ret, err := k8s.Jobs.Create(s, params)
if err != nil {
return err
}
printObject(ret)
return nil
})
cmd.AddR(createCmd)
cmd.Create(new(o.JobCreateOptions))
}

View File

@@ -16,16 +16,10 @@ package k8s
import (
"fmt"
"io/ioutil"
"os"
"os/exec"
"github.com/ghodss/yaml"
"yunion.io/x/jsonutils"
"yunion.io/x/onecloud/cmd/climc/shell"
"yunion.io/x/onecloud/pkg/mcclient"
"yunion.io/x/onecloud/pkg/mcclient/modulebase"
"yunion.io/x/onecloud/pkg/mcclient/modules/k8s"
o "yunion.io/x/onecloud/pkg/mcclient/options/k8s"
@@ -78,10 +72,6 @@ func resourceCmdN(prefix, suffix string) string {
return fmt.Sprintf("k8s-%s-%s", prefix, suffix)
}
func kubeResourceCmdN(prefix, suffix string) string {
return fmt.Sprintf("kube-%s-%s", prefix, suffix)
}
func clusterContext(clusterId string) modulebase.ManagerContext {
return modulebase.ManagerContext{
InstanceManager: k8s.KubeClusters,
@@ -93,241 +83,24 @@ func printObjectYAML(obj jsonutils.JSONObject) {
fmt.Println(obj.YAMLString())
}
type Cmd struct {
Options interface{}
Command string
Desc string
Callback interface{}
func initK8sClusterResource(kind string, manager modulebase.Manager) *K8sResourceCmd {
cmd := NewK8sResourceCmd(manager)
cmd.SetKeyword(kind)
cmd.List(new(o.ResourceListOptions))
cmd.Show(new(o.ResourceGetOptions))
cmd.BatchDeleteWithParam(new(o.ResourceDeleteOptions))
cmd.ShowEvent()
return cmd
}
func NewCommand(options interface{}, command string, desc string, callback interface{}) *Cmd {
return &Cmd{
Options: options,
Command: command,
Desc: desc,
Callback: callback,
}
}
func (c Cmd) R() {
R(c.Options, c.Command, c.Desc, c.Callback)
}
type ShellCommands struct {
Commands []*Cmd
CommandNameFactory func(suffix string) string
}
func NewShellCommands(cmdN func(suffix string) string) *ShellCommands {
c := &ShellCommands{
CommandNameFactory: cmdN,
}
c.Commands = make([]*Cmd, 0)
return c
}
func (c *ShellCommands) AddR(rs ...*Cmd) *ShellCommands {
for _, r := range rs {
r.R()
c.Commands = append(c.Commands, r)
}
return c
}
func initK8sClusterResource(kind string, manager modulebase.Manager) *ShellCommands {
cmdN := NewCmdNameFactory(kind)
return NewShellCommands(cmdN.Do).AddR(
NewK8sResourceListCmd(cmdN, manager),
NewK8sResourceGetCmd(cmdN, manager),
NewK8sResourceDeleteCmd(cmdN, manager),
)
}
func NewK8sResourceListCmd(cmdN CmdNameFactory, manager modulebase.Manager) *Cmd {
return NewCommand(
&o.ResourceListOptions{},
cmdN.Do("list"),
fmt.Sprintf("List k8s %s", cmdN.Kind),
func(s *mcclient.ClientSession, args *o.ResourceListOptions) error {
params, err := args.Params()
if err != nil {
return err
}
ret, err := manager.List(s, params)
if err != nil {
return err
}
PrintListResultTable(ret, manager.(k8s.ListPrinter), s)
return nil
},
)
}
type CmdNameFactory struct {
Kind string
Do func(string) string
}
func NewCmdNameFactory(kind string) CmdNameFactory {
return CmdNameFactory{
Kind: kind,
Do: func(suffix string) string {
return resourceCmdN(kind, suffix)
},
}
}
func NewK8sNsResourceListCmd(cmdN CmdNameFactory, manager modulebase.Manager) *Cmd {
return NewCommand(
&o.NamespaceResourceListOptions{},
cmdN.Do("list"),
fmt.Sprintf("List k8s %s", cmdN.Kind),
func(s *mcclient.ClientSession, args *o.NamespaceResourceListOptions) error {
params, err := args.Params()
if err != nil {
return err
}
ret, err := manager.List(s, params)
if err != nil {
return err
}
PrintListResultTable(ret, manager.(k8s.ListPrinter), s)
return nil
},
)
}
func NewK8sResourceGetCmd(cmdN CmdNameFactory, manager modulebase.Manager) *Cmd {
return NewCommand(
&o.ResourceGetOptions{},
cmdN.Do("show"),
fmt.Sprintf("Show k8s %s", cmdN.Kind),
func(s *mcclient.ClientSession, args *o.ResourceGetOptions) error {
ret, err := manager.Get(s, args.NAME, args.Params())
if err != nil {
return err
}
printObjectYAML(ret)
return nil
},
)
}
func NewK8sNsResourceGetCmd(cmdN CmdNameFactory, manager modulebase.Manager) *Cmd {
return NewCommand(
&o.NamespaceResourceGetOptions{},
cmdN.Do("show"),
fmt.Sprintf("Show k8s %s", cmdN.Kind),
func(s *mcclient.ClientSession, args *o.NamespaceResourceGetOptions) error {
ret, err := manager.Get(s, args.NAME, args.Params())
if err != nil {
return err
}
printObjectYAML(ret)
return nil
},
)
}
func NewK8sNsResourceGetRawCmd(cmdN CmdNameFactory, manager k8s.IClusterResourceManager) *Cmd {
return NewCommand(
&o.NamespaceResourceGetOptions{},
cmdN.Do("show-raw"),
fmt.Sprintf("Show k8s %s raw data", cmdN.Kind),
func(s *mcclient.ClientSession, args *o.NamespaceResourceGetOptions) error {
ret, err := manager.GetRaw(s, args.NAME, args.Params())
if err != nil {
return err
}
printObjectYAML(ret)
return nil
},
)
}
func NewK8sResourceEditRawCmd(cmdN CmdNameFactory, manager k8s.IClusterResourceManager) *Cmd {
return NewCommand(
&o.NamespaceResourceGetOptions{},
cmdN.Do("edit-raw"),
fmt.Sprintf("Edit and update k8s %s raw data", cmdN.Kind),
func(s *mcclient.ClientSession, args *o.NamespaceResourceGetOptions) error {
rawData, err := manager.GetRaw(s, args.NAME, args.Params())
if err != nil {
return err
}
yamlBytes := rawData.YAMLString()
tempfile, err := ioutil.TempFile("", fmt.Sprintf("k8s-%s-%s*.yaml", cmdN.Kind, args.NAME))
if err != nil {
return err
}
defer os.Remove(tempfile.Name())
if _, err := tempfile.Write([]byte(yamlBytes)); err != nil {
return err
}
if err := tempfile.Close(); err != nil {
return err
}
cmd := exec.Command("vim", tempfile.Name())
cmd.Stdin = os.Stdin
cmd.Stdout = os.Stdout
if err := cmd.Run(); err != nil {
return err
}
content, err := ioutil.ReadFile(tempfile.Name())
if err != nil {
return err
}
jsonBytes, err := yaml.YAMLToJSON(content)
if err != nil {
return err
}
body, err := jsonutils.Parse(jsonBytes)
if err != nil {
return err
}
if _, err := manager.UpdateRaw(s, args.NAME, args.Params(), body.(*jsonutils.JSONDict)); err != nil {
return err
}
return nil
},
)
}
func NewK8sResourceDeleteCmd(cmdN CmdNameFactory, manager modulebase.Manager) *Cmd {
return NewCommand(
&o.ResourceDeleteOptions{},
cmdN.Do("delete"),
fmt.Sprintf("Delete k8s %s", cmdN.Kind),
func(s *mcclient.ClientSession, args *o.ResourceDeleteOptions) error {
ret := manager.BatchDelete(s, args.NAME, args.Params())
printBatchResults(ret, manager.GetColumns(s))
return nil
},
)
}
func NewK8sNsResourceDeleteCmd(cmdN CmdNameFactory, manager modulebase.Manager) *Cmd {
deleteCmd := NewCommand(
&o.NamespaceResourceDeleteOptions{},
cmdN.Do("delete"),
fmt.Sprintf("Delete k8s %s", cmdN.Kind),
func(s *mcclient.ClientSession, args *o.NamespaceResourceDeleteOptions) error {
ret := manager.BatchDelete(s, args.NAME, args.Params())
printBatchResults(ret, manager.GetColumns(s))
return nil
},
)
return deleteCmd
}
func initK8sNamespaceResource(kind string, manager k8s.IClusterResourceManager) *ShellCommands {
cmdN := NewCmdNameFactory(kind)
return NewShellCommands(cmdN.Do).AddR(
NewK8sNsResourceListCmd(cmdN, manager),
NewK8sNsResourceGetCmd(cmdN, manager),
NewK8sNsResourceDeleteCmd(cmdN, manager),
NewK8sNsResourceGetRawCmd(cmdN, manager),
NewK8sResourceEditRawCmd(cmdN, manager),
)
func initK8sNamespaceResource(kind string, manager k8s.IClusterResourceManager) *K8sResourceCmd {
cmd := NewK8sResourceCmd(manager)
cmd.SetKeyword(kind)
cmd.List(new(o.NamespaceResourceListOptions))
cmd.Show(new(o.NamespaceResourceGetOptions))
cmd.BatchDeleteWithParam(new(o.NamespaceResourceDeleteOptions))
cmd.ShowRaw(new(o.NamespaceResourceGetOptions))
cmd.EditRaw(new(o.NamespaceResourceGetOptions))
cmd.ShowEvent()
return cmd
}

View File

@@ -15,73 +15,18 @@
package k8s
import (
"fmt"
"yunion.io/x/onecloud/pkg/mcclient"
"yunion.io/x/onecloud/pkg/mcclient/modules/k8s"
o "yunion.io/x/onecloud/pkg/mcclient/options/k8s"
)
func initKubeMachine() {
cmdN := func(action string) string {
return fmt.Sprintf("kubemachine-%s", action)
}
R(&o.MachineListOptions{}, cmdN("list"), "List k8s node machines", func(s *mcclient.ClientSession, args *o.MachineListOptions) error {
params, err := args.Params()
if err != nil {
return err
}
result, err := k8s.KubeMachines.List(s, params)
if err != nil {
return err
}
printList(result, k8s.KubeMachines.GetColumns(s))
return nil
})
R(&o.MachineCreateOptions{}, cmdN("create"), "Create k8s machine", func(s *mcclient.ClientSession, args *o.MachineCreateOptions) error {
params, err := args.Params()
if err != nil {
return err
}
node, err := k8s.KubeMachines.Create(s, params)
if err != nil {
return err
}
printObject(node)
return nil
})
R(&o.IdentOptions{}, cmdN("show"), "Show details of a machine", func(s *mcclient.ClientSession, args *o.IdentOptions) error {
result, err := k8s.KubeMachines.Get(s, args.ID, nil)
if err != nil {
return err
}
printObject(result)
return nil
})
R(&o.IdentsOptions{}, cmdN("delete"), "Delete machine", func(s *mcclient.ClientSession, args *o.IdentsOptions) error {
ret := k8s.KubeMachines.BatchDelete(s, args.ID, nil)
printBatchResults(ret, k8s.KubeMachines.GetColumns(s))
return nil
})
R(&o.IdentOptions{}, cmdN("recreate"), "Re-Create machine when create fail", func(s *mcclient.ClientSession, args *o.IdentOptions) error {
ret, err := k8s.KubeMachines.PerformAction(s, args.ID, "recreate", nil)
if err != nil {
return err
}
printObject(ret)
return nil
})
R(&o.IdentOptions{}, cmdN("terminate"), "Terminate a machine", func(s *mcclient.ClientSession, args *o.IdentOptions) error {
ret, err := k8s.KubeMachines.PerformAction(s, args.ID, "terminate", nil)
if err != nil {
return err
}
printObject(ret)
return nil
})
cmd := NewK8sResourceCmd(k8s.KubeMachines)
cmd.SetKeyword("machine")
cmd.ShowEvent()
cmd.List(new(o.MachineListOptions))
cmd.Create(new(o.MachineCreateOptions))
cmd.Show(new(o.IdentOptions))
cmd.BatchDelete(new(o.IdentsOptions))
cmd.Perform("recreate", new(o.IdentOptions))
cmd.Perform("terminate", new(o.IdentOptions))
}

View File

@@ -16,8 +16,12 @@ package k8s
import (
"yunion.io/x/onecloud/pkg/mcclient/modules/k8s"
options "yunion.io/x/onecloud/pkg/mcclient/options/k8s"
)
func initNamespace() {
initK8sClusterResource("namespace", k8s.Namespaces)
cmd := NewK8sResourceCmd(k8s.Namespaces)
cmd.Create(new(options.NamespaceCreateOptions))
}

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