Merge branch 'master' into feature/implement-vm-rescue

This commit is contained in:
Bo
2023-10-27 19:29:02 +08:00
1117 changed files with 71229 additions and 244183 deletions
-233
View File
@@ -1,233 +0,0 @@
name: Docker image
on:
push:
branches:
- master
- releases/*
#paths:
#- 'cmd/*'
#- 'pkg/*'
#- 'vendor/*'
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.16
uses: actions/setup-go@v1
with:
go-version: 1.16
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@v1
- name: Build
run: |
sudo apt-get update
sudo apt-get install librados-dev librbd-dev # baremetal-agent needs this
make cmd/baremetal-agent && ./scripts/bundle_libraries.sh _output/bin/bundles/baremetal-agent _output/bin/baremetal-agent
make docker-alpine-build F='-j4 cmd/host cmd/vpcagent cmd/region-dns make cmd/apigateway cmd/climc cmd/keystone make cmd/logger cmd/region cmd/scheduler cmd/webconsole make cmd/yunionconf cmd/glance cmd/torrent cmd/s3gateway make cmd/ansibleserver cmd/cloudnet cmd/notify make cmd/host-deployer make cmd/cloudevent cmd/devtool cmd/cloudid make cmd/*cli make cmd/esxi-agent'
- name: Image region
uses: elgohr/Publish-Docker-Github-Action@master
with:
name: registry.cn-beijing.aliyuncs.com/yunionio/region
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
registry: registry.cn-beijing.aliyuncs.com
snapshot: true
dockerfile: build/docker/Dockerfile.region
- name: Image host
uses: elgohr/Publish-Docker-Github-Action@master
with:
name: registry.cn-beijing.aliyuncs.com/yunionio/host
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
registry: registry.cn-beijing.aliyuncs.com
snapshot: true
dockerfile: build/docker/Dockerfile.host
- name: Image host-deployer
uses: elgohr/Publish-Docker-Github-Action@master
with:
name: registry.cn-beijing.aliyuncs.com/yunionio/host-deployer
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
registry: registry.cn-beijing.aliyuncs.com
snapshot: true
dockerfile: build/docker/Dockerfile.host-deployer
- name: Image baremetal-agent
uses: elgohr/Publish-Docker-Github-Action@master
with:
name: registry.cn-beijing.aliyuncs.com/yunionio/baremetal-agent
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
registry: registry.cn-beijing.aliyuncs.com
snapshot: true
dockerfile: build/docker/Dockerfile.baremetal-agent
- name: Image esxi-agent
uses: elgohr/Publish-Docker-Github-Action@master
with:
name: registry.cn-beijing.aliyuncs.com/yunionio/esxi-agent
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
registry: registry.cn-beijing.aliyuncs.com
snapshot: true
dockerfile: build/docker/Dockerfile.esxi-agent
- name: Image vpcagent
uses: elgohr/Publish-Docker-Github-Action@master
with:
name: registry.cn-beijing.aliyuncs.com/yunionio/vpcagent
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
registry: registry.cn-beijing.aliyuncs.com
snapshot: true
dockerfile: build/docker/Dockerfile.vpcagent
- name: Image climc
uses: elgohr/Publish-Docker-Github-Action@master
with:
name: registry.cn-beijing.aliyuncs.com/yunionio/climc
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
registry: registry.cn-beijing.aliyuncs.com
snapshot: true
dockerfile: build/docker/Dockerfile.climc
- name: Image keystone
uses: elgohr/Publish-Docker-Github-Action@master
with:
name: registry.cn-beijing.aliyuncs.com/yunionio/keystone
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
registry: registry.cn-beijing.aliyuncs.com
snapshot: true
dockerfile: build/docker/Dockerfile.keystone
- name: Image logger
uses: elgohr/Publish-Docker-Github-Action@master
with:
name: registry.cn-beijing.aliyuncs.com/yunionio/logger
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
registry: registry.cn-beijing.aliyuncs.com
snapshot: true
dockerfile: build/docker/Dockerfile.logger
- name: Image scheduler
uses: elgohr/Publish-Docker-Github-Action@master
with:
name: registry.cn-beijing.aliyuncs.com/yunionio/scheduler
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
registry: registry.cn-beijing.aliyuncs.com
snapshot: true
dockerfile: build/docker/Dockerfile.scheduler
- name: Image apigateway
uses: elgohr/Publish-Docker-Github-Action@master
with:
name: registry.cn-beijing.aliyuncs.com/yunionio/apigateway
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
registry: registry.cn-beijing.aliyuncs.com
snapshot: true
dockerfile: build/docker/Dockerfile.apigateway
- name: Image s3gateway
uses: elgohr/Publish-Docker-Github-Action@master
with:
name: registry.cn-beijing.aliyuncs.com/yunionio/s3gateway
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
registry: registry.cn-beijing.aliyuncs.com
snapshot: true
dockerfile: build/docker/Dockerfile.s3gateway
- name: Image ansibleserver
uses: elgohr/Publish-Docker-Github-Action@master
with:
name: registry.cn-beijing.aliyuncs.com/yunionio/ansibleserver
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
registry: registry.cn-beijing.aliyuncs.com
snapshot: true
dockerfile: build/docker/Dockerfile.ansibleserver
- name: Image cloudnet
uses: elgohr/Publish-Docker-Github-Action@master
with:
name: registry.cn-beijing.aliyuncs.com/yunionio/cloudnet
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
registry: registry.cn-beijing.aliyuncs.com
snapshot: true
dockerfile: build/docker/Dockerfile.cloudnet
- name: Image glance
uses: elgohr/Publish-Docker-Github-Action@master
with:
name: registry.cn-beijing.aliyuncs.com/yunionio/glance
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
registry: registry.cn-beijing.aliyuncs.com
snapshot: true
dockerfile: build/docker/Dockerfile.glance
- name: Image notify
uses: elgohr/Publish-Docker-Github-Action@master
with:
name: registry.cn-beijing.aliyuncs.com/yunionio/notify
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
registry: registry.cn-beijing.aliyuncs.com
snapshot: true
dockerfile: build/docker/Dockerfile.notify
- name: Image cloudevent
uses: elgohr/Publish-Docker-Github-Action@master
with:
name: registry.cn-beijing.aliyuncs.com/yunionio/cloudevent
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
registry: registry.cn-beijing.aliyuncs.com
snapshot: true
dockerfile: build/docker/Dockerfile.cloudevent
- name: Image cloudid
uses: elgohr/Publish-Docker-Github-Action@master
with:
name: registry.cn-beijing.aliyuncs.com/yunionio/cloudid
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
registry: registry.cn-beijing.aliyuncs.com
snapshot: true
dockerfile: build/docker/Dockerfile.cloudid
- name: Image devtool
uses: elgohr/Publish-Docker-Github-Action@master
with:
name: registry.cn-beijing.aliyuncs.com/yunionio/devtool
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
registry: registry.cn-beijing.aliyuncs.com
snapshot: true
dockerfile: build/docker/Dockerfile.devtool
- name: Image region DNS
uses: elgohr/Publish-Docker-Github-Action@master
with:
name: registry.cn-beijing.aliyuncs.com/yunionio/region-dns
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
registry: registry.cn-beijing.aliyuncs.com
snapshot: true
dockerfile: build/docker/Dockerfile.region-dns
+52
View File
@@ -0,0 +1,52 @@
name: Apigateway Docker Image
on:
push:
branches:
- 'releases/**'
- 'main'
- 'master'
paths:
- 'pkg/appsrv/**.go'
- 'pkg/cloudcommon/db/**.go'
- 'pkg/apigateway/**.go'
- 'pkg/apis/apigateway/**.go'
- 'pkg/mcclient/modules/**.go'
jobs:
build_apigateway:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 8
- uses: actions/setup-go@v4
with:
go-version: '1.18'
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
- name: Login to Aliyun Container Registry (ACR)
uses: docker/login-action@v2
with:
registry: https://registry.us-west-1.aliyuncs.com
username: ${{ secrets.ACR_USERNAME }}
password: ${{ secrets.ACR_PASSWORD }}
- name: Build And Push Docker Image
shell: bash
run: |
set -o xtrace
export GO111MODULE=on
branch="${GITHUB_REF#refs/heads/}"
timestamp=`TZ="Asia/Shanghai" date +"%Y%m%d%H%M%S"`
export VERSION="$branch-$timestamp-solo"
export GOOS=linux
export ARCH=all
export REGISTRY=registry.us-west-1.aliyuncs.com/yunion-dev
make image apigateway
+50
View File
@@ -0,0 +1,50 @@
name: Climc Docker Image
on:
push:
branches:
- 'releases/**'
- 'main'
- 'master'
paths:
- 'cmd/climc/**.go'
- 'pkg/mcclient/**.go'
- 'vendor/yunion.io/x/structarg/**.go'
jobs:
build_climc:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 8
- uses: actions/setup-go@v4
with:
go-version: '1.18'
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
- name: Login to Aliyun Container Registry (ACR)
uses: docker/login-action@v2
with:
registry: https://registry.us-west-1.aliyuncs.com
username: ${{ secrets.ACR_USERNAME }}
password: ${{ secrets.ACR_PASSWORD }}
- name: Build And Push Docker Image
shell: bash
run: |
set -o xtrace
export GO111MODULE=on
branch="${GITHUB_REF#refs/heads/}"
timestamp=`TZ="Asia/Shanghai" date +"%Y%m%d%H%M%S"`
export VERSION="$branch-$timestamp-solo"
export GOOS=linux
export ARCH=all
export REGISTRY=registry.us-west-1.aliyuncs.com/yunion-dev
make image climc
+51
View File
@@ -0,0 +1,51 @@
name: Cloudmon Docker Image
on:
push:
branches:
- 'releases/**'
- 'main'
- 'master'
paths:
- 'pkg/appsrv/**.go'
- 'pkg/cloudmon/**.go'
- 'vendor/yunion.io/x/cloudmux/pkg/multicloud/loader/**.go'
jobs:
build_webconsole:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 8
- uses: actions/setup-go@v4
with:
go-version: '1.18'
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
- name: Login to Aliyun Container Registry (ACR)
uses: docker/login-action@v2
with:
registry: https://registry.us-west-1.aliyuncs.com
username: ${{ secrets.ACR_USERNAME }}
password: ${{ secrets.ACR_PASSWORD }}
- name: Build And Push Docker Image
shell: bash
run: |
set -o xtrace
export GO111MODULE=on
branch="${GITHUB_REF#refs/heads/}"
timestamp=`TZ="Asia/Shanghai" date +"%Y%m%d%H%M%S"`
export VERSION="$branch-$timestamp-solo"
export GOOS=linux
export ARCH=all
export REGISTRY=registry.us-west-1.aliyuncs.com/yunion-dev
make image cloudmon
+49
View File
@@ -0,0 +1,49 @@
name: Esxi Agent Docker Image
on:
push:
branches:
- 'releases/**'
- 'main'
- 'master'
paths:
- 'pkg/esxi/**.go'
jobs:
build_webconsole:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 8
- uses: actions/setup-go@v4
with:
go-version: '1.18'
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
- name: Login to Aliyun Container Registry (ACR)
uses: docker/login-action@v2
with:
registry: https://registry.us-west-1.aliyuncs.com
username: ${{ secrets.ACR_USERNAME }}
password: ${{ secrets.ACR_PASSWORD }}
- name: Build And Push Docker Image
shell: bash
run: |
set -o xtrace
export GO111MODULE=on
branch="${GITHUB_REF#refs/heads/}"
timestamp=`TZ="Asia/Shanghai" date +"%Y%m%d%H%M%S"`
export VERSION="$branch-$timestamp-solo"
export GOOS=linux
export ARCH=all
export REGISTRY=registry.us-west-1.aliyuncs.com/yunion-dev
make image esxi-agent
+53
View File
@@ -0,0 +1,53 @@
name: Glance Docker Image
on:
push:
branches:
- 'releases/**'
- 'main'
- 'master'
paths:
- 'pkg/appsrv/**.go'
- 'pkg/cloudcommon/db/**.go'
- 'pkg/image/**.go'
- 'pkg/apis/image/**.go'
- 'vendor/yunion.io/x/sqlchemy/**.go'
- 'vendor/yunion.io/x/jsonutils/**.go'
jobs:
build_glance:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 8
- uses: actions/setup-go@v4
with:
go-version: '1.18'
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
- name: Login to Aliyun Container Registry (ACR)
uses: docker/login-action@v2
with:
registry: https://registry.us-west-1.aliyuncs.com
username: ${{ secrets.ACR_USERNAME }}
password: ${{ secrets.ACR_PASSWORD }}
- name: Build And Push Docker Image
shell: bash
run: |
set -o xtrace
export GO111MODULE=on
branch="${GITHUB_REF#refs/heads/}"
timestamp=`TZ="Asia/Shanghai" date +"%Y%m%d%H%M%S"`
export VERSION="$branch-$timestamp-solo"
export GOOS=linux
export ARCH=all
export REGISTRY=registry.us-west-1.aliyuncs.com/yunion-dev
make image glance
+49
View File
@@ -0,0 +1,49 @@
name: Host Docker Image
on:
push:
branches:
- 'releases/**'
- 'main'
- 'master'
paths:
- 'pkg/hostman/**.go'
- 'pkg/apis/host/**.go'
jobs:
build_host:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 8
- uses: actions/setup-go@v4
with:
go-version: '1.18'
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
- name: Login to Aliyun Container Registry (ACR)
uses: docker/login-action@v2
with:
registry: https://registry.us-west-1.aliyuncs.com
username: ${{ secrets.ACR_USERNAME }}
password: ${{ secrets.ACR_PASSWORD }}
- name: Build And Push Docker Image
shell: bash
run: |
set -o xtrace
export GO111MODULE=on
branch="${GITHUB_REF#refs/heads/}"
timestamp=`TZ="Asia/Shanghai" date +"%Y%m%d%H%M%S"`
export VERSION="$branch-$timestamp-solo"
export GOOS=linux
export ARCH=all
export REGISTRY=registry.us-west-1.aliyuncs.com/yunion-dev
make image host
+53
View File
@@ -0,0 +1,53 @@
name: Keystone Docker Image
on:
push:
branches:
- 'releases/**'
- 'main'
- 'master'
paths:
- 'pkg/appsrv/**.go'
- 'pkg/cloudcommon/db/**.go'
- 'pkg/keystone/**.go'
- 'pkg/apis/identity/**.go'
- 'vendor/yunion.io/x/sqlchemy/**.go'
- 'vendor/yunion.io/x/jsonutils/**.go'
jobs:
build_keystone:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 8
- uses: actions/setup-go@v4
with:
go-version: '1.18'
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
- name: Login to Aliyun Container Registry (ACR)
uses: docker/login-action@v2
with:
registry: https://registry.us-west-1.aliyuncs.com
username: ${{ secrets.ACR_USERNAME }}
password: ${{ secrets.ACR_PASSWORD }}
- name: Build And Push Docker Image
shell: bash
run: |
set -o xtrace
export GO111MODULE=on
branch="${GITHUB_REF#refs/heads/}"
timestamp=`TZ="Asia/Shanghai" date +"%Y%m%d%H%M%S"`
export VERSION="$branch-$timestamp-solo"
export GOOS=linux
export ARCH=all
export REGISTRY=registry.us-west-1.aliyuncs.com/yunion-dev
make image keystone
+53
View File
@@ -0,0 +1,53 @@
name: Logger Docker Image
on:
push:
branches:
- 'releases/**'
- 'main'
- 'master'
paths:
- 'pkg/appsrv/**.go'
- 'pkg/cloudcommon/db/**.go'
- 'pkg/logger/**.go'
- 'pkg/apis/logger/**.go'
- 'vendor/yunion.io/x/sqlchemy/**.go'
- 'vendor/yunion.io/x/jsonutils/**.go'
jobs:
build_webconsole:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 8
- uses: actions/setup-go@v4
with:
go-version: '1.18'
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
- name: Login to Aliyun Container Registry (ACR)
uses: docker/login-action@v2
with:
registry: https://registry.us-west-1.aliyuncs.com
username: ${{ secrets.ACR_USERNAME }}
password: ${{ secrets.ACR_PASSWORD }}
- name: Build And Push Docker Image
shell: bash
run: |
set -o xtrace
export GO111MODULE=on
branch="${GITHUB_REF#refs/heads/}"
timestamp=`TZ="Asia/Shanghai" date +"%Y%m%d%H%M%S"`
export VERSION="$branch-$timestamp-solo"
export GOOS=linux
export ARCH=all
export REGISTRY=registry.us-west-1.aliyuncs.com/yunion-dev
make image logger
+53
View File
@@ -0,0 +1,53 @@
name: Notify Docker Image
on:
push:
branches:
- 'releases/**'
- 'main'
- 'master'
paths:
- 'pkg/appsrv/**.go'
- 'pkg/cloudcommon/db/**.go'
- 'pkg/notify/**.go'
- 'pkg/apis/notify/**.go'
- 'vendor/yunion.io/x/sqlchemy/**.go'
- 'vendor/yunion.io/x/jsonutils/**.go'
jobs:
build_notify:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 8
- uses: actions/setup-go@v4
with:
go-version: '1.18'
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
- name: Login to Aliyun Container Registry (ACR)
uses: docker/login-action@v2
with:
registry: https://registry.us-west-1.aliyuncs.com
username: ${{ secrets.ACR_USERNAME }}
password: ${{ secrets.ACR_PASSWORD }}
- name: Build And Push Docker Image
shell: bash
run: |
set -o xtrace
export GO111MODULE=on
branch="${GITHUB_REF#refs/heads/}"
timestamp=`TZ="Asia/Shanghai" date +"%Y%m%d%H%M%S"`
export VERSION="$branch-$timestamp-solo"
export GOOS=linux
export ARCH=all
export REGISTRY=registry.us-west-1.aliyuncs.com/yunion-dev
make image notify
+54
View File
@@ -0,0 +1,54 @@
name: Region Docker Image
on:
push:
branches:
- 'releases/**'
- 'main'
- 'master'
paths:
- 'pkg/appsrv/**.go'
- 'pkg/cloudcommon/db/**.go'
- 'pkg/compute/**.go'
- 'pkg/apis/compute/**.go'
- 'vendor/yunion.io/x/cloudmux/**.go'
- 'vendor/yunion.io/x/sqlchemy/**.go'
- 'vendor/yunion.io/x/jsonutils/**.go'
jobs:
build_region:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 8
- uses: actions/setup-go@v4
with:
go-version: '1.18'
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
- name: Login to Aliyun Container Registry (ACR)
uses: docker/login-action@v2
with:
registry: https://registry.us-west-1.aliyuncs.com
username: ${{ secrets.ACR_USERNAME }}
password: ${{ secrets.ACR_PASSWORD }}
- name: Build And Push Docker Image
shell: bash
run: |
set -o xtrace
export GO111MODULE=on
branch="${GITHUB_REF#refs/heads/}"
timestamp=`TZ="Asia/Shanghai" date +"%Y%m%d%H%M%S"`
export VERSION="$branch-$timestamp-solo"
export GOOS=linux
export ARCH=all
export REGISTRY=registry.us-west-1.aliyuncs.com/yunion-dev
make image region
+50
View File
@@ -0,0 +1,50 @@
name: Scheduler Docker Image
on:
push:
branches:
- 'releases/**'
- 'main'
- 'master'
paths:
- 'pkg/scheduler/**.go'
- 'pkg/apis/scheduler/**.go'
jobs:
build_webconsole:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 8
- uses: actions/setup-go@v4
with:
go-version: '1.18'
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
- name: Login to Aliyun Container Registry (ACR)
uses: docker/login-action@v2
with:
registry: https://registry.us-west-1.aliyuncs.com
username: ${{ secrets.ACR_USERNAME }}
password: ${{ secrets.ACR_PASSWORD }}
- name: Build And Push Docker Image
shell: bash
run: |
set -o xtrace
export GO111MODULE=on
branch="${GITHUB_REF#refs/heads/}"
timestamp=`TZ="Asia/Shanghai" date +"%Y%m%d%H%M%S"`
export VERSION="$branch-$timestamp-solo"
export GOOS=linux
export ARCH=all
export REGISTRY=registry.us-west-1.aliyuncs.com/yunion-dev
make image scheduler
+53
View File
@@ -0,0 +1,53 @@
name: Webconsole Docker Image
on:
push:
branches:
- 'releases/**'
- 'main'
- 'master'
paths:
- 'pkg/appsrv/**.go'
- 'pkg/cloudcommon/db/**.go'
- 'pkg/webconsole/**.go'
- 'pkg/apis/webconsole/**.go'
- 'vendor/yunion.io/x/sqlchemy/**.go'
- 'vendor/yunion.io/x/jsonutils/**.go'
jobs:
build_webconsole:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 8
- uses: actions/setup-go@v4
with:
go-version: '1.18'
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
- name: Login to Aliyun Container Registry (ACR)
uses: docker/login-action@v2
with:
registry: https://registry.us-west-1.aliyuncs.com
username: ${{ secrets.ACR_USERNAME }}
password: ${{ secrets.ACR_PASSWORD }}
- name: Build And Push Docker Image
shell: bash
run: |
set -o xtrace
export GO111MODULE=on
branch="${GITHUB_REF#refs/heads/}"
timestamp=`TZ="Asia/Shanghai" date +"%Y%m%d%H%M%S"`
export VERSION="$branch-$timestamp-solo"
export GOOS=linux
export ARCH=all
export REGISTRY=registry.us-west-1.aliyuncs.com/yunion-dev
make image webconsole
@@ -0,0 +1,17 @@
name: Issue Check Inactive
on:
schedule:
- cron: "0 0 * * *"
jobs:
issue-check-inactive:
runs-on: ubuntu-latest
steps:
- name: check-inactive
uses: actions-cool/issues-helper@v2
with:
actions: 'check-inactive'
inactive-label: 'stale'
inactive-day: 30
exclude-labels: 'announcement'
+20
View File
@@ -0,0 +1,20 @@
name: Issue Close Require
on:
schedule:
- cron: "0 1 * * *"
jobs:
issue-close-require:
runs-on: ubuntu-latest
steps:
- name: need reproduce
uses: actions-cool/issues-helper@v2
with:
actions: 'close-issues'
labels: 'state/awaiting user feedback'
inactive-day: 37
body: |
If you do not provide feedback for more than 37 days, we will close the issue and you can either reopen it or submit a new issue.
您超过 37 天未反馈信息,我们将关闭该 issue,如有需求您可以重新打开或者提交新的 issue。
+16
View File
@@ -0,0 +1,16 @@
name: Issue Close Check
on:
issues:
types: [closed]
jobs:
issue-closed-remove-labels:
runs-on: ubuntu-latest
if: "!contains(github.event.issue.labels.*.name, 'stale')"
steps:
- name: Remove statle labels when issue that hasn't stale label is closed
uses: actions-cool/issues-helper@v2
with:
actions: 'remove-labels'
labels: 'state/awaiting processing,state/awaiting user feedback'
+38
View File
@@ -0,0 +1,38 @@
on:
issue_comment:
types: [created]
name: Add issues workflow labels
jobs:
add-label-if-is-author:
runs-on: ubuntu-latest
if: (github.event.issue.user.id == github.event.comment.user.id) && !github.event.issue.pull_request && (github.event.issue.state == 'open')
steps:
- name: Add require handle label
uses: actions-cool/issues-helper@v2
with:
actions: 'add-labels'
labels: 'state/awaiting processing'
- name: Remove require reply label
uses: actions-cool/issues-helper@v2
with:
actions: 'remove-labels'
labels: 'state/awaiting user feedback,stale'
add-label-if-not-author:
runs-on: ubuntu-latest
if: (github.event.issue.user.id != github.event.comment.user.id) && !github.event.issue.pull_request && (github.event.issue.state == 'open') && (!contains(github.event.comment.body, '/keep-state'))
steps:
- name: Add require replay label
uses: actions-cool/issues-helper@v2
with:
actions: 'add-labels'
labels: 'state/awaiting user feedback'
- name: Remove require handle label
uses: actions-cool/issues-helper@v2
with:
actions: 'remove-labels'
labels: 'state/awaiting processing,stale'
+17
View File
@@ -0,0 +1,17 @@
on:
issue_comment:
types: [created]
jobs:
notify-author-comment:
runs-on: ubuntu-latest
if: (github.event.issue.user.id == github.event.comment.user.id) && !github.event.issue.pull_request
# find context from: https://docs.github.com/en/webhooks/webhook-events-and-payloads#issue_comment
steps:
- name: feishu notify
uses: zexi/action-issues-notify@v1
with:
url: ${{ secrets.FEISHU_BOT_WEBHOOK_URL }}
issue_title: "${{ github.event.comment.user.login }} 回复了 issue: ${{ github.event.issue.title }}"
issue_body: "${{ tojson(github.event.comment.body) }}"
issue_link_url: "${{github.event.comment.html_url}}"
+33
View File
@@ -0,0 +1,33 @@
name: Issue Open Check
on:
issues:
types: [opened, reopened]
jobs:
issue-open-add-labels:
runs-on: ubuntu-latest
steps:
- name: Add labels
uses: actions-cool/issues-helper@v2
if: ${{ !github.event.comment.pull_request.pull_request }}
with:
actions: 'add-labels'
labels: 'state/awaiting processing'
- name: Remove require reply label
uses: actions-cool/issues-helper@v2
with:
actions: 'remove-labels'
labels: 'state/awaiting user feedback,stale'
notify-author-comment:
runs-on: ubuntu-latest
steps:
- name: feishu notify
uses: zexi/action-issues-notify@v1
with:
url: ${{ secrets.FEISHU_BOT_WEBHOOK_URL }}
issue_title: "${{ github.event.issue.user.login }} 提交了 issue: ${{ github.event.issue.title }}"
issue_body: "${{ tojson(github.event.issue.body) }}"
issue_link_url: "${{github.event.issue.html_url}}"
+1 -1
View File
@@ -18,7 +18,7 @@ Cloudpods是一款开源的基础设施管理工具软件,运行场景复杂
## 贡献代码
我们非常欢迎和感谢开发者向项目提交代码PR,流程细节请查看 [CONTRIBUTING](https://www.cloudpods.org/zh/docs/contribute/contrib/).
我们非常欢迎和感谢开发者向项目提交代码PR,流程细节请查看 [CONTRIBUTING](https://www.cloudpods.org/zh/docs/development/contrib/).
### 修复BUG
+2 -2
View File
@@ -288,8 +288,8 @@ GOPROXY ?= direct
mod:
GOPROXY=$(GOPROXY) GONOSUMDB=yunion.io/x go get -d yunion.io/x/cloudmux@$(RELEASE_BRANCH)
GOPROXY=$(GOPROXY) GONOSUMDB=yunion.io/x go get -d $(patsubst %,%@master,$(shell GO111MODULE=on go mod edit -print | sed -n -e 's|.*\(yunion.io/x/[a-z].*\) v.*|\1|p' | grep -v '/cloudmux$$'))
go mod tidy
go mod vendor -v
GOPROXY=$(GOPROXY) GONOSUMDB=yunion.io/x go mod tidy
GOPROXY=$(GOPROXY) GONOSUMDB=yunion.io/x go mod vendor -v
define helpText
Build with docker
+34 -32
View File
@@ -23,12 +23,14 @@ Cloudpods是一个开源的Golang实现的云原生的融合多云/混合云的
### 概览 & UI 展示
![](https://www.cloudpods.org/zh/docs/introduce/images/interface1.gif)
<details>
<summary>管理多云资源的功能,可以管理大多数的主流云,包括私有云,例如OpenStack,以及公有云,例如AWS,Azure,GCP,阿里云,华为云和腾讯云等</summary>
<ul>
<li>
<p>云帐号纳管</p>
<img src="https://www.cloudpods.org/zh/docs/introduce/ui/images/cloudselect.png" alt="multi cloud management">
<img src="https://www.cloudpods.org/zh/docs/practice/images/cloudselect.png" alt="multi cloud management">
</li>
<li>
<p>云帐号列表</p>
@@ -36,7 +38,7 @@ Cloudpods是一个开源的Golang实现的云原生的融合多云/混合云的
</li>
<li>
<p>公有云虚拟机列表</p>
<img src="https://www.cloudpods.org/zh/docs/introduce/ui/images/publicvmlist.png">
<img src="https://www.cloudpods.org/zh/docs/practice/images/publicvmlist.png">
</li>
</ul>
</details>
@@ -52,8 +54,8 @@ Cloudpods是一个开源的Golang实现的云原生的融合多云/混合云的
</li>
<li>
<p>虚拟机创建页面</p>
<img src="https://www.cloudpods.org/zh/docs/introduce/ui/images/createkvmvm1.png">
<img src="https://www.cloudpods.org/zh/docs/introduce/ui/images/createkvmvm2.png">
<img src="https://www.cloudpods.org/zh/docs/practice/images/createkvmvm1.png">
<img src="https://www.cloudpods.org/zh/docs/practice/images/createkvmvm2.png">
</li>
<li>
<p>虚拟机可通过 VNC 或者 SSH 登录</p>
@@ -69,23 +71,23 @@ Cloudpods是一个开源的Golang实现的云原生的融合多云/混合云的
</li>
<li>
<p>VPC列表</p>
<img src="https://www.cloudpods.org/zh/docs/introduce/ui/images/vpclist.png">
<img src="https://www.cloudpods.org/zh/docs/practice/images/vpclist.png">
</li>
<li>
<p>二层网络列表(经典网络)</p>
<img src="https://www.cloudpods.org/zh/docs/introduce/ui/images/wirelist.png">
<img src="https://www.cloudpods.org/zh/docs/practice/images/wirelist.png">
</li>
<li>
<p>IP子网列表</p>
<img src="https://www.cloudpods.org/zh/docs/introduce/ui/images/ipsubnetlist.png">
<img src="https://www.cloudpods.org/zh/docs/practice/images/ipsubnetlist.png">
</li>
<li>
<p>弹性公网IP列表(VPC网络)</p>
<img src="https://www.cloudpods.org/zh/docs/introduce/ui/images/vpclist.png">
<img src="https://www.cloudpods.org/zh/docs/practice/images/vpclist.png">
</li>
<li>
<p>LB列表</p>
<img src="https://www.cloudpods.org/zh/docs/introduce/ui/images/lblist.png">
<img src="https://www.cloudpods.org/zh/docs/practice/images/lblist.png">
</li>
</ul>
</details>
@@ -101,11 +103,11 @@ Cloudpods是一个开源的Golang实现的云原生的融合多云/混合云的
</li>
<li>
<p>物理机纳管</p>
<img src="https://www.cloudpods.org/zh/docs/introduce/ui/images/addphysicalmachine.png">
<img src="https://www.cloudpods.org/zh/docs/practice/images/addphysicalmachine.png">
</li>
<li>
<p>安装操作系统</p>
<img src="https://www.cloudpods.org/zh/docs/introduce/ui/images/createbaremetal.png">
<img src="https://www.cloudpods.org/zh/docs/practice/images/createbaremetal.png">
</li>
<li>支持 ARM64 的物理机服务器</li>
</ul>
@@ -116,16 +118,16 @@ Cloudpods是一个开源的Golang实现的云原生的融合多云/混合云的
<ul>
<li>
<p>支持本地sql、LDAP 等认证源</p>
<img src="https://www.cloudpods.org/zh/docs/introduce/ui/images/idplist.png">
<img src="https://www.cloudpods.org/zh/docs/practice/images/idplist.png">
</li>
<li>
<p>多租户系统,包括域,项目,组,用户,角色和权限等</p>
<img src="https://www.cloudpods.org/zh/docs/introduce/ui/images/domainlist.png">
<img src="https://www.cloudpods.org/zh/docs/introduce/ui/images/projectlist.png">
<img src="https://www.cloudpods.org/zh/docs/introduce/ui/images/grouplist.png">
<img src="https://www.cloudpods.org/zh/docs/introduce/ui/images/userlist.png">
<img src="https://www.cloudpods.org/zh/docs/introduce/ui/images/rolelist.png">
<img src="https://www.cloudpods.org/zh/docs/introduce/ui/images/policylist.png">
<img src="https://www.cloudpods.org/zh/docs/practice/images/domainlist.png">
<img src="https://www.cloudpods.org/zh/docs/practice/images/projectlist.png">
<img src="https://www.cloudpods.org/zh/docs/practice/images/grouplist.png">
<img src="https://www.cloudpods.org/zh/docs/practice/images/userlist.png">
<img src="https://www.cloudpods.org/zh/docs/practice/images/rolelist.png">
<img src="https://www.cloudpods.org/zh/docs/practice/images/policylist.png">
</li>
</ul>
</details>
@@ -137,24 +139,24 @@ Cloudpods是一个开源的Golang实现的云原生的融合多云/混合云的
<ul>
<li>
<p>添加VMware云账号</p>
<img src="https://www.cloudpods.org/zh/docs/introduce/ui/images/createvmware.png">
<img src="https://www.cloudpods.org/zh/docs/practice/images/createvmware.png">
</li>
<li>
<p>VMware云账号列表</p>
<img src="https://www.cloudpods.org/zh/docs/introduce/ui/images/vmwarelist.png">
<img src="https://www.cloudpods.org/zh/docs/practice/images/vmwarelist.png">
</li>
<li>
<p>自动创建二层网络</p>
<img src="https://www.cloudpods.org/zh/docs/introduce/ui/images/vmwarewirelist.png">
<img src="https://www.cloudpods.org/zh/docs/practice/images/vmwarewirelist.png">
</li>
<li>
<p>自动创建IP子网</p>
<img src="https://www.cloudpods.org/zh/docs/introduce/ui/images/vmwareipsubnetlist.png">
<img src="https://www.cloudpods.org/zh/docs/practice/images/vmwareipsubnetlist.png">
</li>
<li>
<p>新建VMware虚拟机</p>
<img src="https://www.cloudpods.org/zh/docs/introduce/ui/images/createvmwarevm1.png">
<img src="https://www.cloudpods.org/zh/docs/introduce/ui/images/createvmwarevm2.png">
<img src="https://www.cloudpods.org/zh/docs/practice/images/createvmwarevm1.png">
<img src="https://www.cloudpods.org/zh/docs/practice/images/createvmwarevm2.png">
</li>
</ul>
</details>
@@ -167,19 +169,19 @@ Cloudpods是一个开源的Golang实现的云原生的融合多云/混合云的
<ul>
<li>
<p>为云账号开启免密登录(以阿里云为例)</p>
<img src="https://www.cloudpods.org/zh/docs/introduce/ui/images/enablecloudsso.png">
<img src="https://www.cloudpods.org/zh/docs/practice/images/enablecloudsso.png">
</li>
<li>
<p>将Cloudpods平台用户添加为免密登录用户</p>
<img src="https://www.cloudpods.org/zh/docs/introduce/ui/images/addsamluser.png">
<img src="https://www.cloudpods.org/zh/docs/practice/images/addsamluser.png">
</li>
<li>
<p>多云统一登录入口</p>
<img src="https://www.cloudpods.org/zh/docs/introduce/ui/images/cloudssoentry.png">
<img src="https://www.cloudpods.org/zh/docs/practice/images/cloudssoentry.png">
</li>
<li>
<p>多云统一登录-免密登录用户列表</p>
<img src="https://www.cloudpods.org/zh/docs/introduce/ui/images/cloudsamluser.png">
<img src="https://www.cloudpods.org/zh/docs/practice/images/cloudsamluser.png">
</li>
<li>
<p>Cloudpods平台用户免密登录阿里云</p>
@@ -239,7 +241,7 @@ Cloudpods是一个开源的Golang实现的云原生的融合多云/混合云的
## 安装部署
- [All in One 安装](https://www.cloudpods.org/zh/docs/quickstart/allinone/):在 CentOS 7 或 Debian 10 等发行版里搭建全功能 Cloudpods 服务,可以快速体验**内置私有云**和**多云管理**的功能。
- [All in One 安装](https://www.cloudpods.org/zh/docs/quickstart/allinone-converge/):在 CentOS 7 或 Debian 10 等发行版里搭建全功能 Cloudpods 服务,可以快速体验**内置私有云**和**多云管理**的功能。
- [Kubernetes Helm 安装](https://www.cloudpods.org/zh/docs/quickstart/k8s/):在已有 Kubernetes 集群上通过 Helm 部署一套 Cloudpods CMP 服务,可以体验**多云管理**的功能。
- [Docker Compose 安装](https://www.cloudpods.org/zh/docs/quickstart/docker-compose/):通过 Docker Compose 部署 Cloudpods CMP 服务,可以迅速体验**多云管理**的功能。
- [高可用安装](https://www.cloudpods.org/zh/docs/setup/ha-ce/):在生产环境中使用高可用的方式部署 Cloudpods 服务,包括**内置私有云**和**多云管理**的功能。
@@ -258,14 +260,14 @@ Cloudpods是一个开源的Golang实现的云原生的融合多云/混合云的
您可以通过如下方式联系我们:
* [服务订阅](https://www.yunion.cn/subscription/index.html)
* 哔哩哔哩: [Cloudpods](https://space.bilibili.com/3493131737631540/)
* 企业级支持: [服务订阅](https://www.yunion.cn/subscription/index.html)
* 微信: 请扫描如下二维码联系我们
<img src="https://www.cloudpods.org/images/contact_me_qr_20230321.png" alt="WeChat QRCode">
* 哔哩哔哩: [Cloudpods](https://space.bilibili.com/3493131737631540/)
## 版本历史
请访问[Cloudpods Changelog](https://www.cloudpods.org/zh/docs/changelog/).
+35 -33
View File
@@ -25,6 +25,8 @@ Cloudpods is a cloud-native open source unified multi/hybrid-cloud platform deve
### Summary & UI
![](https://www.cloudpods.org/zh/docs/introduce/images/interface1.gif)
<details>
<summary>
Multi-cloud management that is able to manage a wide range of cloud providers, including private cloud, such as OpenStack, and public clouds, such as AWS, Azure, Google Cloud, Alibaba Cloud, Tencent Cloud, Huawei Cloud, etc.
@@ -32,7 +34,7 @@ Cloudpods is a cloud-native open source unified multi/hybrid-cloud platform deve
<ul>
<li>
<p>Cloud account create form</p>
<img src="https://www.cloudpods.org/zh/docs/introduce/ui/images/cloudselect.png" alt="multi cloud management">
<img src="https://www.cloudpods.org/zh/docs/practice/images/cloudselect.png" alt="multi cloud management">
</li>
<li>
<p>Cloud accounts list</p>
@@ -40,7 +42,7 @@ Cloudpods is a cloud-native open source unified multi/hybrid-cloud platform deve
</li>
<li>
<p>Multi public cloud VM list</p>
<img src="https://www.cloudpods.org/zh/docs/introduce/ui/images/publicvmlist.png">
<img src="https://www.cloudpods.org/zh/docs/practice/images/publicvmlist.png">
</li>
</ul>
</details>
@@ -56,8 +58,8 @@ Cloudpods is a cloud-native open source unified multi/hybrid-cloud platform deve
</li>
<li>
<p>Create VM instance form</p>
<img src="https://www.cloudpods.org/zh/docs/introduce/ui/images/createkvmvm1.png">
<img src="https://www.cloudpods.org/zh/docs/introduce/ui/images/createkvmvm2.png">
<img src="https://www.cloudpods.org/zh/docs/practice/images/createkvmvm1.png">
<img src="https://www.cloudpods.org/zh/docs/practice/images/createkvmvm2.png">
</li>
<li>
<p>VNC and SSH login page</p>
@@ -73,23 +75,23 @@ Cloudpods is a cloud-native open source unified multi/hybrid-cloud platform deve
</li>
<li>
<p>VPC list</p>
<img src="https://www.cloudpods.org/zh/docs/introduce/ui/images/vpclist.png">
<img src="https://www.cloudpods.org/zh/docs/practice/images/vpclist.png">
</li>
<li>
<p>Wire list (Classic Network)</p>
<img src="https://www.cloudpods.org/zh/docs/introduce/ui/images/wirelist.png">
<img src="https://www.cloudpods.org/zh/docs/practice/images/wirelist.png">
</li>
<li>
<p>IPsubnet list</p>
<img src="https://www.cloudpods.org/zh/docs/introduce/ui/images/ipsubnetlist.png">
<img src="https://www.cloudpods.org/zh/docs/practice/images/ipsubnetlist.png">
</li>
<li>
<p>Eip list (VPC Network)</p>
<img src="https://www.cloudpods.org/zh/docs/introduce/ui/images/vpclist.png">
<img src="https://www.cloudpods.org/zh/docs/practice/images/vpclist.png">
</li>
<li>
<p>LB list</p>
<img src="https://www.cloudpods.org/zh/docs/introduce/ui/images/lblist.png">
<img src="https://www.cloudpods.org/zh/docs/practice/images/lblist.png">
</li>
</ul>
</details>
@@ -101,15 +103,15 @@ Cloudpods is a cloud-native open source unified multi/hybrid-cloud platform deve
<ul>
<li>
<p>BareMetal list</p>
<img src="https://www.cloudpods.org/zh/docs/introduce/ui/images/physicalmachinelist.png">
<img src="https://www.cloudpods.org/zh/docs/practice/images/physicalmachinelist.png">
</li>
<li>
<p>Baremetal Management</p>
<img src="https://www.cloudpods.org/zh/docs/introduce/ui/images/addphysicalmachine.png">
<img src="https://www.cloudpods.org/zh/docs/practice/images/addphysicalmachine.png">
</li>
<li>
<p>Create OS on BareMetal</p>
<img src="https://www.cloudpods.org/zh/docs/introduce/ui/images/createbaremetal.png">
<img src="https://www.cloudpods.org/zh/docs/practice/images/createbaremetal.png">
</li>
<li>ARM64 baremetal supported</li>
</ul>
@@ -122,16 +124,16 @@ Cloudpods is a cloud-native open source unified multi/hybrid-cloud platform deve
<ul>
<li>
<p>sql, LDAP supported</p>
<img src="https://www.cloudpods.org/zh/docs/introduce/ui/images/idplist.png">
<img src="https://www.cloudpods.org/zh/docs/practice/images/idplist.png">
</li>
<li>
<p>Multi-tenancy system, include domain, project, group, user, role, policy</p>
<img src="https://www.cloudpods.org/zh/docs/introduce/ui/images/domainlist.png">
<img src="https://www.cloudpods.org/zh/docs/introduce/ui/images/projectlist.png">
<img src="https://www.cloudpods.org/zh/docs/introduce/ui/images/grouplist.png">
<img src="https://www.cloudpods.org/zh/docs/introduce/ui/images/userlist.png">
<img src="https://www.cloudpods.org/zh/docs/introduce/ui/images/rolelist.png">
<img src="https://www.cloudpods.org/zh/docs/introduce/ui/images/policylist.png">
<img src="https://www.cloudpods.org/zh/docs/practice/images/domainlist.png">
<img src="https://www.cloudpods.org/zh/docs/practice/images/projectlist.png">
<img src="https://www.cloudpods.org/zh/docs/practice/images/grouplist.png">
<img src="https://www.cloudpods.org/zh/docs/practice/images/userlist.png">
<img src="https://www.cloudpods.org/zh/docs/practice/images/rolelist.png">
<img src="https://www.cloudpods.org/zh/docs/practice/images/policylist.png">
</ul>
</details>
@@ -142,24 +144,24 @@ Cloudpods is a cloud-native open source unified multi/hybrid-cloud platform deve
<ul>
<li>
<p>Add VMware account</p>
<img src="https://www.cloudpods.org/zh/docs/introduce/ui/images/createvmware.png">
<img src="https://www.cloudpods.org/zh/docs/practice/images/createvmware.png">
</li>
<li>
<p>VMware account list</p>
<img src="https://www.cloudpods.org/zh/docs/introduce/ui/images/vmwarelist.png">
<img src="https://www.cloudpods.org/zh/docs/practice/images/vmwarelist.png">
</li>
<li>
<p>Automatic creation of wire</p>
<img src="https://www.cloudpods.org/zh/docs/introduce/ui/images/vmwarewirelist.png">
<img src="https://www.cloudpods.org/zh/docs/practice/images/vmwarewirelist.png">
</li>
<li>
<p>Automatic creation of ipsubnet</p>
<img src="https://www.cloudpods.org/zh/docs/introduce/ui/images/vmwareipsubnetlist.png">
<img src="https://www.cloudpods.org/zh/docs/practice/images/vmwareipsubnetlist.png">
</li>
<li>
<p>Create a VMware VM instance</p>
<img src="https://www.cloudpods.org/zh/docs/introduce/ui/images/createvmwarevm1.png">
<img src="https://www.cloudpods.org/zh/docs/introduce/ui/images/createvmwarevm2.png">
<img src="https://www.cloudpods.org/zh/docs/practice/images/createvmwarevm1.png">
<img src="https://www.cloudpods.org/zh/docs/practice/images/createvmwarevm2.png">
</li>
</ul>
</details>
@@ -172,19 +174,19 @@ Cloudpods is a cloud-native open source unified multi/hybrid-cloud platform deve
<ul>
<li>
<p>Enable the SSO login function of the cloud account (aliyun as an example)</p>
<img src="https://www.cloudpods.org/zh/docs/introduce/ui/images/enablecloudsso.png">
<img src="https://www.cloudpods.org/zh/docs/practice/images/enablecloudsso.png">
</li>
<li>
<p>create saml users</p>
<img src="https://www.cloudpods.org/zh/docs/introduce/ui/images/addsamluser.png">
<img src="https://www.cloudpods.org/zh/docs/practice/images/addsamluser.png">
</li>
<li>
<p>Cloud SSO entry</p>
<img src="https://www.cloudpods.org/zh/docs/introduce/ui/images/cloudssoentry.png">
<img src="https://www.cloudpods.org/zh/docs/practice/images/cloudssoentry.png">
</li>
<li>
<p>Cloud SSO - SSO login user</p>
<img src="https://www.cloudpods.org/zh/docs/introduce/ui/images/cloudsamluser.png">
<img src="https://www.cloudpods.org/zh/docs/practice/images/cloudsamluser.png">
</li>
<li>
<p>Sign in to the public cloud platform with SSO</p>
@@ -243,7 +245,7 @@ Cloudpods is a cloud-native open source unified multi/hybrid-cloud platform deve
## Getting started
- [All in One Installation](https://www.cloudpods.org/zh/docs/quickstart/allinone/)Building a full-featured Cloudpods service on linux distributions such as CentOS 7 or Debian 10 allows for a quick experience of the **built-in private cloud** and **multi-cloud management** features.
- [All in One Installation](https://www.cloudpods.org/zh/docs/quickstart/allinone-converge/)Building a full-featured Cloudpods service on linux distributions such as CentOS 7 or Debian 10 allows for a quick experience of the **built-in private cloud** and **multi-cloud management** features.
- [Kubernetes Helm Installation](https://www.cloudpods.org/zh/docs/quickstart/k8s/)Deploying the Cloudpods CMP service on an existing Kubernetes cluster using Helm and experience the **multi-cloud management** feature.
- [Docker Compose Installation](https://www.cloudpods.org/zh/docs/quickstart/docker-compose/)Deploying the Cloudpods CMP service using Docker Compose and quickly experience the **multi-cloud management** feature.
- [High availability installation](https://www.cloudpods.org/zh/docs/setup/ha-ce/)Deploying Cloudpods services in a highly available manner for production environments, including **built-in private cloud** and **multi-cloud management** features.
@@ -263,14 +265,14 @@ Please check this [issue](https://github.com/yunionio/cloudpods/issues/11427) fo
You may contact us by:
* [Subscription](https://www.yunion.cn/subscription/index.html)
* Bilibili: [Cloudpods](https://space.bilibili.com/3493131737631540/)
* Enterprise Support: [Subscription](https://www.yunion.cn/subscription/index.html)
* WeChat: please scan the following QRCode to contact us
<img src="https://www.cloudpods.org/images/contact_me_qr_20230321.png" alt="WeChat QRCode">
* Bilibili: [Cloudpods](https://space.bilibili.com/3493131737631540/)
## Changelog
See [Cloudpods Changelog](https://www.cloudpods.org/en/docs/changelog/) for details.
+19
View File
@@ -0,0 +1,19 @@
#!/bin/bash
set -e
BASHRC=/etc/profile.d/climc.sh
grep -q rcadmin $BASHRC || echo 'source /etc/yunion/rcadmin' >> $BASHRC
source $BASHRC
climc sshkeypair-inject --admin --target-dir /root/
mkdir -p /etc/dropbear
mkdir -p /var/run/dropbear
test -f /etc/dropbear/dropbear_rsa_host_key || dropbearkey -t rsa -f /etc/dropbear/dropbear_rsa_host_key
dropbear -RFEjk -G root -p 22
@@ -1,3 +1,9 @@
export PATH=/opt/yunion/bin:$PATH
test -f /etc/yunion/rcadmin && source /etc/yunion/rcadmin
source <(climc --completion bash)
echo "Welcome to Cloud Shell :-) You may execute climc and other command tools in this shell."
echo "Please exec 'climc' to get started"
echo ""
@@ -47,6 +47,11 @@ do
climc server-purge $i > /dev/null
done
for i in $(climc server-list --admin --limit 2048 --system --filter "backup_host_id.equals($HOSTID)" | egrep '[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12}' | awk '{print $2}')
do
climc server-delete-backup $i > /dev/null
done
echo "3. Clean disks on $HOSTNAME($HOSTID)"
for storageid in $(climc host-storage-list --host $HOSTID --show-emulated | egrep '[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12}' | awk '{print $4}')
+1 -1
View File
@@ -1,4 +1,4 @@
FROM registry.cn-beijing.aliyuncs.com/yunionio/baremetal-base:v0.3.9-20230221.2
FROM registry.cn-beijing.aliyuncs.com/yunionio/baremetal-base:v0.3.9-20230812.0
MAINTAINER "Zexi Li <lizexi@yunionyun.com>"
+1 -1
View File
@@ -1,7 +1,7 @@
#FROM --platform=linux/amd64 registry.cn-beijing.aliyuncs.com/yunionio/centos-build:1.1-4 as build
#RUN yum install -y https://iso.yunion.cn/vm-images/baremetal-pxerom-1.1.0-21092209.x86_64.rpm
#RUN yum install -y http://192.168.23.50:8083/baremetal-pxerom-1.1.0-21092209.x86_64.rpm
FROM registry.cn-beijing.aliyuncs.com/yunionio/yunionos:v0.1.8-20230221.2 as yunionos
FROM registry.cn-beijing.aliyuncs.com/yunionio/yunionos:v0.1.8-20230812.0 as yunionos
FROM centos:8 as grub-stage
+2 -2
View File
@@ -1,7 +1,7 @@
FROM registry.cn-beijing.aliyuncs.com/yunionio/climc-base:20210901
FROM registry.cn-beijing.aliyuncs.com/yunionio/climc-base:20230731.5
ADD ./build/climc/root/opt /opt
RUN cat /opt/yunion/scripts/motd/climc.sh >> /root/.bashrc
RUN cp /opt/yunion/scripts/motd/climc.sh /etc/profile.d/climc.sh && ln -sf /etc/profile.d/climc.sh /root/.bashrc
ADD ./_output/alpine-build/bin/climc ./_output/alpine-build/bin/*cli /opt/yunion/bin/
+9 -3
View File
@@ -1,5 +1,9 @@
FROM registry.cn-beijing.aliyuncs.com/yunionio/onecloud-base:v0.3.5
ARG TARGETPLATFORM
ARG BUILDPLATFORM
ARG TARGETARCH
MAINTAINER "Zexi Li <lizexi@yunionyun.com>"
ENV TZ Asia/Shanghai
@@ -8,11 +12,13 @@ RUN mkdir -p /opt/yunion/bin
RUN echo http://dl-cdn.alpinelinux.org/alpine/edge/testing >>/etc/apk/repositories
RUN apk add --no-cache bash bash-completion tzdata ca-certificates vim ipmitool kubectl ceph-common && \
RUN apk add --no-cache bash bash-completion tzdata ca-certificates vim ipmitool ceph-common dropbear shadow && \
rm -rf /var/cache/apk/*
RUN usermod --shell /bin/bash root
RUN curl https://iso.yunion.cn/binaries/kubernetes-release/release/v1.22.9/bin/linux/${TARGETARCH}/kubectl -o /usr/bin/kubectl && chmod a+x /usr/bin/kubectl
RUN cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
ENV PATH="/opt/yunion/bin:${PATH}"
RUN mkdir -p /opt/yunion/bin
+1 -1
View File
@@ -1,4 +1,4 @@
FROM registry.cn-beijing.aliyuncs.com/yunionio/host-deployer-base:1.3
FROM registry.cn-beijing.aliyuncs.com/yunionio/host-deployer-base:1.5
MAINTAINER "Yaoqi Wan wanyaoqi@yunionyun.com"
+1 -1
View File
@@ -1,3 +1,3 @@
FROM registry.cn-beijing.aliyuncs.com/yunionio/webconsole-base:v0.2-1
FROM registry.cn-beijing.aliyuncs.com/yunionio/webconsole-base:20230731.2
ADD ./_output/alpine-build/bin/webconsole /opt/yunion/bin/webconsole
+3 -3
View File
@@ -20,17 +20,17 @@ ANSIBLESERVER_BASE = v1.1.1
ansibleserver-base:
$(DOCKER_BUILDX)/ansibleserver-base:$(ANSIBLESERVER_BASE) -f ./Dockerfile.ansibleserver-base .
CLIMC_BASE_VERSION = 20210901
CLIMC_BASE_VERSION = 20230731.5
climc-base:
docker buildx build --platform linux/arm64,linux/amd64 --push \
-t registry.cn-beijing.aliyuncs.com/yunionio/climc-base:$(CLIMC_BASE_VERSION) -f ./Dockerfile.climc-base .
WEBCONSOLE_BASE_VERSION = v0.2-1
WEBCONSOLE_BASE_VERSION = 20230731.2
webconsole-base:
$(DOCKER_BUILDX)/webconsole-base:$(WEBCONSOLE_BASE_VERSION) -f ./Dockerfile.webconsole-base .
BAREMETAL_BASE_VERSION = v0.3.9-20230221.2
BAREMETAL_BASE_VERSION = v0.3.9-20230812.0
baremetal-base:
$(DOCKER_BUILDX)/baremetal-base:$(BAREMETAL_BASE_VERSION) -f ./Dockerfile.baremetal-base .
+17
View File
@@ -0,0 +1,17 @@
#!/bin/bash
set -e
BASHRC=/root/.bashrc
source $BASHRC
climc sshkeypair-inject --admin
mkdir -p /etc/dropbear
mkdir -p /var/run/dropbear
dropbearkey -t rsa -f /etc/dropbear/dropbear_rsa_host_key
dropbear -RFEjk -G root -p 22
+1 -1
View File
@@ -75,7 +75,7 @@ func Executor(s string) {
} else {
session.GetClient().SetDebug(false)
}
if subparser.IsHelpSet() {
if subparser != nil && subparser.IsHelpSet() {
fmt.Print(subparser.HelpString())
return
}
+16
View File
@@ -41,6 +41,7 @@ func init() {
cmd.CreateWithKeyword("create-hcs", &options.SHCSAccountCreateOptions{})
cmd.CreateWithKeyword("create-hcsop", &options.SHcsOpCloudAccountCreateOptions{})
cmd.CreateWithKeyword("create-ucloud", &options.SUcloudCloudAccountCreateOptions{})
cmd.CreateWithKeyword("create-volcengine", &options.SVolcengineCloudAccountCreateOptions{})
cmd.CreateWithKeyword("create-zstack", &options.SZStackCloudAccountCreateOptions{})
cmd.CreateWithKeyword("create-s3", &options.SS3CloudAccountCreateOptions{})
cmd.CreateWithKeyword("create-ceph", &options.SCephCloudAccountCreateOptions{})
@@ -55,6 +56,10 @@ func init() {
cmd.CreateWithKeyword("create-incloudsphere", &options.SInCloudSphereAccountCreateOptions{})
cmd.CreateWithKeyword("create-proxmox", &options.SProxmoxAccountCreateOptions{})
cmd.CreateWithKeyword("create-remotefile", &options.SRemoteFileAccountCreateOptions{})
cmd.CreateWithKeyword("create-ksyun", &options.SKsyunCloudAccountCreateOptions{})
cmd.CreateWithKeyword("create-baidu", &options.SBaiduCloudAccountCreateOptions{})
cmd.CreateWithKeyword("create-cucloud", &options.SCucloudCloudAccountCreateOptions{})
cmd.CreateWithKeyword("create-qingcloud", &options.SQingCloudCloudAccountCreateOptions{})
cmd.UpdateWithKeyword("update-vmware", &options.SVMwareCloudAccountUpdateOptions{})
cmd.UpdateWithKeyword("update-aliyun", &options.SAliyunCloudAccountUpdateOptions{})
@@ -67,6 +72,7 @@ func init() {
cmd.UpdateWithKeyword("update-hcso", &options.SHCSOAccountUpdateOptions{})
cmd.UpdateWithKeyword("update-hcs", &options.SHCSAccountUpdateOptions{})
cmd.UpdateWithKeyword("update-ucloud", &options.SUcloudCloudAccountUpdateOptions{})
cmd.UpdateWithKeyword("update-volcengine", &options.SVolcengineCloudAccountUpdateOptions{})
cmd.UpdateWithKeyword("update-zstack", &options.SZStackCloudAccountUpdateOptions{})
cmd.UpdateWithKeyword("update-s3", &options.SS3CloudAccountUpdateOptions{})
cmd.UpdateWithKeyword("update-ctyun", &options.SCtyunCloudAccountUpdateOptions{})
@@ -76,6 +82,10 @@ func init() {
cmd.UpdateWithKeyword("update-bingocloud", &options.SBingoCloudAccountUpdateOptions{})
cmd.UpdateWithKeyword("update-incloudsphere", &options.SInCloudSphereAccountUpdateOptions{})
cmd.UpdateWithKeyword("update-proxmox", &options.SProxmoxAccountUpdateOptions{})
cmd.UpdateWithKeyword("update-ksyun", &options.SKsyunCloudAccountUpdateOptions{})
cmd.UpdateWithKeyword("update-baidu", &options.SBaiduCloudAccountUpdateOptions{})
cmd.UpdateWithKeyword("update-cucloud", &options.SCucloudCloudAccountUpdateOptions{})
cmd.UpdateWithKeyword("update-qingcloud", &options.SQingCloudCloudAccountUpdateOptions{})
cmd.Perform("update-credential", &options.CloudaccountUpdateCredentialOptions{})
@@ -91,6 +101,7 @@ func init() {
cmd.PerformWithKeyword("update-credential-hcso", "update-credential", &options.SHCSOAccountUpdateCredentialOptions{})
cmd.PerformWithKeyword("update-credential-hcs", "update-credential", &options.SHCSOAccountUpdateCredentialOptions{})
cmd.PerformWithKeyword("update-credential-ucloud", "update-credential", &options.SUcloudCloudAccountUpdateCredentialOptions{})
cmd.PerformWithKeyword("update-credential-volcengine", "update-credential", &options.SVolcengineCloudAccountUpdateCredentialOptions{})
cmd.PerformWithKeyword("update-credential-zstack", "update-credential", &options.SZStackCloudAccountUpdateCredentialOptions{})
cmd.PerformWithKeyword("update-credential-s3", "update-credential", &options.SS3CloudAccountUpdateCredentialOptions{})
cmd.PerformWithKeyword("update-credential-ctyun", "update-credential", &options.SCtyunCloudAccountUpdateCredentialOptions{})
@@ -100,6 +111,10 @@ func init() {
cmd.PerformWithKeyword("update-credential-bingocloud", "update-credential", &options.SBingoCloudAccountUpdateCredentialOptions{})
cmd.PerformWithKeyword("update-credential-incloudsphere", "update-credential", &options.SInCloudSphereAccountUpdateCredentialOptions{})
cmd.PerformWithKeyword("update-credential-proxmox", "update-credential", &options.SProxmoxAccountUpdateCredentialOptions{})
cmd.PerformWithKeyword("update-credential-ksyun", "update-credential", &options.SKsyunCloudAccountUpdateCredentialOptions{})
cmd.PerformWithKeyword("update-credential-baidu", "update-credential", &options.SBaiduCloudAccountUpdateCredentialOptions{})
cmd.PerformWithKeyword("update-credential-cucloud", "update-credential", &options.SCucloudCloudAccountUpdateCredentialOptions{})
cmd.PerformWithKeyword("update-credential-qingcloud", "update-credential", &options.SQingCloudCloudAccountUpdateCredentialOptions{})
cmd.PerformWithKeyword("test-connectivity-google", "test-connectivity", &options.SGoogleCloudAccountUpdateCredentialOptions{})
cmd.PerformWithKeyword("test-connectivity-vmware", "test-connectivity", &options.SVMwareCloudAccountUpdateCredentialOptions{})
@@ -110,6 +125,7 @@ func init() {
cmd.PerformWithKeyword("test-connectivity-openstack", "test-connectivity", &options.SOpenStackCloudAccountUpdateCredentialOptions{})
cmd.PerformWithKeyword("test-connectivity-huawei", "test-connectivity", &options.SHuaweiCloudAccountUpdateCredentialOptions{})
cmd.PerformWithKeyword("test-connectivity-ucloud", "test-connectivity", &options.SUcloudCloudAccountUpdateCredentialOptions{})
cmd.PerformWithKeyword("test-connectivity-volcengine", "test-connectivity", &options.SVolcengineCloudAccountUpdateCredentialOptions{})
cmd.PerformWithKeyword("test-connectivity-zstack", "test-connectivity", &options.SZStackCloudAccountUpdateCredentialOptions{})
cmd.PerformWithKeyword("test-connectivity-s3", "test-connectivity", &options.SS3CloudAccountUpdateCredentialOptions{})
cmd.PerformWithKeyword("test-connectivity-ctyun", "test-connectivity", &options.SCtyunCloudAccountUpdateCredentialOptions{})
+10 -121
View File
@@ -15,129 +15,18 @@
package compute
import (
"yunion.io/x/onecloud/pkg/mcclient"
"yunion.io/x/onecloud/cmd/climc/shell"
modules "yunion.io/x/onecloud/pkg/mcclient/modules/compute"
"yunion.io/x/onecloud/pkg/mcclient/options"
"yunion.io/x/onecloud/pkg/mcclient/options/compute"
)
func init() {
R(&options.DNSListOptions{}, "dns-list", "List dns records", func(s *mcclient.ClientSession, opts *options.DNSListOptions) error {
params, err := options.ListStructToParams(opts)
if err != nil {
return err
}
result, err := modules.DNSRecords.List(s, params)
if err != nil {
return err
}
printList(result, modules.DNSRecords.GetColumns(s))
return nil
})
R(&options.DNSCreateOptions{}, "dns-create", "Create dns record", func(s *mcclient.ClientSession, opts *options.DNSCreateOptions) error {
params, err := opts.Params()
if err != nil {
return err
}
rec, e := modules.DNSRecords.Create(s, params)
if e != nil {
return e
}
printObject(rec)
return nil
})
R(&options.DNSGetOptions{}, "dns-show", "Show details of a dns records", func(s *mcclient.ClientSession, opts *options.DNSGetOptions) error {
dns, e := modules.DNSRecords.Get(s, opts.ID, nil)
if e != nil {
return e
}
printObject(dns)
return nil
})
R(&options.DNSUpdateOptions{}, "dns-update", "Update details of a dns records", func(s *mcclient.ClientSession, opts *options.DNSUpdateOptions) error {
params, err := opts.Params()
if err != nil {
return err
}
dns, e := modules.DNSRecords.Update(s, opts.ID, params)
if e != nil {
return e
}
printObject(dns)
return nil
})
R(&options.DNSGetOptions{}, "dns-delete", "Delete a dns record", func(s *mcclient.ClientSession, opts *options.DNSGetOptions) error {
dns, e := modules.DNSRecords.Delete(s, opts.ID, nil)
if e != nil {
return e
}
printObject(dns)
return nil
})
R(&options.DNSGetOptions{}, "dns-public", "Make a dns record publicly available", func(s *mcclient.ClientSession, opts *options.DNSGetOptions) error {
dns, e := modules.DNSRecords.PerformAction(s, opts.ID, "public", nil)
if e != nil {
return e
}
printObject(dns)
return nil
})
R(&options.DNSGetOptions{}, "dns-private", "Make a dns record private", func(s *mcclient.ClientSession, opts *options.DNSGetOptions) error {
dns, e := modules.DNSRecords.PerformAction(s, opts.ID, "private", nil)
if e != nil {
return e
}
printObject(dns)
return nil
})
R(&options.DNSGetOptions{}, "dns-enable", "Enable dns record", func(s *mcclient.ClientSession, opts *options.DNSGetOptions) error {
dns, e := modules.DNSRecords.PerformAction(s, opts.ID, "enable", nil)
if e != nil {
return e
}
printObject(dns)
return nil
})
R(&options.DNSGetOptions{}, "dns-disable", "Disable dns record", func(s *mcclient.ClientSession, opts *options.DNSGetOptions) error {
dns, e := modules.DNSRecords.PerformAction(s, opts.ID, "disable", nil)
if e != nil {
return e
}
printObject(dns)
return nil
})
R(&options.DNSUpdateRecordsOptions{}, "dns-add-records", "Add DNS records to a name", func(s *mcclient.ClientSession, opts *options.DNSUpdateRecordsOptions) error {
params, err := opts.Params()
if err != nil {
return err
}
dns, e := modules.DNSRecords.PerformAction(s, opts.ID, "add-records", params)
if e != nil {
return e
}
printObject(dns)
return nil
})
R(&options.DNSUpdateRecordsOptions{}, "dns-remove-records", "Remove DNS records from a name", func(s *mcclient.ClientSession, opts *options.DNSUpdateRecordsOptions) error {
params, err := opts.Params()
if err != nil {
return err
}
dns, e := modules.DNSRecords.PerformAction(s, opts.ID, "remove-records", params)
if e != nil {
return e
}
printObject(dns)
return nil
})
cmd := shell.NewResourceCmd(&modules.DnsRecords).WithKeyword("dns-record")
cmd.List(&compute.DnsRecordListOptions{})
cmd.Create(&compute.DnsRecordCreateOptions{})
cmd.Update(&compute.DnsRecordUpdateOptions{})
cmd.Show(&compute.DnsRecordIdOptions{})
cmd.Delete(&compute.DnsRecordIdOptions{})
cmd.Perform("enable", &compute.DnsRecordIdOptions{})
cmd.Perform("disable", &compute.DnsRecordIdOptions{})
}
-33
View File
@@ -1,33 +0,0 @@
// Copyright 2019 Yunion
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package compute
import (
"yunion.io/x/onecloud/cmd/climc/shell"
modules "yunion.io/x/onecloud/pkg/mcclient/modules/compute"
"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{})
}
+11 -14
View File
@@ -22,23 +22,20 @@ import (
"yunion.io/x/onecloud/cmd/climc/shell"
modules "yunion.io/x/onecloud/pkg/mcclient/modules/compute"
"yunion.io/x/onecloud/pkg/mcclient/options"
"yunion.io/x/onecloud/pkg/mcclient/options/compute"
)
func init() {
cmd := shell.NewResourceCmd(&modules.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{})
cmd.List(&compute.SDnsZoneListOptions{})
cmd.Show(&compute.SDnsZoneIdOptions{})
cmd.ClassShow(&compute.DnsZoneCapabilitiesOptions{})
cmd.Delete(&compute.SDnsZoneIdOptions{})
cmd.Create(&compute.DnsZoneCreateOptions{})
cmd.Perform("syncstatus", &compute.SDnsZoneIdOptions{})
cmd.Perform("purge", &compute.SDnsZoneIdOptions{})
cmd.Perform("add-vpcs", &compute.DnsZoneAddVpcsOptions{})
cmd.Perform("remove-vpcs", &compute.DnsZoneRemoveVpcsOptions{})
cmd.GetWithCustomShow("exports", func(result jsonutils.JSONObject) {
rr := make(map[string]string)
err := result.Unmarshal(&rr)
@@ -49,5 +46,5 @@ func init() {
for _, v := range rr {
fmt.Printf("%s\n", v)
}
}, &options.SDnsZoneIdOptions{})
}, &compute.SDnsZoneIdOptions{})
}
-28
View File
@@ -1,28 +0,0 @@
// Copyright 2019 Yunion
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package compute
import (
"yunion.io/x/onecloud/cmd/climc/shell"
modules "yunion.io/x/onecloud/pkg/mcclient/modules/compute"
"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{})
}
@@ -25,6 +25,7 @@ func init() {
cmd := shell.NewResourceCmd(&compute.ExternalProjects).WithKeyword("external-project")
cmd.List(&opts.ExternalProjectListOptions{})
cmd.Create(&opts.ExternalProjectCreateOptions{})
cmd.Update(&opts.ExternalProjectUpdateOptions{})
cmd.Show(&options.BaseIdOptions{})
cmd.Perform("change-project", &opts.ExterProjectChagneProjectOptions{})
}
+21 -10
View File
@@ -23,6 +23,7 @@ import (
"yunion.io/x/log"
"yunion.io/x/pkg/errors"
"yunion.io/x/pkg/util/httputils"
"yunion.io/x/pkg/util/printutils"
"yunion.io/x/onecloud/cmd/climc/shell"
"yunion.io/x/onecloud/pkg/mcclient"
@@ -63,18 +64,32 @@ func init() {
cmd.BatchPerform("reserve-cpus", &compute.HostReserveCpusOptions{})
cmd.BatchPerform("unreserve-cpus", &options.BaseIdsOptions{})
cmd.BatchPerform("auto-migrate-on-host-down", &compute.HostAutoMigrateOnHostDownOptions{})
cmd.BatchPerform("restart-host-agent", &options.BaseIdsOptions{})
cmd.Get("ipmi", &options.BaseIdOptions{})
cmd.Get("vnc", &options.BaseIdOptions{})
cmd.Get("app-options", &options.BaseIdOptions{})
cmd.Get("tap-config", &options.BaseIdOptions{})
cmd.GetWithCustomShow("nics", func(data jsonutils.JSONObject) {
results := printutils.ListResult{}
err := data.Unmarshal(&results)
if err == nil {
printutils.PrintJSONList(&results, []string{
"mac",
"vlan_id",
"interface",
"bridge",
"ip_addr",
"net",
"wire",
})
} else {
fmt.Println("error", err)
}
}, &options.BaseIdOptions{})
R(&options.BaseIdOptions{}, "host-logininfo", "Get SSH login information of a host", func(s *mcclient.ClientSession, args *options.BaseIdOptions) error {
srvid, e := modules.Hosts.GetId(s, args.ID, nil)
if e != nil {
return e
}
i, e := modules.Hosts.GetLoginInfo(s, srvid, nil)
i, e := modules.Hosts.PerformAction(s, args.ID, "login-info", nil)
if e != nil {
return e
}
@@ -575,11 +590,7 @@ func init() {
Port int `help:"SSH service port" default:"22"`
}
R(&HostSSHLoginOptions{}, "host-ssh", "SSH login of a host", func(s *mcclient.ClientSession, args *HostSSHLoginOptions) error {
srvid, e := modules.Hosts.GetId(s, args.ID, nil)
if e != nil {
return e
}
i, e := modules.Hosts.GetLoginInfo(s, srvid, nil)
i, e := modules.Hosts.PerformAction(s, args.ID, "login-info", nil)
privateKey := ""
if e != nil {
if httputils.ErrorCode(e) == 404 || e.Error() == "ciphertext too short" {
-123
View File
@@ -1,123 +0,0 @@
// Copyright 2019 Yunion
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package compute
import (
"yunion.io/x/jsonutils"
"yunion.io/x/pkg/util/printutils"
"yunion.io/x/onecloud/pkg/mcclient"
modules "yunion.io/x/onecloud/pkg/mcclient/modules/compute"
"yunion.io/x/onecloud/pkg/mcclient/options"
)
func init() {
type HostWireListOptions struct {
options.BaseListOptions
Host string `help:"ID or Name of Host"`
Wire string `help:"ID or Name of Wire"`
}
R(&HostWireListOptions{}, "host-wire-list", "List host wire", func(s *mcclient.ClientSession, args *HostWireListOptions) error {
var params *jsonutils.JSONDict
{
var err error
params, err = args.BaseListOptions.Params()
if err != nil {
return err
}
}
var result *printutils.ListResult
var err error
if len(args.Host) > 0 {
result, err = modules.Hostwires.ListDescendent(s, args.Host, params)
} else if len(args.Wire) > 0 {
result, err = modules.Hostwires.ListDescendent2(s, args.Wire, params)
} else {
result, err = modules.Hostwires.List(s, params)
}
if err != nil {
return err
}
printList(result, modules.Hostwires.GetColumns(s))
return nil
})
type HostWireDetailOptions struct {
HOST string `help:"ID or Name of Host"`
WIRE string `help:"ID or Name of Wire"`
}
R(&HostWireDetailOptions{}, "host-wire-show", "Show host wire details", func(s *mcclient.ClientSession, args *HostWireDetailOptions) error {
result, err := modules.Hostwires.Get(s, args.HOST, args.WIRE, nil)
if err != nil {
return err
}
printObject(result)
return nil
})
type HostWireUpdateOptions struct {
HOST string `help:"ID or Name of Host"`
WIRE string `help:"ID or Name of Wire"`
MacAddr string `help:"Mac address"`
Interface string `help:"Interface"`
Bridge string `help:"Bridge"`
IsMaster string `help:"Master interface" choices:"true|false"`
}
R(&HostWireUpdateOptions{}, "host-wire-update", "Update host wire information", func(s *mcclient.ClientSession, args *HostWireUpdateOptions) error {
params := jsonutils.NewDict()
if len(args.MacAddr) > 0 {
params.Add(jsonutils.NewString(args.MacAddr), "mac_addr")
}
if len(args.Interface) > 0 {
params.Add(jsonutils.NewString(args.Interface), "interface")
}
if len(args.Bridge) > 0 {
params.Add(jsonutils.NewString(args.Bridge), "bridge")
}
if len(args.IsMaster) > 0 {
if args.IsMaster == "true" {
params.Add(jsonutils.JSONTrue, "is_master")
} else {
params.Add(jsonutils.JSONFalse, "is_master")
}
}
result, err := modules.Hostwires.Update(s, args.HOST, args.WIRE, nil, params)
if err != nil {
return err
}
printObject(result)
return nil
})
type HostWireDetachOptions struct {
HOST string `help:"ID or Name of Host"`
WIRE string `help:"ID or Name of Wire"`
MacAddr string `help:"Host wire mac addr"`
}
R(&HostWireDetachOptions{}, "host-wire-detach", "Detach host from wire", func(s *mcclient.ClientSession, args *HostWireDetachOptions) error {
params := jsonutils.NewDict()
if len(args.MacAddr) > 0 {
params.Set("mac_addr", jsonutils.NewString(args.MacAddr))
}
result, err := modules.Hostwires.Detach(s, args.HOST, args.WIRE, params)
if err != nil {
return err
}
printObject(result)
return nil
})
}
+11 -158
View File
@@ -15,167 +15,20 @@
package compute
import (
"fmt"
"io/ioutil"
"yunion.io/x/jsonutils"
"yunion.io/x/onecloud/pkg/mcclient"
"yunion.io/x/onecloud/cmd/climc/shell"
modules "yunion.io/x/onecloud/pkg/mcclient/modules/compute"
"yunion.io/x/onecloud/pkg/mcclient/options"
"yunion.io/x/onecloud/pkg/mcclient/options/compute"
)
func init() {
type KeypairList struct {
options.BaseListOptions
}
R(&KeypairList{}, "keypair-list", "List keypairs.", func(s *mcclient.ClientSession, args *KeypairList) error {
var params *jsonutils.JSONDict
{
var err error
params, err = args.BaseListOptions.Params()
if err != nil {
return err
}
}
result, err := modules.Keypairs.List(s, params)
if err != nil {
return err
}
printList(result, modules.Keypairs.GetColumns(s))
return nil
})
type KeypairCreate struct {
NAME string `help:"Name of keypair to be created"`
Scheme string `help:"Scheme of keypair, default is RSA" choices:"RSA" default:"RSA"`
PublicKey string `help:"Publickey of keypair"`
Desc string `help:"Short description of keypair"`
}
R(&KeypairCreate{}, "keypair-create", "Create a new keypair", func(s *mcclient.ClientSession, args *KeypairCreate) error {
params := jsonutils.NewDict()
params.Add(jsonutils.NewString(args.NAME), "name")
if len(args.Scheme) > 0 {
params.Add(jsonutils.NewString(args.Scheme), "scheme")
}
if len(args.PublicKey) > 0 {
params.Add(jsonutils.NewString(args.PublicKey), "public_key")
}
if len(args.Desc) > 0 {
params.Add(jsonutils.NewString(args.Desc), "description")
}
result, e := modules.Keypairs.Create(s, params)
if e != nil {
return e
}
printObject(result)
return nil
})
type KeypairUpdate struct {
ID string `help:"ID of keypair to be updated"`
Name string `help:"New name of keypair"`
Desc string `help:"Short description of keypair"`
}
R(&KeypairUpdate{}, "keypair-update", "Update a keypair", func(s *mcclient.ClientSession, args *KeypairUpdate) 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")
}
result, e := modules.Keypairs.Update(s, args.ID, params)
if e != nil {
return e
}
printObject(result)
return nil
})
type KeypairDelete struct {
ID string `help:"ID of keypair to be deleted"`
}
R(&KeypairDelete{}, "keypair-delete", "Delete a keypair", func(s *mcclient.ClientSession, args *KeypairDelete) error {
result, e := modules.Keypairs.Delete(s, args.ID, nil)
if e != nil {
return e
}
printObject(result)
return nil
})
type KeypairShow struct {
ID string `help:"ID of keypair to be shown"`
}
R(&KeypairShow{}, "keypair-show", "Show details of a keypair", func(s *mcclient.ClientSession, args *KeypairShow) error {
result, e := modules.Keypairs.Get(s, args.ID, nil)
if e != nil {
return e
}
printObject(result)
return nil
})
type KeypairImport struct {
NAME string `help:"Name of keypair to be imported"`
PublicKey string `help:"Filename of public key file, or public key can be supplied via stdin"`
Desc string `help:"Short description of keypair"`
}
R(&KeypairImport{}, "keypair-import", "Create a new keypair with a existing public key", func(s *mcclient.ClientSession, args *KeypairImport) error {
params := jsonutils.NewDict()
params.Add(jsonutils.NewString(args.NAME), "name")
if len(args.PublicKey) > 0 {
content, e := ioutil.ReadFile(args.PublicKey)
if e != nil {
params.Add(jsonutils.NewString(args.PublicKey), "public_key")
} else {
params.Add(jsonutils.NewString(string(content)), "public_key")
}
} else {
return fmt.Errorf("no public key provided")
}
if len(args.Desc) > 0 {
params.Add(jsonutils.NewString(args.Desc), "description")
}
result, e := modules.Keypairs.Create(s, params)
if e != nil {
return e
}
printObject(result)
return nil
})
type KeypairPrivateKey struct {
ID string `help:"ID of keypair to fetch"`
}
R(&KeypairPrivateKey{}, "keypair-privatekey", "Fetch the private key of a keypair, this can be done once only", func(s *mcclient.ClientSession, args *KeypairPrivateKey) error {
result, e := modules.Keypairs.GetSpecific(s, args.ID, "privatekey", nil)
if e != nil {
return e
}
key, e := result.GetString("private_key")
if e != nil {
return fmt.Errorf("Private key has been fetched")
}
fmt.Printf("%s", key)
return nil
})
cmd := shell.NewResourceCmd(&modules.Keypairs)
cmd.List(&compute.KeypairList{})
cmd.Create(&compute.KeypairCreate{})
cmd.Update(&compute.KeypairUpdate{})
cmd.Delete(&compute.KeyPairIdOptions{})
cmd.Show(&compute.KeyPairIdOptions{})
cmd.Get("privatekey", &compute.KeyPairIdOptions{})
cmd.Perform("public", &options.BasePublicOptions{})
cmd.Perform("private", &compute.KeyPairIdOptions{})
}
+14
View File
@@ -1,3 +1,17 @@
// Copyright 2019 Yunion
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package compute
import (
+2 -2
View File
@@ -22,8 +22,8 @@ import (
func init() {
cmd := shell.NewResourceCmd(&modules.NetworkAddresses).WithContextManager(&modules.Wires)
cmd.BatchCreate(&options.NetworkAddressCreateOptions{})
// cmd.BatchCreate(&options.NetworkAddressCreateOptions{})
cmd.List(&options.NetworkAddressListOptions{})
cmd.Show(&options.NetworkAddressIdOptions{})
cmd.Delete(&options.NetworkAddressIdOptions{})
cmd.BatchDelete(&options.NetworkAddressIdsOptions{})
}
+1
View File
@@ -43,6 +43,7 @@ func init() {
cmd.Get("change-owner-candidate-domains", &compute_options.NetworkIdOptions{})
cmd.Perform("set-class-metadata", &options.ResourceMetadataOptions{})
cmd.Perform("switch-wire", &compute_options.NetworkSwitchWireOptions{})
cmd.Perform("sync-additional-wires", &compute_options.NetworkSyncAdditionalWiresOptions{})
type NetworkShareOptions struct {
ID string `help:"ID or Name of the zone to show"`
-30
View File
@@ -1,30 +0,0 @@
// Copyright 2019 Yunion
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package compute
import (
"yunion.io/x/onecloud/cmd/climc/shell"
modules "yunion.io/x/onecloud/pkg/mcclient/modules/compute"
"yunion.io/x/onecloud/pkg/mcclient/options/compute"
)
func init() {
cmd := shell.NewResourceCmd(&modules.SecGroupCaches).WithKeyword("secgroup-cache")
cmd.List(&compute.SecGroupCacheListOptions{})
cmd.Show(&compute.SecGroupCacheIdOptions{})
cmd.Delete(&compute.SecGroupCacheIdOptions{})
cmd.Perform("syncstatus", &compute.SecGroupCacheIdOptions{})
cmd.Get("references", &compute.SecGroupCacheIdOptions{})
}
+1 -4
View File
@@ -27,13 +27,10 @@ func init() {
cmd.Show(&options.SecgroupIdOptions{})
cmd.Update(&options.BaseUpdateOptions{})
cmd.Delete(&options.SecgroupIdOptions{})
cmd.Perform("merge", &options.SecgroupMergeOptions{})
cmd.Perform("public", &options.SecgroupIdOptions{})
cmd.Perform("syncstatus", &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{})
cmd.Perform("change-owner", &options.SecgroupChangeOwnerOptions{})
cmd.Perform("import-rules", &options.SecgroupImportRulesOptions{})
}
+12 -7
View File
@@ -115,8 +115,13 @@ func init() {
cmd.Perform("qga-set-password", &options.ServerQgaSetPassword{})
cmd.Perform("qga-command", &options.ServerQgaCommand{})
cmd.Perform("qga-ping", &options.ServerQgaPing{})
cmd.Perform("qga-guest-info-task", &options.ServerQgaGuestInfoTask{})
cmd.Perform("qga-get-network", &options.ServerQgaGetNetwork{})
cmd.Perform("set-password", &options.ServerSetPasswordOptions{})
cmd.Perform("set-boot-index", &options.ServerSetBootIndexOptions{})
cmd.Perform("reset-nic-traffic-limit", &options.ServerNicTrafficLimitOptions{})
cmd.Perform("set-nic-traffic-limit", &options.ServerNicTrafficLimitOptions{})
cmd.Perform("add-sub-ips", &options.ServerAddSubIpsOptions{})
cmd.Get("vnc", new(options.ServerVncOptions))
cmd.Get("desc", new(options.ServerIdOptions))
@@ -296,11 +301,6 @@ func init() {
})
R(&options.ServerLoginInfoOptions{}, "server-logininfo", "Get login info of a server", func(s *mcclient.ClientSession, opts *options.ServerLoginInfoOptions) error {
srvid, e := modules.Servers.GetId(s, opts.ID, nil)
if e != nil {
return e
}
params := jsonutils.NewDict()
if len(opts.Key) > 0 {
privateKey, e := ioutil.ReadFile(opts.Key)
@@ -310,7 +310,7 @@ func init() {
params.Add(jsonutils.NewString(string(privateKey)), "private_key")
}
i, e := modules.Servers.GetLoginInfo(s, srvid, params)
i, e := modules.Servers.PerformAction(s, opts.ID, "login-info", params)
if e != nil {
return e
}
@@ -396,10 +396,15 @@ func init() {
type ServerRemoveExtraOption struct {
ID string `help:"ID or name of server"`
KEY string `help:"Option key"`
Value string `help:"Option value"`
}
R(&ServerRemoveExtraOption{}, "server-remove-extra-options", "Remove server extra options", func(s *mcclient.ClientSession, args *ServerRemoveExtraOption) error {
params := jsonutils.NewDict()
params.Add(jsonutils.NewString(args.KEY), "key")
if len(args.Value) > 0 {
params.Add(jsonutils.NewString(args.Value), "value")
}
result, err := modules.Servers.PerformAction(s, args.ID, "del-extra-option", params)
if err != nil {
return err
@@ -857,7 +862,7 @@ func init() {
privateKey = string(key)
}
i, e := modules.Servers.GetLoginInfo(s, srvid, params)
i, e := modules.Servers.PerformAction(s, srvid, "login-info", params)
if e != nil {
return e
}
+61 -3
View File
@@ -16,11 +16,17 @@ package compute
import (
"fmt"
"os"
"path"
"yunion.io/x/jsonutils"
"yunion.io/x/pkg/errors"
"yunion.io/x/onecloud/pkg/hostman/guestfs/fsdriver"
deployapi "yunion.io/x/onecloud/pkg/hostman/hostdeployer/apis"
"yunion.io/x/onecloud/pkg/mcclient"
modules "yunion.io/x/onecloud/pkg/mcclient/modules/compute"
"yunion.io/x/onecloud/pkg/util/procutils"
)
func init() {
@@ -28,7 +34,8 @@ func init() {
Project string `help:"get keypair for specific project"`
Admin bool `help:"get admin keypair, sysadmin ONLY option"`
}
R(&SshkeypairQueryOptions{}, "sshkeypair-show", "Get ssh keypairs", func(s *mcclient.ClientSession, args *SshkeypairQueryOptions) error {
getSshKeypair := func(s *mcclient.ClientSession, args *SshkeypairQueryOptions) (string, string, error) {
query := jsonutils.NewDict()
if args.Admin {
query.Add(jsonutils.JSONTrue, "admin")
@@ -37,22 +44,73 @@ func init() {
if len(args.Project) == 0 {
listResult, err := modules.Sshkeypairs.List(s, query)
if err != nil {
return err
return "", "", err
}
keys = listResult.Data[0]
} else {
result, err := modules.Sshkeypairs.GetById(s, args.Project, query)
if err != nil {
return err
return "", "", err
}
keys = result
}
privKey, _ := keys.GetString("private_key")
pubKey, _ := keys.GetString("public_key")
return privKey, pubKey, nil
}
R(&SshkeypairQueryOptions{}, "sshkeypair-show", "Get ssh keypairs", func(s *mcclient.ClientSession, args *SshkeypairQueryOptions) error {
privKey, pubKey, err := getSshKeypair(s, args)
if err != nil {
return err
}
fmt.Print(privKey)
fmt.Print(pubKey)
return nil
})
type SshkeypairInjectOptions struct {
SshkeypairQueryOptions
TargetDir string `help:"Target directory to save cloud ssh keypair"`
}
R(&SshkeypairInjectOptions{}, "sshkeypair-inject", "Inject ssh keypairs to local path", func(s *mcclient.ClientSession, args *SshkeypairInjectOptions) error {
_, pubKey, err := getSshKeypair(s, &args.SshkeypairQueryOptions)
if err != nil {
return err
}
targetDir := args.TargetDir
if targetDir == "" {
homeDir, err := os.UserHomeDir()
if err != nil {
return errors.Wrap(err, "get current user's home dir")
}
targetDir = homeDir
}
sshDir := path.Join(targetDir, ".ssh")
// MkdirAll anyways
os.MkdirAll(sshDir, 0700)
authFile := path.Join(sshDir, "authorized_keys")
var oldKeys string
if procutils.NewCommand("test", "-f", authFile).Run() == nil {
output, err := procutils.NewCommand("cat", authFile).Output()
if err != nil {
return errors.Wrapf(err, "cat: %s", output)
}
oldKeys = string(output)
}
pubKeys := &deployapi.SSHKeys{AdminPublicKey: pubKey}
newKeys := fsdriver.MergeAuthorizedKeys(oldKeys, pubKeys)
if output, err := procutils.NewCommand(
"sh", "-c", fmt.Sprintf("echo '%s' > %s", newKeys, authFile)).Output(); err != nil {
return errors.Wrapf(err, "write public keys: %s", output)
}
if output, err := procutils.NewCommand(
"chmod", "0644", authFile).Output(); err != nil {
return errors.Wrapf(err, "chmod failed %s", output)
}
return nil
})
}
+52 -3
View File
@@ -15,19 +15,25 @@
package compute
import (
"yunion.io/x/jsonutils"
"fmt"
"time"
"yunion.io/x/jsonutils"
"yunion.io/x/pkg/util/printutils"
"yunion.io/x/onecloud/cmd/climc/shell"
"yunion.io/x/onecloud/pkg/mcclient"
modules "yunion.io/x/onecloud/pkg/mcclient/modules/compute"
"yunion.io/x/onecloud/pkg/mcclient/modules/identity"
"yunion.io/x/onecloud/pkg/mcclient/modules/image"
"yunion.io/x/onecloud/pkg/mcclient/modules/k8s"
"yunion.io/x/onecloud/pkg/mcclient/options"
)
type GeneralUsageOptions struct {
HostType []string `help:"Host types" choices:"hypervisor|baremetal|esxi|xen|kubelet|hyperv|aliyun|azure|aws|huawei|qcloud|openstack|ucloud|zstack|google|ctyun"`
Provider []string `help:"Provider" choices:"OneCloud|VMware|Aliyun|Azure|Aws|Qcloud|Huawei|OpenStack|Ucloud|ZStack|Google|Ctyun"`
Brand []string `help:"Brands" choices:"OneCloud|VMware|Aliyun|Azure|Aws|Qcloud|Huawei|OpenStack|Ucloud|ZStack|DStack|Google|Ctyun"`
Provider []string `help:"Provider" choices:"OneCloud|VMware|Aliyun|Azure|Aws|Qcloud|Huawei|OpenStack|Ucloud|VolcEngine|ZStack|Google|Ctyun"`
Brand []string `help:"Brands" choices:"OneCloud|VMware|Aliyun|Azure|Aws|Qcloud|Huawei|OpenStack|Ucloud|VolcEngine|ZStack|DStack|Google|Ctyun"`
Project string `help:"show usage of specified project"`
ProjectDomain string `help:"show usage of specified domain"`
@@ -58,7 +64,50 @@ func fetchHostTypeOptions(args *GeneralUsageOptions) *jsonutils.JSONDict {
return params
}
type HistoryUsageListOptions struct {
options.ExtraListOptions
StartDate time.Time
EndDate time.Time
Interval string `choices:"hour|day|month|year" default:"day"`
}
func (opts *HistoryUsageListOptions) Params() (jsonutils.JSONObject, error) {
if opts.StartDate.IsZero() || opts.EndDate.IsZero() {
opts.EndDate = time.Now()
switch opts.Interval {
case "hour":
opts.StartDate = time.Now().Add(time.Hour * -24)
case "day":
opts.StartDate = time.Now().AddDate(0, 0, -30)
case "month":
opts.StartDate = time.Now().AddDate(0, -12, 0)
case "year":
opts.StartDate = time.Now().AddDate(-3, 0, 0)
}
}
return jsonutils.Marshal(opts), nil
}
func (o *HistoryUsageListOptions) GetExportKeys() string {
return ""
}
func (o *HistoryUsageListOptions) GetId() string {
return ""
}
func init() {
cmd := shell.NewResourceCmd(modules.HistoryUsages)
cmd.GetWithCustomShow("list", func(data jsonutils.JSONObject) {
ret := map[string][]jsonutils.JSONObject{}
data.Unmarshal(&ret)
for k, d := range ret {
fmt.Println(k)
printutils.PrintJSONList(&printutils.ListResult{Data: d}, nil)
}
}, &HistoryUsageListOptions{})
R(&GeneralUsageOptions{}, "usage", "Show general usage", func(s *mcclient.ClientSession, args *GeneralUsageOptions) error {
params := fetchHostTypeOptions(args)
if args.Project != "" {
+2
View File
@@ -34,6 +34,8 @@ func init() {
cmd.Perform("class-metadata", &options.ResourceMetadataOptions{})
cmd.Perform("set-class-metadata", &options.ResourceMetadataOptions{})
cmd.Perform("metadata", &options.ResourceMetadataOptions{})
cmd.Perform("enable", &identity_options.UserDetailOptions{})
cmd.Perform("disable", &identity_options.UserDetailOptions{})
/*type UserListOptions struct {
options.BaseListOptions
+20
View File
@@ -87,6 +87,26 @@ func initKubeCluster() {
return nil
})
type SetKubeconfigOptions struct {
o.IdentOptions
FILE string `json:"filepath of kubeconfig"`
}
R(new(SetKubeconfigOptions), cmdN("set-kubeconfig"), "Set kubeconfig of a cluster", func(s *mcclient.ClientSession, args *SetKubeconfigOptions) error {
content, err := ioutil.ReadFile(args.FILE)
if err != nil {
return errors.Wrapf(err, "read file content of %q", args.FILE)
}
input := map[string]string{
"kubeconfig": string(content),
}
ret, err := k8s.KubeClusters.PerformAction(s, args.ID, "set-kubeconfig", jsonutils.Marshal(input))
if err != nil {
return err
}
printObject(ret)
return nil
})
R(&o.ClusterGetAddonsOpt{}, cmdN("addons"), "Get addon manifest of a cluster", func(s *mcclient.ClientSession, args *o.ClusterGetAddonsOpt) error {
params, err := args.Params()
if err != nil {
+29 -10
View File
@@ -33,6 +33,7 @@ func initContainerRegistry() {
cmd := NewK8sResourceCmd(k8s.ContainerRegistries)
cmd.List(new(o.RegistryListOptions))
cmd.Show(new(o.RegistryGetOptions))
cmd.Delete(new(o.RegistryGetOptions))
cmd.Create(new(o.RegistryCreateOptions))
cmd.Get("images", new(o.RegistryGetImagesOptions))
cmd.Get("image-tags", new(o.RegistryGetImageTagsOptions))
@@ -66,20 +67,38 @@ func initContainerRegistry() {
})
type DownloadOptions struct {
REGISTRY string `help:"The name or id of registry" json:"-"`
NAME string `help:"The name of image, e.g. 'influxdb:1.7.7'"`
Registry string `help:"The name or id of registry" json:"-"`
Output string `help:"Saved file path"`
Insecure bool `help:"Set insecure"`
Username string `help:"Image registry username, effective only when --registry is not specified"`
Password string `help:"Image registry password, effective only when --registry is not specified"`
}
R(new(DownloadOptions), "k8s-container-registry-download-image", "Download container image to a file", func(s *mcclient.ClientSession, args *DownloadOptions) error {
parts := strings.Split(args.NAME, ":")
if len(parts) != 2 {
return errors.Errorf("invalid NAME %q, use format <name>:<tag>", args.NAME)
}
name := parts[0]
tag := parts[1]
fileName, src, size, err := k8s.ContainerRegistries.DownloadImage(s, args.REGISTRY, name, tag)
if err != nil {
return errors.Wrap(err, "download chart")
var (
fileName string
src io.Reader
size int64
err error
)
if args.Registry != "" {
parts := strings.Split(args.NAME, ":")
if len(parts) != 2 {
return errors.Errorf("invalid NAME %q, use format <name>:<tag>", args.NAME)
}
name := parts[0]
tag := parts[1]
fileName, src, size, err = k8s.ContainerRegistries.DownloadImage(s, args.Registry, name, tag)
if err != nil {
return errors.Wrap(err, "download chart")
}
} else {
fileName, src, size, err = k8s.ContainerRegistries.DownloadImageByManager(s, &k8s.DownloadImageByManagerInput{
Insecure: args.Insecure,
Image: args.NAME,
Username: args.Username,
Password: args.Password,
})
}
output := args.Output
if output == "" && fileName != "" {
+1
View File
@@ -31,4 +31,5 @@ func initKubeMachine() {
cmd.Perform("terminate", new(o.IdentOptions))
cmd.Get("networkaddress", new(o.MachineListNetworkAddressOptions))
cmd.Perform("attach-networkaddress", new(o.MachineAttachNetworkAddressOptions))
cmd.Perform("post-prepare-resource", new(o.IdentOptions))
}
+25 -12
View File
@@ -24,18 +24,20 @@ import (
)
type BaseActionListOptions struct {
Scope string `help:"scope" choices:"project|domain|system"`
Since string `help:"Show logs since specific date" metavar:"DATETIME"`
Until string `help:"Show logs until specific date" metavar:"DATETIME"`
Limit int64 `help:"Limit number of logs" default:"20"`
Offset int64 `help:"Offset"`
Ascending bool `help:"Ascending order"`
Descending bool `help:"Descending order"`
Action []string `help:"Log action"`
Search string `help:"Filter action logs by obj_name, using 'like' syntax."`
Admin bool `help:"admin mode"`
Succ bool `help:"Show success action log only"`
Fail bool `help:"Show failed action log only"`
Scope string `help:"scope" choices:"project|domain|system"`
Since string `help:"Show logs since specific date" metavar:"DATETIME"`
Until string `help:"Show logs until specific date" metavar:"DATETIME"`
Limit int64 `help:"Limit number of logs" default:"20"`
Offset int64 `help:"Offset"`
Ascending bool `help:"Ascending order"`
Descending bool `help:"Descending order"`
Action []string `help:"Log action"`
Search string `help:"Filter action logs by obj_name, using 'like' syntax."`
Admin bool `help:"admin mode"`
Succ bool `help:"Show success action log only"`
Fail bool `help:"Show failed action log only"`
SystemAccount bool `help:"Show system account log"`
NormalAccount bool `help:"Show normal account log"`
User []string `help:"filter by operator user"`
Project []string `help:"filter by owner project"`
@@ -113,6 +115,17 @@ func doActionList(s *mcclient.ClientSession, args *ActionListOptions) error {
if args.Fail {
params.Add(jsonutils.JSONFalse, "success")
}
if args.SystemAccount && args.NormalAccount {
return fmt.Errorf("system account and normal account can't go together")
}
if args.SystemAccount {
params.Add(jsonutils.JSONTrue, "is_system_account")
}
if args.NormalAccount {
params.Add(jsonutils.JSONFalse, "is_system_account")
}
logs, err := modules.Actions.List(s, params)
if err != nil {
return err
+5
View File
@@ -62,6 +62,11 @@ func init() {
"k8s",
"monitor",
"bingocloud",
"ksyun",
"baidu",
"cucloud",
"qingcloud",
"volcengine",
}
const (
+8 -1
View File
@@ -23,6 +23,7 @@ import (
"yunion.io/x/pkg/util/printutils"
"yunion.io/x/pkg/utils"
"yunion.io/x/onecloud/pkg/apis"
"yunion.io/x/onecloud/pkg/mcclient"
"yunion.io/x/onecloud/pkg/mcclient/modulebase"
modules "yunion.io/x/onecloud/pkg/mcclient/modules"
@@ -91,7 +92,13 @@ func init() {
vers := map[string]string{}
for _, service := range services {
serviceType, _ := service.GetString("type")
if utils.IsInStringArray(serviceType, []string{"offlinecloudmeta"}) {
if utils.IsInStringArray(serviceType, []string{
apis.SERVICE_TYPE_OFFLINE_CLOUDMETA,
apis.SERVICE_TYPE_CLOUDMETA,
apis.SERVICE_TYPE_INFLUXDB,
apis.SERVICE_TYPE_ETCD,
"torrent-tracker",
}) {
continue
}
ver, err := modules.GetVersion(s, serviceType)
+24
View File
@@ -138,4 +138,28 @@ func init() {
}
return nil
})
type NotificationContactInput struct {
Subject string
Body string
ContactType []string
ReceiverIds []string
RobotIds []string
RoleIds []string
}
R(&NotificationContactInput{}, "notify-contact-send", "Send notify event message", func(s *mcclient.ClientSession, args *NotificationContactInput) error {
params := api.NotificationManagerContactNotifyInput{
Subject: args.Subject,
Body: args.Body,
ReceiverIds: args.ReceiverIds,
ContactTypes: args.ContactType,
RobotIds: args.RobotIds,
RoleIds: args.RoleIds,
}
_, err := modules.Notification.PerformClassAction(s, "contact-notify", jsonutils.Marshal(params))
if err != nil {
return fmt.Errorf("unable to ContactNotify: %s", err)
}
return nil
})
}
-3
View File
@@ -21,9 +21,6 @@ import (
)
func init() {
cmd := shell.NewResourceCmd(&modules.NotifyTopic).WithKeyword("notify-topic")
cmd.List(new(notify.TopicListOptions))
cmd1 := shell.NewResourceCmd(&modules.NotifySubscriber).WithKeyword("notify-subscriber")
cmd1.List(new(notify.SubscriberListOptions))
cmd1.Create(new(notify.SubscriberCreateOptions))
@@ -12,16 +12,17 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package compute
package notify
import (
"yunion.io/x/onecloud/cmd/climc/shell"
modules "yunion.io/x/onecloud/pkg/mcclient/modules/compute"
"yunion.io/x/onecloud/pkg/mcclient/options"
modules "yunion.io/x/onecloud/pkg/mcclient/modules/notify"
options "yunion.io/x/onecloud/pkg/mcclient/options/notify"
)
func init() {
cmd := shell.NewResourceCmd(&modules.DnsTrafficPolicies).WithKeyword("dns-trafficpolicy")
cmd.List(&options.DnsTrafficPolicyListOptions{})
cmd.Create(&options.DnsTrafficPolicyCreateOptions{})
cmd := shell.NewResourceCmd(&modules.NotifyTopic).WithKeyword("notify-topic")
cmd.List(new(options.TopicListOptions))
cmd.Update(new(options.TopicUpdateOptions))
cmd.Show(new(options.TopicOptions))
}
@@ -73,9 +73,10 @@ func init() {
}
type CycleTimer struct {
CycleCycleType string `help:"Cycle type for cycle timer" json:"cycle_type" choices:"day|week|month"`
CycleCycleType string `help:"Cycle type for cycle timer" json:"cycle_type" choices:"hour|day|week|month"`
CycleMinute int `help:"Minute of cycle timer" json:"minute"`
CycleHour int `help:"Hour of cycle timer" json:"hour"`
CycleCycleNum int `help:"Cycle count of cycle timer" json:"cycle_num"`
CycleWeekdays []int `help:"Weekdays for cycle timer" json:"weekdays"`
CycleMonthDays []int `help:"Month days for cycle timer" json:"month_days"`
CycleStartTime string `help:"Start time for cycle timer, format:'2006-01-02 15:04:05'" json:"start_time"`
@@ -123,6 +124,7 @@ func init() {
},
CycleTimer: apis.CycleTimerCreateInput{
CycleType: args.CycleCycleType,
CycleNum: args.CycleCycleNum,
Minute: args.CycleMinute,
Hour: args.CycleHour,
WeekDays: args.CycleWeekdays,
+14
View File
@@ -1,3 +1,17 @@
// Copyright 2019 Yunion
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package main
import (
+14
View File
@@ -1,3 +1,17 @@
// Copyright 2019 Yunion
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package main
import (
+7 -6
View File
@@ -21,7 +21,6 @@ require (
github.com/ghodss/yaml v1.0.0
github.com/gin-gonic/gin v1.7.7
github.com/go-yaml/yaml v2.1.0+incompatible
github.com/golang-plus/errors v1.0.0
github.com/golang-plus/uuid v1.0.0
github.com/golang/mock v1.4.4
github.com/google/gopacket v1.1.17
@@ -84,15 +83,15 @@ require (
k8s.io/client-go v0.19.3
k8s.io/cluster-bootstrap v0.19.3
moul.io/http2curl/v2 v2.3.0
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20230728032735-a478fc65fa32
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20231027081824-0385f4b175c2
yunion.io/x/executor v0.0.0-20230705125604-c5ac3141db32
yunion.io/x/jsonutils v1.0.1-0.20230613121553-0f3b41e2ef19
yunion.io/x/log v1.0.1-0.20230411060016-feb3f46ab361
yunion.io/x/ovsdb v0.0.0-20230306173834-f164f413a900
yunion.io/x/pkg v1.0.1-0.20230711090507-0aafe0f0c9db
yunion.io/x/pkg v1.0.1-0.20231024115515-6dc7eade60ad
yunion.io/x/s3cli v0.0.0-20190917004522-13ac36d8687e
yunion.io/x/sqlchemy v1.1.2-0.20230712025503-b1892bc5944c
yunion.io/x/structarg v0.0.0-20220312084958-9c6c79c7d1c6
yunion.io/x/sqlchemy v1.1.2-0.20231017172907-561e7f013926
yunion.io/x/structarg v0.0.0-20231017124457-df4d5009457c
)
require (
@@ -162,6 +161,7 @@ require (
github.com/go-sql-driver/mysql v1.6.0 // indirect
github.com/gofrs/uuid v4.1.0+incompatible // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang-plus/errors v1.0.0 // indirect
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db // indirect
@@ -233,6 +233,8 @@ require (
github.com/tklauser/numcpus v0.4.0 // indirect
github.com/ugorji/go/codec v1.1.7 // indirect
github.com/vmware/govmomi v0.20.1 // indirect
github.com/volcengine/ve-tos-golang-sdk/v2 v2.6.2 // indirect
github.com/volcengine/volc-sdk-golang v1.0.23 // indirect
github.com/willf/bitset v1.1.9 // indirect
github.com/willf/bloom v2.0.3+incompatible // indirect
github.com/xuri/efp v0.0.0-20220603152613-6918739fd470 // indirect
@@ -253,7 +255,6 @@ require (
google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c // indirect
gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect
gopkg.in/asn1-ber.v1 v1.0.0-20181015200546-f715ec2f112d // indirect
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/ini.v1 v1.62.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
+13 -8
View File
@@ -144,6 +144,7 @@ github.com/aokoli/goutils v1.0.1 h1:7fpzNGoJ3VA8qcrm++XEE1QUe0mIwNeLa02Nwq7RDkg=
github.com/aokoli/goutils v1.0.1/go.mod h1:SijmP0QR8LtwsmDs8Yii5Z/S4trXFGFC2oO5g9DP+DQ=
github.com/apache/thrift v0.13.0 h1:5hryIiq9gtn+MiLVn0wP37kb/uTeRZgN08WoCsAhIhI=
github.com/apache/thrift v0.13.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ=
github.com/avast/retry-go v3.0.0+incompatible/go.mod h1:XtSnn+n/sHqQIpZ10K1qAevBhOOCWBLXXy3hyiqqBrY=
github.com/aws/aws-sdk-go v1.39.0 h1:74BBwkEmiqBbi2CGflEh34l0YNtIibTjZsibGarkNjo=
github.com/aws/aws-sdk-go v1.39.0/go.mod h1:hcU610XS61/+aQV88ixoOzUoG7v3b31pl2zKMmprdro=
github.com/baiyubin/aliyun-sts-go-sdk v0.0.0-20180326062324-cfa1a18b161f h1:ZNv7On9kyUzm7fvRZumSyy/IUiSC7AzL0I1jKKtwooA=
@@ -709,6 +710,10 @@ github.com/vmihailenco/msgpack v4.0.4+incompatible h1:dSLoQfGFAo3F6OoNhwUmLwVgaU
github.com/vmihailenco/msgpack v4.0.4+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk=
github.com/vmware/govmomi v0.20.1 h1:7b/SeTUB3tER8ZLGLLLH3xcnB2xeuLULXmfPFqPSRZA=
github.com/vmware/govmomi v0.20.1/go.mod h1:URlwyTFZX72RmxtxuaFL2Uj3fD1JTvZdx59bHWk6aFU=
github.com/volcengine/ve-tos-golang-sdk/v2 v2.6.2 h1:FZ7zrUf70YKVuES50mHO3z2VW0K+Arq4uGlDqb+1VA0=
github.com/volcengine/ve-tos-golang-sdk/v2 v2.6.2/go.mod h1:IrjK84IJJTuOZOTMv/P18Ydjy/x+ow7fF7q11jAxXLM=
github.com/volcengine/volc-sdk-golang v1.0.23 h1:anOslb2Qp6ywnsbyq9jqR0ljuO63kg9PY+4OehIk5R8=
github.com/volcengine/volc-sdk-golang v1.0.23/go.mod h1:AfG/PZRUkHJ9inETvbjNifTDgut25Wbkm2QoYBTbvyU=
github.com/willf/bitset v1.1.3/go.mod h1:RjeCKbqT1RxIR/KWY6phxZiaY1IyutSBfGjNPySAYV4=
github.com/willf/bitset v1.1.9 h1:GBtFynGY9ZWZmEC9sWuu41/7VBXPFCOAbCbqTflOg9c=
github.com/willf/bitset v1.1.9/go.mod h1:RjeCKbqT1RxIR/KWY6phxZiaY1IyutSBfGjNPySAYV4=
@@ -1174,8 +1179,8 @@ sigs.k8s.io/structured-merge-diff/v4 v4.0.1/go.mod h1:bJZC9H9iH24zzfZ/41RGcq60oK
sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o=
sigs.k8s.io/yaml v1.2.0 h1:kr/MCeFWJWTwyaHoR9c8EjH9OumOmoF9YGiZd7lFm/Q=
sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc=
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20230728032735-a478fc65fa32 h1:+KF/wmV1FCl41nDpVvlDi2ZvHVa8nffvhQznPBPjYC0=
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20230728032735-a478fc65fa32/go.mod h1:2sgCN7nRPQL3woLfdgqLDd92vwAHqtlz3KKiHxC5BAw=
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20231027081824-0385f4b175c2 h1:TzU51hUP26tVCY3MWrQ7bdk9OwrhuCME07c42csdX6Q=
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20231027081824-0385f4b175c2/go.mod h1:McRjoG2gaOUisB+Qa41kLCNZhr0lsCu4apEjTiphXVY=
yunion.io/x/executor v0.0.0-20230705125604-c5ac3141db32 h1:v7POYkQwo1XzOxBoIoRVr/k0V9Y5JyjpshlIFa9raug=
yunion.io/x/executor v0.0.0-20230705125604-c5ac3141db32/go.mod h1:Uxuou9WQIeJXNpy7t2fPLL0BYLvLiMvGQwY7Qc6aSws=
yunion.io/x/jsonutils v0.0.0-20190625054549-a964e1e8a051/go.mod h1:4N0/RVzsYL3kH3WE/H1BjUQdFiWu50JGCFQuuy+Z634=
@@ -1189,11 +1194,11 @@ yunion.io/x/ovsdb v0.0.0-20230306173834-f164f413a900 h1:Hu/4ERvoWaN6aiFs4h4/yvVB
yunion.io/x/ovsdb v0.0.0-20230306173834-f164f413a900/go.mod h1:0vLkNEhlmA64HViPBAnSTUMrx5QP1CLsxXmxDKQ80tc=
yunion.io/x/pkg v0.0.0-20190620104149-945c25821dbf/go.mod h1:t6rEGG2sQ4J7DhFxSZVOTjNd0YO/KlfWQyK1W4tog+E=
yunion.io/x/pkg v0.0.0-20190628082551-f4033ba2ea30/go.mod h1:t6rEGG2sQ4J7DhFxSZVOTjNd0YO/KlfWQyK1W4tog+E=
yunion.io/x/pkg v1.0.1-0.20230711090507-0aafe0f0c9db h1:GyBvo/gYl2MY5Q0SZ6Nso8WJHPonmngOtcpVfyCE0yA=
yunion.io/x/pkg v1.0.1-0.20230711090507-0aafe0f0c9db/go.mod h1:ksCJVQ+DwKrJ5QBEoU8pzrDFfDaZVAFH/iJ6yQCYxJk=
yunion.io/x/pkg v1.0.1-0.20231024115515-6dc7eade60ad h1:AoulsTEDSJbQgWeJdYW6qILEvnFJwWbsDb3YeSmZXm0=
yunion.io/x/pkg v1.0.1-0.20231024115515-6dc7eade60ad/go.mod h1:ksCJVQ+DwKrJ5QBEoU8pzrDFfDaZVAFH/iJ6yQCYxJk=
yunion.io/x/s3cli v0.0.0-20190917004522-13ac36d8687e h1:v+EzIadodSwkdZ/7bremd7J8J50Cise/HCylsOJngmo=
yunion.io/x/s3cli v0.0.0-20190917004522-13ac36d8687e/go.mod h1:0iFKpOs1y4lbCxeOmq3Xx/0AcQoewVPwj62eRluioEo=
yunion.io/x/sqlchemy v1.1.2-0.20230712025503-b1892bc5944c h1:jlJkjiL1jv6mpdV3Z0RdeEWB5U3qEwUnSjioGZmki70=
yunion.io/x/sqlchemy v1.1.2-0.20230712025503-b1892bc5944c/go.mod h1:uuPVZEyEq3sWd5vf9VjGSy6lZzof22X87OEHw9sddJQ=
yunion.io/x/structarg v0.0.0-20220312084958-9c6c79c7d1c6 h1:WuWXhY3DvhdRTzWCJ/kwt3Ss6KIq7+KqJwb+esvNGwU=
yunion.io/x/structarg v0.0.0-20220312084958-9c6c79c7d1c6/go.mod h1:EP6NSv2C0zzqBDTKumv8hPWLb3XvgMZDHQRfyuOrQng=
yunion.io/x/sqlchemy v1.1.2-0.20231017172907-561e7f013926 h1:FJ+2J0MwmxUcuN/8ukWHdK2XIoV3GGCotTCgi0w4L+w=
yunion.io/x/sqlchemy v1.1.2-0.20231017172907-561e7f013926/go.mod h1:uuPVZEyEq3sWd5vf9VjGSy6lZzof22X87OEHw9sddJQ=
yunion.io/x/structarg v0.0.0-20231017124457-df4d5009457c h1:QuLab2kSRECZRxo4Lo2KcYn6XjQFDGaZ1+x0pYDVVwQ=
yunion.io/x/structarg v0.0.0-20231017124457-df4d5009457c/go.mod h1:EP6NSv2C0zzqBDTKumv8hPWLb3XvgMZDHQRfyuOrQng=
+8 -2
View File
@@ -656,8 +656,14 @@ func doLogout(ctx context.Context, w http.ResponseWriter, req *http.Request) {
token, _, _ := fetchAuthInfo(ctx, req)
if token != nil {
// valid login, log the event
user := logclient.NewSimpleObject(token.GetUserId(), token.GetUserName(), "user")
logclient.AddActionLogWithContext(ctx, user, logclient.ACT_LOGOUT, "", token, true)
err := auth.Remove(ctx, token.GetTokenString())
if err != nil {
log.Errorf("remove token fail %s", err)
return
} else {
user := logclient.NewSimpleObject(token.GetUserId(), token.GetUserName(), "user")
logclient.AddActionLogWithContext(ctx, user, logclient.ACT_LOGOUT, "", token, true)
}
}
clearAuthCookie(w)
appsrv.DisableClientCache(w)
+1 -1
View File
@@ -12,4 +12,4 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package handler
package handler // import "yunion.io/x/onecloud/pkg/apigateway/handler"
+1 -1
View File
@@ -311,7 +311,7 @@ func (f *ResourceHandlers) getSpecHandler(ctx context.Context, w http.ResponseWr
query := req.Query()
module2, e := modulebase.GetModule(session, req.Spec())
if e != nil {
if e != nil || module.GetSpecificMethods().Has(req.Spec()) {
obj, e := module.GetSpecific(session, req.ResID(), req.Spec(), query)
if e != nil {
httperrors.GeneralServerError(ctx, w, e)
+45 -28
View File
@@ -36,33 +36,35 @@ import (
)
type sReport struct {
GenerateName string
UUID string
Version string
OsDist string
OsVersion string
QemuVersion string
CpuArchitecture string
Brands string
HostCnt int64
KvmHostCnt int64
HostCpuCnt int64
HostMemSizeMb int64
BaremetalCnt int64
BaremetalCpuCnt int64
BaremetalMemSizeMb int64
ServerCnt int64
ServerCpuCnt int64
ServerMemSizeMb int64
DiskCnt int64
DiskSizeMb int64
BucketCnt int64
RdsCnt int64
MongoDBCnt int64
KafkaCnt int64
UserCnt int64
ProjectCnt int64
DomainCnt int64
GenerateName string
UUID string
Version string
OsDist string
OsVersion string
QemuVersion string
CpuArchitecture string
Brands string
HostCnt int64
KvmHostCnt int64
VmwareHostCnt int64
HostCpuCnt int64
HostMemSizeMb int64
BaremetalCnt int64
BaremetalCpuCnt int64
BaremetalMemSizeMb int64
BaremetalStorageSizeGb int64
ServerCnt int64
ServerCpuCnt int64
ServerMemSizeMb int64
DiskCnt int64
DiskSizeMb int64
BucketCnt int64
RdsCnt int64
MongoDBCnt int64
KafkaCnt int64
UserCnt int64
ProjectCnt int64
DomainCnt int64
}
func Report(ctx context.Context, userCred mcclient.TokenCredential, isStart bool) {
@@ -83,12 +85,23 @@ func Report(ctx context.Context, userCred mcclient.TokenCredential, isStart bool
resp, err := compute.Hosts.List(s, jsonutils.Marshal(map[string]interface{}{
"scope": "system",
"hypervisor": api.HYPERVISOR_KVM,
"limit": 20,
"limit": 1,
}))
if err != nil {
return nil, errors.Wrapf(err, "Hosts.List")
}
ret.KvmHostCnt = int64(resp.Total)
resp, err = compute.Hosts.List(s, jsonutils.Marshal(map[string]interface{}{
"scope": "system",
"hypervisor": api.HYPERVISOR_ESXI,
"limit": 1,
}))
if err != nil {
return nil, errors.Wrapf(err, "Hosts.List")
}
ret.VmwareHostCnt = int64(resp.Total)
osDists, osVersions, qemuVersions, archs := []string{}, []string{}, []string{}, []string{}
hosts := []api.HostDetails{}
jsonutils.Update(&hosts, resp.Data)
@@ -147,6 +160,10 @@ func Report(ctx context.Context, userCred mcclient.TokenCredential, isStart bool
ret.RdsCnt, _ = usage.Int("all.rds")
ret.MongoDBCnt, _ = usage.Int("all.mongodb")
ret.KafkaCnt, _ = usage.Int("all.kafka")
ret.BaremetalCnt, _ = usage.Int("baremetals")
ret.BaremetalCpuCnt, _ = usage.Int("baremetals.cpu")
ret.BaremetalMemSizeMb, _ = usage.Int("baremetals.memory")
ret.BaremetalStorageSizeGb, _ = usage.Int("baremetals.storage_gb")
usage, err = identity.IdentityUsages.GetUsage(s, system)
if err != nil {
return nil, errors.Wrapf(err, "IdentityUsages.GetUsage")
+3 -2
View File
@@ -78,10 +78,11 @@ func GetDBModels(opts *GetDBModelsOptions) error {
}
if !opts.InCludeOtherCloudEnv() {
listOptions.Filter = append(listOptions.Filter,
"manager_id.isnullorempty()", // len(manager_id) > 0 is for pubcloud objects
"external_id.isnullorempty()", // len(external_id) > 0 is for pubcloud objects
"manager_id.isnullorempty()", // len(manager_id) > 0 is for pubcloud objects
// "external_id.isnullorempty()", // len(external_id) > 0 is for pubcloud objects
)
listOptions.CloudEnv = "onpremise"
// listOptions.Provider = []string{"OneCloud"}
}
if inter, ok := opts.GetModelSet().(IModelSetFilter); ok {
filter := inter.ModelFilter()
+3 -2
View File
@@ -119,10 +119,11 @@ func GetModels(opts *GetModelsOptions) error {
}
if !opts.InCludeOtherCloudEnv {
listOptions.Filter = append(listOptions.Filter,
"manager_id.isnullorempty()", // len(manager_id) > 0 is for pubcloud objects
"external_id.isnullorempty()", // len(external_id) > 0 is for pubcloud objects
"manager_id.isnullorempty()", // len(manager_id) > 0 is for pubcloud objects
// "external_id.isnullorempty()", // len(external_id) > 0 is for pubcloud objects
)
listOptions.CloudEnv = "onpremise"
// listOptions.Provider = []string{"OneCloud"}
}
if inter, ok := opts.ModelSet.(IModelSetFilter); ok {
filter := inter.ModelFilter()
+34 -8
View File
@@ -64,23 +64,37 @@ type NetworkConfig struct {
// requried: false
Mac string `json:"mac"`
// 子网内的IPv4地址, 若不指定会安装子网的地址分配策略分配一个IP地址
// 如果是批量创建,指定每个网卡MAC地址
// requried: false
Macs []string `json:"macs"`
// 子网内的IPv4地址, 若不指定会按照子网的地址分配策略分配一个IP地址
// required: false
Address string `json:"address"`
// 如果是批量创建,指定每台主机子网内的IPv4地址
// required: false
Addresses []string `json:"addresses"`
// 子网内的IPv6地址
// required: false
// swagger:ignore
Address6 string `json:"address6"`
// 如果是批量创建,指定每台主机子网内的IPv4地址
// required: false
Addresses6 []string `json:"addresses6"`
// 驱动方式
// 若指定镜像的网络驱动方式,此参数会被覆盖
Driver string `json:"driver"`
BwLimit int `json:"bw_limit"`
Vip bool `json:"vip"`
Reserved bool `json:"reserved"`
NetType string `json:"net_type"`
NumQueues int `json:"num_queues"`
Driver string `json:"driver"`
BwLimit int `json:"bw_limit"`
Vip bool `json:"vip"`
Reserved bool `json:"reserved"`
NetType string `json:"net_type"`
NumQueues int `json:"num_queues"`
RxTrafficLimit int64 `json:"rx_traffic_limit"`
TxTrafficLimit int64 `json:"tx_traffic_limit"`
// sriov nic
SriovDevice *IsolatedDeviceConfig `json:"sriov_device"`
@@ -233,6 +247,13 @@ type DiskConfig struct {
//swagger:ignore
ExistingPath string `json:"existing_path"`
// requried:false
Iops int `json:"iops"`
// 磁盘吞吐量, 仅对aws gp3生效
// 范围: 125-1000
Throughput int `json:"throughput"`
// NVNe device
NVMEDevice *IsolatedDeviceConfig `json:"nvme_device"`
}
@@ -329,6 +350,11 @@ type ServerConfigs struct {
// required: false
Backup bool `json:"backup"`
// 设置为 daemon 虚机
// default: nil
// required: false
IsDaemon *bool `json:"is_daemon"`
// swagger:ignore
// 创建虚拟机数量
// default: 1
@@ -396,7 +422,7 @@ type ServerCreateInput struct {
VcpuCount int `json:"vcpu_count"`
// 用户自定义启动脚本
// 部分平台只支持 #cloud-config yaml 格式(由于部分平台密码依赖cloud-init注入密码信息,所以不支持特殊类型的user data)
// 支持 #cloud-config yaml 格式及shell脚本
// 支持特殊user data平台: Aliyun, Qcloud, Azure, Apsara, Ucloud
// required: false
UserData string `json:"user_data"`
+7 -1
View File
@@ -132,6 +132,11 @@ type CloudaccountResourceInfo struct {
// 云账号名称
// example: google-account
Account string `json:"account,omitempty"`
// 云账号状态
AccountStatus string `json:"account_status,omitempty"`
// 云账号监控状态
AccountHealthStatus string `json:"account_health_status,omitempty"`
}
type CloudaccountCreateInput struct {
@@ -543,7 +548,8 @@ type CloudaccountSyncSkusInput struct {
}
type CloudaccountProjectMappingInput struct {
AutoCreateProject bool `json:"auto_create_project"`
AutoCreateProject bool `json:"auto_create_project"`
AutoCreateProjectForProvider bool `json:"auto_create_project_for_provider"`
ProjectId string `json:"project_id"`
+25
View File
@@ -54,6 +54,7 @@ const (
CLOUD_PROVIDER_HCS = compute.CLOUD_PROVIDER_HCS
CLOUD_PROVIDER_OPENSTACK = compute.CLOUD_PROVIDER_OPENSTACK
CLOUD_PROVIDER_UCLOUD = compute.CLOUD_PROVIDER_UCLOUD
CLOUD_PROVIDER_VOLCENGINE = compute.CLOUD_PROVIDER_VOLCENGINE
CLOUD_PROVIDER_ZSTACK = compute.CLOUD_PROVIDER_ZSTACK
CLOUD_PROVIDER_GOOGLE = compute.CLOUD_PROVIDER_GOOGLE
CLOUD_PROVIDER_CTYUN = compute.CLOUD_PROVIDER_CTYUN
@@ -65,6 +66,10 @@ const (
CLOUD_PROVIDER_PROXMOX = compute.CLOUD_PROVIDER_PROXMOX
CLOUD_PROVIDER_REMOTEFILE = compute.CLOUD_PROVIDER_REMOTEFILE
CLOUD_PROVIDER_H3C = compute.CLOUD_PROVIDER_H3C
CLOUD_PROVIDER_KSYUN = compute.CLOUD_PROVIDER_KSYUN
CLOUD_PROVIDER_BAIDU = compute.CLOUD_PROVIDER_BAIDU
CLOUD_PROVIDER_CUCLOUD = compute.CLOUD_PROVIDER_CUCLOUD
CLOUD_PROVIDER_QINGCLOUD = compute.CLOUD_PROVIDER_QINGCLOUD
CLOUD_PROVIDER_GENERICS3 = compute.CLOUD_PROVIDER_GENERICS3
CLOUD_PROVIDER_CEPH = compute.CLOUD_PROVIDER_CEPH
@@ -130,6 +135,7 @@ var (
CLOUD_PROVIDER_HCS,
CLOUD_PROVIDER_OPENSTACK,
CLOUD_PROVIDER_UCLOUD,
CLOUD_PROVIDER_VOLCENGINE,
CLOUD_PROVIDER_ZSTACK,
CLOUD_PROVIDER_GOOGLE,
CLOUD_PROVIDER_CTYUN,
@@ -142,6 +148,10 @@ var (
CLOUD_PROVIDER_PROXMOX,
CLOUD_PROVIDER_REMOTEFILE,
CLOUD_PROVIDER_H3C,
CLOUD_PROVIDER_KSYUN,
CLOUD_PROVIDER_BAIDU,
CLOUD_PROVIDER_CUCLOUD,
CLOUD_PROVIDER_QINGCLOUD,
}
CLOUD_PROVIDER_HOST_TYPE_MAP = map[string][]string{
@@ -186,6 +196,9 @@ var (
CLOUD_PROVIDER_UCLOUD: {
HOST_TYPE_UCLOUD,
},
CLOUD_PROVIDER_VOLCENGINE: {
HOST_TYPE_VOLCENGINE,
},
CLOUD_PROVIDER_ZSTACK: {
HOST_TYPE_ZSTACK,
},
@@ -222,6 +235,18 @@ var (
CLOUD_PROVIDER_H3C: {
HOST_TYPE_H3C,
},
CLOUD_PROVIDER_KSYUN: {
HOST_TYPE_KSYUN,
},
CLOUD_PROVIDER_BAIDU: {
HOST_TYPE_BAIDU,
},
CLOUD_PROVIDER_CUCLOUD: {
HOST_TYPE_CUCLOUD,
},
CLOUD_PROVIDER_QINGCLOUD: {
HOST_TYPE_QINGCLOUD,
},
}
)
+75 -2
View File
@@ -14,11 +14,84 @@
package compute
import "yunion.io/x/onecloud/pkg/apis"
import (
"yunion.io/x/cloudmux/pkg/apis/compute"
"yunion.io/x/cloudmux/pkg/cloudprovider"
"yunion.io/x/pkg/util/regutils"
"yunion.io/x/onecloud/pkg/apis"
"yunion.io/x/onecloud/pkg/httperrors"
)
const (
DNS_RECORDSET_STATUS_AVAILABLE = compute.DNS_RECORDSET_STATUS_AVAILABLE
DNS_RECORDSET_STATUS_CREATING = apis.STATUS_CREATING
)
type DnsRecordCreateInput struct {
apis.AdminSharableVirtualResourceBaseCreateInput
apis.EnabledStatusStandaloneResourceCreateInput
DnsZoneId string `json:"dns_zone_id"`
DnsType string `json:"dns_type"`
DnsValue string `json:"dns_value"`
TTL int64 `json:"ttl"`
MxPriority int64 `json:"mx_priority"`
PolicyType string `json:"policy_type"`
PolicyValue string `json:"policy_value"`
}
type DnsRecordUpdateInput struct {
apis.EnabledStatusStandaloneResourceBaseUpdateInput
DnsType string `json:"dns_type"`
DnsValue string `json:"dns_value"`
TTL *int64 `json:"ttl"`
MxPriority *int64 `json:"mx_priority"`
}
type DnsRecordDetails struct {
apis.EnabledStatusStandaloneResourceDetails
SDnsRecord
DnsZone string `json:"dns_zone"`
}
type DnsRecordListInput struct {
apis.EnabledStatusStandaloneResourceListInput
DnsZoneFilterListBase
}
type DnsRecordEnableInput struct {
apis.PerformEnableInput
}
type DnsRecordDisableInput struct {
apis.PerformDisableInput
}
func (record *SDnsRecord) ValidateDnsrecordValue() error {
switch cloudprovider.TDnsType(record.DnsType) {
case cloudprovider.DnsTypeMX:
if record.MxPriority < 1 || record.MxPriority > 50 {
return httperrors.NewOutOfRangeError("mx_priority range limited to [1,50]")
}
if !regutils.MatchDomainName(record.DnsValue) {
return httperrors.NewInputParameterError("invalid domain %s for MX record", record.DnsValue)
}
case cloudprovider.DnsTypeA:
if !regutils.MatchIP4Addr(record.DnsValue) {
return httperrors.NewInputParameterError("invalid ipv4 %s for A record", record.DnsValue)
}
case cloudprovider.DnsTypeAAAA:
if !regutils.MatchIP6Addr(record.DnsValue) {
return httperrors.NewInputParameterError("invalid ipv6 %s for AAAA record", record.DnsValue)
}
case cloudprovider.DnsTypeCNAME:
if !regutils.MatchDomainName(record.DnsValue) {
return httperrors.NewInputParameterError("invalid domain %s for CNAME record", record.DnsValue)
}
}
return nil
}
-115
View File
@@ -1,115 +0,0 @@
// Copyright 2019 Yunion
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package compute
import (
"regexp"
"yunion.io/x/cloudmux/pkg/apis/compute"
"yunion.io/x/cloudmux/pkg/cloudprovider"
"yunion.io/x/jsonutils"
"yunion.io/x/pkg/util/regutils"
"yunion.io/x/onecloud/pkg/apis"
"yunion.io/x/onecloud/pkg/httperrors"
)
const (
DNS_RECORDSET_STATUS_AVAILABLE = compute.DNS_RECORDSET_STATUS_AVAILABLE
)
type DnsRecordPolicy struct {
// 平台
Provider string `json:"provider"`
PolicyType string `json:"policy_type"`
PolicyValue string `json:"policy_value"`
PolicyOptions *jsonutils.JSONDict `json:"policy_options"`
}
type DnsRecordSetCreateInput struct {
apis.EnabledStatusStandaloneResourceCreateInput
DnsZoneId string `json:"dns_zone_id"`
DnsType string `json:"dns_type"`
DnsValue string `json:"dns_value"`
TTL int64 `json:"ttl"`
MxPriority int64 `json:"mx_priority"`
TrafficPolicies []DnsRecordPolicy `json:"traffic_policies"`
}
type DnsRecordSetUpdateInput struct {
apis.EnabledStatusStandaloneResourceBaseUpdateInput
DnsType string `json:"dns_type"`
DnsValue string `json:"dns_value"`
TTL *int64 `json:"ttl"`
MxPriority *int64 `json:"mx_priority"`
TrafficPolicies []DnsRecordPolicy
}
type DnsRecordSetDetails struct {
apis.EnabledStatusStandaloneResourceDetails
SDnsRecordSet
TrafficPolicies []DnsRecordPolicy
DnsZone string `json:"dns_zone"`
}
type DnsRecordSetListInput struct {
apis.EnabledStatusStandaloneResourceListInput
DnsZoneFilterListBase
}
type DnsRecordEnableInput struct {
apis.PerformEnableInput
}
type DnsRecordDisableInput struct {
apis.PerformDisableInput
}
type DnsRecordSetTrafficPoliciesInput struct {
TrafficPolicies []DnsRecordPolicy `json:"traffic_policies"`
}
func (recordset *SDnsRecordSet) ValidateDnsrecordValue() error {
domainReg := regexp.MustCompile(`^(([a-zA-Z]{1})|([a-zA-Z]{1}[a-zA-Z]{1})|([a-zA-Z]{1}[0-9]{1})|([0-9]{1}[a-zA-Z]{1})|([a-zA-Z0-9][a-zA-Z0-9-_]{1,61}[a-zA-Z0-9]))\.([a-zA-Z]{2,6}|[a-zA-Z0-9-]{2,30}\.[a-zA-Z]{2,3})$`)
switch cloudprovider.TDnsType(recordset.DnsType) {
case cloudprovider.DnsTypeMX:
if recordset.MxPriority < 1 || recordset.MxPriority > 50 {
return httperrors.NewOutOfRangeError("mx_priority range limited to [1,50]")
}
if !domainReg.MatchString(recordset.DnsValue) {
return httperrors.NewInputParameterError("invalid domain %s for MX record", recordset.DnsValue)
}
case cloudprovider.DnsTypeA:
if !regutils.MatchIP4Addr(recordset.DnsValue) {
return httperrors.NewInputParameterError("invalid ipv4 %s for A record", recordset.DnsValue)
}
case cloudprovider.DnsTypeAAAA:
if !regutils.MatchIP6Addr(recordset.DnsValue) {
return httperrors.NewInputParameterError("invalid ipv6 %s for AAAA record", recordset.DnsValue)
}
case cloudprovider.DnsTypeCNAME:
if !domainReg.MatchString(recordset.DnsValue) {
return httperrors.NewInputParameterError("invalid domain %s for CNAME record", recordset.DnsValue)
}
}
return nil
}
+17 -101
View File
@@ -16,86 +16,28 @@ package compute
import (
"yunion.io/x/cloudmux/pkg/apis/compute"
"yunion.io/x/jsonutils"
"yunion.io/x/onecloud/pkg/apis"
)
/*
Architecture For DnsZone
+-----------+ +----------------+ +-----------+
| RecordSet | | TrafficPolicy | | RecordSet | +-------------+
| (A) | | (Aliyun) | | (TXT) | | Vpc1 |
| | | | | | | (Aws) |
| | | | | | | |
+-----------------------+ | | | | | | +-----------------+ | |
API | DnsZone example.com | | RecordSet | | TrafficPolicy | | RecordSet | | DnsZone abc.app | | Vpc2 |
| (Public) | ------>| (AAAA) | -----------------> | (Tencent) | <-------------| (CAA) | <-------------| (Private) |-----> | (Tencent) |
+-----------------------+ | | | | | | +-----------------+ | |
^ | | | | | | ^ | |
| | | | | | | | | Vpc3 |
| | RecordSet | | TrafficPolicy | | RecordSet | | | (Aws) |
| | (NS) | | (Aws) | | (PTR) | | +-------------+
| +-----------+ +----------------+ +-----------+ |
| |
| |
------------------------------------------------------------------------------------------------------------------------------------------------------------------------
| |
v |
+-----------------+ |
| | |
| | +----------+ v
| example.com <-------------> | Account1 | +----------+ +---------------+
| | | (Aliyun) | | Account3 | <-------> | abc.app |
| | +----------+ +------------+ | (Aws) | | |
| | | Account2 | +----------+ | |
| example.com <-------------------------------------------------------> | (Tencent) | | |
Cache | | +------------+ | |
| | | |
| | +----------+ | |
| example.com <-------------> | Account4 | <--------------------------------------------------------------------------------> | abc.app |
| | | (Aliyun) | | |
| | +----------+ +---------------+
+-----------------+
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
************* *************** *************
**** **** **** **** **** ****
Public Cloud ** Aliyun ** ** Tencent ** ** Aws **
**** **** **** **** **** ****
************* *************** *************
*/
const (
DNS_ZONE_STATUS_AVAILABLE = compute.DNS_ZONE_STATUS_AVAILABLE // 可用
DNS_ZONE_STATUS_CREATING = "creating" // 创建中
DNS_ZONE_STATUS_CREATE_FAILE = "create_failed" // 创建失败
DNS_ZONE_STATUS_UNCACHING = "uncaching" // 云上资源删除中
DNS_ZONE_STATUS_UNCACHE_FAILED = "uncache_failed" // 云上资源删除失败
DNS_ZONE_STATUS_CACHING = "caching" // 云上资源创建中
DNS_ZONE_STATUS_CACHE_FAILED = "cache_failed" // 云上资源创建失败
DNS_ZONE_STATUS_SYNC_VPCS = "sync_vpcs" // 同步VPC中
DNS_ZONE_STATUS_SYNC_VPCS_FAILED = "sync_vpcs_failed" // 同步VPC失败
DNS_ZONE_STATUS_SYNC_RECORD_SETS = "sync_record_sets" // 同步解析列表中
DNS_ZONE_STATUS_SYNC_RECORD_SETS_FAILED = "sync_record_sets_failed" // 同步解析列表失败
DNS_ZONE_STATUS_DELETING = "deleting" // 删除中
DNS_ZONE_STATUS_DELETE_FAILED = "delete_failed" // 删除失败
DNS_ZONE_STATUS_UNKNOWN = compute.DNS_ZONE_STATUS_UNKNOWN // 未知
DNS_ZONE_STATUS_AVAILABLE = compute.DNS_ZONE_STATUS_AVAILABLE // 可用
DNS_ZONE_STATUS_CREATING = "creating" // 创建中
DNS_ZONE_STATUS_CREATE_FAILE = "create_failed" // 创建失败
DNS_ZONE_STATUS_DELETING = "deleting" // 删除中
DNS_ZONE_STATUS_DELETE_FAILED = "delete_failed" // 删除失败
DNS_ZONE_STATUS_UNKNOWN = compute.DNS_ZONE_STATUS_UNKNOWN // 未知
)
type DnsZoneFilterListBase struct {
DnsZoneId string `json:"dns_zone_id"`
ManagedResourceListInput
}
type DnsZoneCreateInput struct {
apis.EnabledStatusInfrasResourceBaseCreateInput
apis.SharableVirtualResourceCreateInput
CloudproviderResourceInput
// 区域类型
//
@@ -109,28 +51,23 @@ type DnsZoneCreateInput struct {
// VPC id列表, 仅在zone_type为PrivateZone时生效, vpc列表必须属于同一个账号
VpcIds []string `json:"vpc_ids"`
// 云账号Id, 仅在zone_type为PublicZone时生效, 若为空则不会在云上创建
CloudaccountId string `json:"cloudaccount_id"`
// 额外信息
Options *jsonutils.JSONDict `json:"options"`
}
type DnsZoneDetails struct {
apis.EnabledStatusInfrasResourceBaseDetails
apis.SharableVirtualResourceDetails
ManagedResourceInfo
SDnsZone
// Dns记录数量
DnsRecordsetCount int `json:"dns_recordset_count"`
DnsRecordCount int `json:"dns_record_count"`
// 关联vpc数量
VpcCount int `json:"vpc_count"`
// Cache info
CloudCaches []jsonutils.JSONObject `json:"cloud_caches"`
}
type DnsZoneListInput struct {
apis.EnabledStatusInfrasResourceBaseListInput
apis.SharableVirtualResourceListInput
ManagedResourceListInput
// 区域类型
//
@@ -142,30 +79,12 @@ type DnsZoneListInput struct {
ZoneType string `json:"zone_type"`
// Filter dns zone By vpc
VpcId string `json:"vpc_id"`
WithCache bool `json:"with_cache"`
VpcId string `json:"vpc_id"`
}
type DnsZoneSyncStatusInput struct {
}
type DnsZoneCacheInput struct {
// 云账号Id
//
//
// | 要求 |
// |---------- |
// | 1. dns zone 状态必须为available |
// | 2. dns zone zone_type 必须为PublicZone |
// | 3. 指定云账号未在云上创建相应的 dns zone |
CloudaccountId string
}
type DnsZoneUnacheInput struct {
// 云账号Id
CloudaccountId string
}
type DnsZoneAddVpcsInput struct {
// VPC id列表
VpcIds []string `json:"vpc_ids"`
@@ -176,8 +95,5 @@ type DnsZoneRemoveVpcsInput struct {
VpcIds []string `json:"vpc_ids"`
}
type DnsZoneSyncRecordSetsInput struct {
}
type DnsZonePurgeInput struct {
}
+5
View File
@@ -143,3 +143,8 @@ type ElasticDissociateInput struct {
// default: false
AutoDelete bool `json:"auto_delete"`
}
type ElasticipRemoteUpdateInput struct {
// 是否覆盖替换所有标签
ReplaceTags *bool `json:"replace_tags" help:"replace all remote tags"`
}
+59 -27
View File
@@ -17,33 +17,34 @@ package compute
import "yunion.io/x/cloudmux/pkg/apis/compute"
const (
VM_INIT = compute.VM_INIT
VM_UNKNOWN = compute.VM_UNKNOWN
VM_SCHEDULE = "schedule"
VM_SCHEDULE_FAILED = "sched_fail"
VM_CREATE_NETWORK = "network"
VM_NETWORK_FAILED = "net_fail"
VM_DEVICE_FAILED = "dev_fail"
VM_CREATE_FAILED = compute.VM_CREATE_FAILED
VM_CREATE_DISK = "disk"
VM_DISK_FAILED = "disk_fail"
VM_IMAGE_CACHING = "image_caching" // 缓存镜像中
VM_START_DEPLOY = "start_deploy"
VM_DEPLOYING = compute.VM_DEPLOYING
VM_DEPLOY_FAILED = compute.VM_DEPLOY_FAILED
VM_READY = compute.VM_READY
VM_START_START = compute.VM_START_START
VM_STARTING = compute.VM_STARTING
VM_START_FAILED = "start_fail" // # = ready
VM_RUNNING = compute.VM_RUNNING
VM_START_STOP = compute.VM_START_STOP
VM_STOPPING = compute.VM_STOPPING
VM_STOP_FAILED = "stop_fail" // # = running
VM_RENEWING = "renewing"
VM_RENEW_FAILED = "renew_failed"
VM_ATTACH_DISK = "attach_disk"
VM_DETACH_DISK = "detach_disk"
VM_UNSYNC = "unsync"
VM_INIT = compute.VM_INIT
VM_UNKNOWN = compute.VM_UNKNOWN
VM_SCHEDULE = "schedule"
VM_SCHEDULE_FAILED = "sched_fail"
VM_CREATE_NETWORK = "network"
VM_NETWORK_FAILED = "net_fail"
VM_DEVICE_FAILED = "dev_fail"
VM_CREATE_FAILED = compute.VM_CREATE_FAILED
VM_CREATE_DISK = "disk"
VM_DISK_FAILED = "disk_fail"
VM_SECURITY_GROUP_FAILED = "security_group_fail"
VM_IMAGE_CACHING = "image_caching" // 缓存镜像中
VM_START_DEPLOY = "start_deploy"
VM_DEPLOYING = compute.VM_DEPLOYING
VM_DEPLOY_FAILED = compute.VM_DEPLOY_FAILED
VM_READY = compute.VM_READY
VM_START_START = compute.VM_START_START
VM_STARTING = compute.VM_STARTING
VM_START_FAILED = "start_fail" // # = ready
VM_RUNNING = compute.VM_RUNNING
VM_START_STOP = compute.VM_START_STOP
VM_STOPPING = compute.VM_STOPPING
VM_STOP_FAILED = "stop_fail" // # = running
VM_RENEWING = "renewing"
VM_RENEW_FAILED = "renew_failed"
VM_ATTACH_DISK = "attach_disk"
VM_DETACH_DISK = "detach_disk"
VM_UNSYNC = "unsync"
VM_START_RESCUE = "start_rescue"
VM_RESCUING = "rescuing"
@@ -114,6 +115,9 @@ const (
VM_SYNC_CONFIG = compute.VM_SYNC_CONFIG
VM_SYNC_FAIL = "sync_fail"
VM_SYNC_TRAFFIC_LIMIT = "sync_traffic_limit"
VM_SYNC_TRAFFIC_LIMIT_FAILED = "sync_traffic_limit_failed"
VM_START_RESIZE_DISK = "start_resize_disk"
VM_RESIZE_DISK = "resize_disk"
VM_RESIZE_DISK_FAILED = "resize_disk_fail"
@@ -170,6 +174,9 @@ const (
VM_QGA_COMMAND_EXECUTING = "qga_command_executing"
VM_QGA_EXEC_COMMAND_FAILED = "qga_exec_command_failed"
VM_QGA_SET_NETWORK = "qga_set_network"
VM_QGA_SET_NETWORK_FAILED = "qga_set_network_failed"
SHUTDOWN_STOP = "stop"
SHUTDOWN_TERMINATE = "terminate"
@@ -191,6 +198,7 @@ const (
HYPERVISOR_HCSOP = compute.HYPERVISOR_HCSOP
HYPERVISOR_OPENSTACK = compute.HYPERVISOR_OPENSTACK
HYPERVISOR_UCLOUD = compute.HYPERVISOR_UCLOUD
HYPERVISOR_VOLCENGINE = compute.HYPERVISOR_VOLCENGINE
HYPERVISOR_ZSTACK = compute.HYPERVISOR_ZSTACK
HYPERVISOR_GOOGLE = compute.HYPERVISOR_GOOGLE
HYPERVISOR_CTYUN = compute.HYPERVISOR_CTYUN
@@ -203,6 +211,10 @@ const (
HYPERVISOR_PROXMOX = compute.HYPERVISOR_PROXMOX
HYPERVISOR_REMOTEFILE = compute.HYPERVISOR_REMOTEFILE
HYPERVISOR_H3C = compute.HYPERVISOR_H3C
HYPERVISOR_KSYUN = compute.HYPERVISOR_KSYUN
HYPERVISOR_BAIDU = compute.HYPERVISOR_BAIDU
HYPERVISOR_CUCLOUD = compute.HYPERVISOR_CUCLOUD
HYPERVISOR_QINGCLOUD = compute.HYPERVISOR_QINGCLOUD
// HYPERVISOR_DEFAULT = HYPERVISOR_KVM
HYPERVISOR_DEFAULT = HYPERVISOR_KVM
@@ -264,6 +276,7 @@ var HYPERVISORS = []string{
HYPERVISOR_HCSOP,
HYPERVISOR_OPENSTACK,
HYPERVISOR_UCLOUD,
HYPERVISOR_VOLCENGINE,
HYPERVISOR_ZSTACK,
HYPERVISOR_GOOGLE,
HYPERVISOR_CTYUN,
@@ -276,6 +289,10 @@ var HYPERVISORS = []string{
HYPERVISOR_PROXMOX,
HYPERVISOR_REMOTEFILE,
HYPERVISOR_H3C,
HYPERVISOR_KSYUN,
HYPERVISOR_BAIDU,
HYPERVISOR_CUCLOUD,
HYPERVISOR_QINGCLOUD,
}
var ONECLOUD_HYPERVISORS = []string{
@@ -291,10 +308,15 @@ var PUBLIC_CLOUD_HYPERVISORS = []string{
HYPERVISOR_QCLOUD,
HYPERVISOR_HUAWEI,
HYPERVISOR_UCLOUD,
HYPERVISOR_VOLCENGINE,
HYPERVISOR_GOOGLE,
HYPERVISOR_CTYUN,
HYPERVISOR_ECLOUD,
HYPERVISOR_JDCLOUD,
HYPERVISOR_KSYUN,
HYPERVISOR_BAIDU,
HYPERVISOR_CUCLOUD,
HYPERVISOR_QINGCLOUD,
}
var PRIVATE_CLOUD_HYPERVISORS = []string{
@@ -331,6 +353,7 @@ var HYPERVISOR_HOSTTYPE = map[string]string{
HYPERVISOR_HCS: HOST_TYPE_HCS,
HYPERVISOR_OPENSTACK: HOST_TYPE_OPENSTACK,
HYPERVISOR_UCLOUD: HOST_TYPE_UCLOUD,
HYPERVISOR_VOLCENGINE: HOST_TYPE_VOLCENGINE,
HYPERVISOR_ZSTACK: HOST_TYPE_ZSTACK,
HYPERVISOR_GOOGLE: HOST_TYPE_GOOGLE,
HYPERVISOR_CTYUN: HOST_TYPE_CTYUN,
@@ -343,6 +366,10 @@ var HYPERVISOR_HOSTTYPE = map[string]string{
HYPERVISOR_PROXMOX: HOST_TYPE_PROXMOX,
HYPERVISOR_REMOTEFILE: HOST_TYPE_REMOTEFILE,
HYPERVISOR_H3C: HOST_TYPE_H3C,
HYPERVISOR_KSYUN: HOST_TYPE_KSYUN,
HYPERVISOR_BAIDU: HOST_TYPE_BAIDU,
HYPERVISOR_CUCLOUD: HOST_TYPE_CUCLOUD,
HYPERVISOR_QINGCLOUD: HOST_TYPE_QINGCLOUD,
}
var HOSTTYPE_HYPERVISOR = map[string]string{
@@ -361,6 +388,7 @@ var HOSTTYPE_HYPERVISOR = map[string]string{
HOST_TYPE_HCS: HYPERVISOR_HCS,
HOST_TYPE_OPENSTACK: HYPERVISOR_OPENSTACK,
HOST_TYPE_UCLOUD: HYPERVISOR_UCLOUD,
HOST_TYPE_VOLCENGINE: HYPERVISOR_VOLCENGINE,
HOST_TYPE_ZSTACK: HYPERVISOR_ZSTACK,
HOST_TYPE_GOOGLE: HYPERVISOR_GOOGLE,
HOST_TYPE_CTYUN: HYPERVISOR_CTYUN,
@@ -373,6 +401,10 @@ var HOSTTYPE_HYPERVISOR = map[string]string{
HOST_TYPE_PROXMOX: HYPERVISOR_PROXMOX,
HOST_TYPE_REMOTEFILE: HYPERVISOR_REMOTEFILE,
HOST_TYPE_H3C: HYPERVISOR_H3C,
HOST_TYPE_KSYUN: HYPERVISOR_KSYUN,
HOST_TYPE_BAIDU: HYPERVISOR_BAIDU,
HOST_TYPE_CUCLOUD: HYPERVISOR_CUCLOUD,
HOST_TYPE_QINGCLOUD: HYPERVISOR_QINGCLOUD,
}
const (
+25 -24
View File
@@ -68,29 +68,29 @@ type GuestdiskUpdateInput struct {
}
type GuestdiskJsonDesc struct {
DiskId string `json:"disk_id"`
Driver string `json:"driver"`
CacheMode string `json:"cache_mode"`
AioMode string `json:"aio_mode"`
Iops int `json:"iops"`
Bps int `json:"bps"`
Size int `json:"size"`
TemplateId string `json:"template_id"`
ImagePath string `json:"image_path"`
StorageId string `json:"storage_id"`
StorageType string `json:"storage_type"`
Migrating bool `json:"migrating"`
Path string `json:"path"`
Format string `json:"format"`
Index int8 `json:"index"`
BootIndex *int8 `json:"boot_index"`
MergeSnapshot bool `json:"merge_snapshot"`
EsxiFlatFilePath string `json:"esxi_flat_file_path"`
Fs string `json:"fs"`
Mountpoint string `json:"mountpoint"`
Dev string `json:"dev"`
IsSSD bool `json:"is_ssd"`
NumQueues uint8 `json:"num_queues"`
DiskId string `json:"disk_id"`
Driver string `json:"driver"`
CacheMode string `json:"cache_mode"`
AioMode string `json:"aio_mode"`
Iops int `json:"iops"`
Throughput int `json:"throughput"`
Bps int `json:"bps"`
Size int `json:"size"`
TemplateId string `json:"template_id"`
ImagePath string `json:"image_path"`
StorageId string `json:"storage_id"`
StorageType string `json:"storage_type"`
Migrating bool `json:"migrating"`
Path string `json:"path"`
Format string `json:"format"`
Index int8 `json:"index"`
BootIndex *int8 `json:"boot_index"`
MergeSnapshot bool `json:"merge_snapshot"`
Fs string `json:"fs"`
Mountpoint string `json:"mountpoint"`
Dev string `json:"dev"`
IsSSD bool `json:"is_ssd"`
NumQueues uint8 `json:"num_queues"`
// esxi
ImageInfo struct {
@@ -101,5 +101,6 @@ type GuestdiskJsonDesc struct {
TargetStorageId string `json:"target_storage_id"`
Url string `json:"url"`
EsxiFlatFilePath string `json:"esxi_flat_file_path"`
Url string `json:"url"`
}
+4 -3
View File
@@ -15,9 +15,10 @@
package compute
const (
SERVER_META_CONVERT_FROM_ESXI = "__server_convert_from_esxi"
SERVER_META_CONVERTED_SERVER = "__server_converted_to"
DISK_META_ESXI_FLAT_FILE_PATH = "__esxi_flat_file_path"
SERVER_META_CONVERT_FROM_ESXI = "__server_convert_from_esxi"
SERVER_META_CONVERT_FROM_CLOUDPODS = "__server_convert_from_cloudpods"
SERVER_META_CONVERTED_SERVER = "__server_converted_to"
DISK_META_REMOTE_ACCESS_PATH = "__remote_access_path"
)
type SImportNic struct {
+33 -19
View File
@@ -14,7 +14,10 @@
package compute
import "yunion.io/x/jsonutils"
import (
"yunion.io/x/cloudmux/pkg/apis/compute"
"yunion.io/x/jsonutils"
)
type GuestnetworkDetails struct {
GuestJointResourceDetails
@@ -28,6 +31,8 @@ type GuestnetworkDetails struct {
// EipAddr associate with this guestnetwork
EipAddr string `json:"eip_addr"`
NetworkAddresses []NetworkAddrConf `json:"network_addresses"`
}
type GuestnetworkShortDesc struct {
@@ -77,22 +82,24 @@ type GuestnetworkUpdateInput struct {
}
type GuestnetworkBaseDesc struct {
Net string `json:"net"`
NetId string `json:"net_id"`
Mac string `json:"mac"`
Virtual bool `json:"virtual"`
Ip string `json:"ip"`
Gateway string `json:"gateway"`
Dns string `json:"dns"`
Domain string `json:"domain"`
Ntp string `json:"ntp"`
Routes jsonutils.JSONObject `json:"routes"`
Ifname string `json:"ifname"`
Masklen int8 `json:"masklen"`
Vlan int `json:"vlan"`
Bw int `json:"bw"`
Mtu int `json:"mtu"`
Index int8 `json:"index"`
Net string `json:"net"`
NetId string `json:"net_id"`
Mac string `json:"mac"`
Virtual bool `json:"virtual"`
Ip string `json:"ip"`
Gateway string `json:"gateway"`
Dns string `json:"dns"`
Domain string `json:"domain"`
Ntp string `json:"ntp"`
Routes jsonutils.JSONObject `json:"routes"`
Ifname string `json:"ifname"`
Masklen int8 `json:"masklen"`
Vlan int `json:"vlan"`
Bw int `json:"bw"`
Mtu int16 `json:"mtu"`
Index int8 `json:"index"`
RxTrafficLimit int64 `json:"rx_traffic_limit"`
TxTrafficLimit int64 `json:"tx_traffic_limit"`
Bridge string `json:"bridge"`
WireId string `json:"wire_id"`
@@ -125,6 +132,13 @@ type GuestnetworkJsonDesc struct {
// baremetal
Rate int `json:"rate"`
BaremetalId string `json:"baremetal_id"`
NicType string `json:"nic_type"`
LinkUp bool `json:"link_up"`
NicType compute.TNicType `json:"nic_type"`
LinkUp bool `json:"link_up"`
}
type SNicTrafficRecord struct {
RxTraffic int64
TxTraffic int64
}
+112 -11
View File
@@ -144,13 +144,17 @@ type ServerRebuildRootInput struct {
// required: true
ImageId string `json:"image_id"`
// swagger: ignore
Keypair string `json:"keypair" yunion-deprecated-by:"keypair_id"`
// Keypair string `json:"keypair" yunion-deprecated-by:"keypair_id"`
// 秘钥Id
KeypairId string `json:"keypair_id"`
ResetPassword *bool `json:"reset_password"`
Password string `json:"password"`
AutoStart *bool `json:"auto_start"`
AllDisks *bool `json:"all_disks"`
// KeypairId string `json:"keypair_id"`
// ResetPassword *bool `json:"reset_password"`
// Password string `json:"password"`
AutoStart *bool `json:"auto_start"`
AllDisks *bool `json:"all_disks"`
ServerDeployInputBase
}
type ServerResumeInput struct {
@@ -305,6 +309,9 @@ func (self ServerDetails) GetMetricTags() map[string]string {
}
for k, v := range self.Metadata {
if strings.HasPrefix(k, db.USER_TAG_PREFIX) {
if strings.Contains(k, "login_key") || strings.Contains(v, "=") {
continue
}
ret[k] = v
}
}
@@ -435,13 +442,16 @@ type GuestAutoRenewInput struct {
Duration string `json:"duration"`
}
type ConvertEsxiToKvmInput struct {
type ConvertToKvmInput struct {
apis.Meta
// target hypervisor
TargetHypervisor string `json:"target_hypervisor"`
// 指定转换的宿主机
PreferHost string `json:"prefer_host"`
// dest guest network configs
Networks []*NetworkConfig `json:"networks"`
}
type GuestSaveToTemplateInput struct {
@@ -684,6 +694,15 @@ type ServerMigrateNetworkInput struct {
type ServerDeployInput struct {
apis.Meta
ServerDeployInputBase
// 部署完成后是否自动启动
// 若虚拟机重置密码后需要重启生效,并且当前虚拟机状态为running, 此参数默认为true
// 若虚拟机状态为ready, 指定此参数后,部署完成后,虚拟机会自动启动
AutoStart bool `json:"auto_start"`
}
type ServerDeployInputBase struct {
// swagger: ignore
Keypair string `json:"keypair" yunion-deprecated-by:"keypair_id"`
// 秘钥Id
@@ -698,10 +717,7 @@ type ServerDeployInput struct {
ResetPassword bool `json:"reset_password"`
// 重置指定密码
Password string `json:"password"`
// 部署完成后是否自动启动
// 若虚拟机重置密码后需要重启生效,并且当前虚拟机状态为running, 此参数默认为true
// 若虚拟机状态为ready, 指定此参数后,部署完成后,虚拟机会自动启动
AutoStart bool `json:"auto_start"`
// swagger: ignore
Restart bool `json:"restart"`
@@ -858,6 +874,13 @@ type ServerSetBootIndexInput struct {
Cdroms map[string]int8 `json:"cdroms"`
}
type ServerSetDiskIoThrottleInput struct {
// key disk id, value bps
Bps map[string]int `json:"bps"`
// key disk id, value iops
IOPS map[string]int `json:"iops"`
}
type ServerChangeStorageInput struct {
TargetStorageId string `json:"target_storage_id"`
KeepOriginDisk bool `json:"keep_origin_disk"`
@@ -977,11 +1000,46 @@ type ServerQemuInfo struct {
Cmdline string `json:"cmdline"`
}
type IPAddress struct {
IPAddress string `json:"ip-address"`
IPAddressType string `json:"ip-address-type"`
Prefix int `json:"prefix"`
}
type IfnameDetail struct {
HardwareAddress string `json:"hardware-address"`
IPAddresses []IPAddress `json:"ip-addresses"`
Name string `json:"name"`
Statistics struct {
RxBytes int `json:"rx-bytes"`
RxDropped int `json:"rx-dropped"`
RxErrs int `json:"rx-errs"`
RxPackets int `json:"rx-packets"`
TxBytes int `json:"tx-bytes"`
TxDropped int `json:"tx-dropped"`
TxErrs int `json:"tx-errs"`
TxPackets int `json:"tx-packets"`
} `json:"statistics"`
}
type ServerQgaSetPasswordInput struct {
Username string
Password string
}
type ServerQgaGuestInfoTaskInput struct {
}
type ServerQgaSetNetworkInput struct {
ServerQgaTimeoutInput
Device string
Ipmask string
Gateway string
}
type ServerQgaGetNetworkInput struct {
}
type ServerQgaTimeoutInput struct {
// qga execute timeout millisecond
Timeout int
@@ -1015,3 +1073,46 @@ type ServerSetLiveMigrateParamsInput struct {
MaxBandwidthMB *int64
DowntimeLimitMS *int64
}
type ServerNicTrafficLimit struct {
Mac string `json:"mac"`
RxTrafficLimit *int64 `json:"rx_traffic_limit"`
TxTrafficLimit *int64 `json:"tx_traffic_limit"`
}
type GuestAddSubIpsInput struct {
Mac string `json:"mac"`
IpAddr string `json:"ip_addr"`
Count int `json:"count"`
SubIps []string `json:"sub_ips"`
Reserved bool `json:"reserved"`
AllocDir IPAllocationDirection `json:"alloc_dir"`
}
type NetworkAddrConf struct {
Id string `json:"id"`
Type string `json:"type"`
IpAddr string `json:"ip_addr"`
Masklen int `json:"masklen"`
Gateway string `json:"gateway"`
}
type ServerLoginInfoInput struct {
PrivateKey string `json:"private_key"`
}
type ServerLoginInfoOutput struct {
Username string `json:"username"`
Updated string `json:"updated"`
LoginKey string `json:"login_key"`
Keypair string `json:"keypair"`
Password string `json:"password"`
}
type GuestPerformStartInput struct {
// 指定启动虚拟机的Qemu版本,可选值:2.12.1, 4.2.0
// 仅适用于KVM虚拟机
QemuVersion string `json:"qemu_version"`
}
+103 -3
View File
@@ -15,9 +15,13 @@
package compute
import (
"time"
cloudmux "yunion.io/x/cloudmux/pkg/apis/compute"
"yunion.io/x/jsonutils"
"yunion.io/x/onecloud/pkg/apis"
"yunion.io/x/onecloud/pkg/cloudcommon/types"
)
type HostSpec struct {
@@ -97,8 +101,10 @@ type HostListInput struct {
CpuCount []int `json:"cpu_count"`
// 内存大小,单位Mb
MemSize []int `json:"mem_size"`
// 存储类型
// 存储类型(磁盘类型,sdd, rotate, hybrid)
StorageType []string `json:"storage_type"`
// 宿主机绑定存储类型
HostStorageType []string `json:"host_storage_type"`
// IPMI地址
IpmiIp []string `json:"ipmi_ip"`
// 宿主机状态
@@ -162,7 +168,7 @@ type HostDetails struct {
// 网卡数量
NicCount int `json:"nic_count"`
// 网卡详情
NicInfo []jsonutils.JSONObject `json:"nic_info"`
NicInfo []*types.SNic `json:"nic_info"`
// CPU超分比
CpuCommit int `json:"cpu_commit"`
// 内存超分比
@@ -298,7 +304,10 @@ type HostFilterListInputBase struct {
HostResourceInput
// 以宿主机序列号过滤
HostSN string `json:"host_sn"`
HostSN []string `json:"host_sn"`
// 以宿主机对接二层网络过滤
HostWireId string `json:"host_wire_id"`
// 以宿主机名称排序
OrderByHost string `json:"order_by_host"`
@@ -527,3 +536,94 @@ type HostAutoMigrateInput struct {
AutoMigrateOnHostDown string `json:"auto_migrate_on_host_down"`
AutoMigrateOnHostShutdown string `json:"auto_migrate_on_host_shutdown"`
}
type HostNetifInput struct {
Mac string `json:"mac"`
VlanId int `json:"vlan_id"`
}
type HostAddNetifInput struct {
HostNetifInput
// Deprecated
Wire string `json:"wire" yunion-deprecated-by:"wire_id"`
WireId string `json:"wire_id"`
IpAddr string `json:"ip_addr"`
Rate int `json:"rate"`
NicType cloudmux.TNicType `json:"nic_type"`
Index int8 `json:"index"`
LinkUp string `json:"link_up"`
Mtu int16 `json:"mtu"`
Reset *bool `json:"reset"`
Interface *string `json:"interface"`
Bridge *string `json:"bridge"`
Reserve *bool `json:"reserve"`
RequireDesignatedIp *bool `json:"require_designated_ip"`
}
type HostEnableNetifInput struct {
HostNetifInput
// Deprecated
Network string `json:"network" yunion-deprecated-by:"network_id"`
NetworkId string `json:"network_id"`
IpAddr string `json:"ip_addr"`
AllocDir string `json:"alloc_dir"`
NetType string `json:"net_type"`
Reserve *bool `json:"reserve"`
RequireDesignatedIp *bool `json:"require_designated_ip"`
}
type HostDisableNetifInput struct {
HostNetifInput
Reserve *bool `json:"reserve"`
}
type HostRemoveNetifInput struct {
HostNetifInput
Reserve *bool `json:"reserve"`
}
type HostError struct {
Type string
Id string
Name string
Content string
Time time.Time
}
type HostSyncErrorsInput struct {
HostErrors []HostError
}
type HostLoginInfoInput struct {
}
type HostLoginInfoOutput struct {
Ip string `json:"ip"`
Username string `json:"username"`
Password string `json:"password"`
}
type HostPerformStartInput struct {
}
+19 -5
View File
@@ -14,7 +14,9 @@
package compute
import "yunion.io/x/cloudmux/pkg/apis/compute"
import (
"yunion.io/x/cloudmux/pkg/apis/compute"
)
const (
HOST_TYPE_BAREMETAL = "baremetal"
@@ -36,6 +38,7 @@ const (
HOST_TYPE_HCS = compute.HOST_TYPE_HCS
HOST_TYPE_OPENSTACK = compute.HOST_TYPE_OPENSTACK
HOST_TYPE_UCLOUD = compute.HOST_TYPE_UCLOUD
HOST_TYPE_VOLCENGINE = compute.HOST_TYPE_VOLCENGINE
HOST_TYPE_ZSTACK = compute.HOST_TYPE_ZSTACK
HOST_TYPE_GOOGLE = compute.HOST_TYPE_GOOGLE
HOST_TYPE_CTYUN = compute.HOST_TYPE_CTYUN
@@ -48,6 +51,10 @@ const (
HOST_TYPE_PROXMOX = compute.HOST_TYPE_PROXMOX
HOST_TYPE_REMOTEFILE = compute.HOST_TYPE_REMOTEFILE
HOST_TYPE_H3C = compute.HOST_TYPE_H3C
HOST_TYPE_KSYUN = compute.HOST_TYPE_KSYUN
HOST_TYPE_BAIDU = compute.HOST_TYPE_BAIDU
HOST_TYPE_CUCLOUD = compute.HOST_TYPE_CUCLOUD
HOST_TYPE_QINGCLOUD = compute.HOST_TYPE_QINGCLOUD
HOST_TYPE_DEFAULT = HOST_TYPE_HYPERVISOR
@@ -57,9 +64,9 @@ const (
HOST_OFFLINE = compute.HOST_OFFLINE
HOST_DISABLED = "offline"
NIC_TYPE_IPMI = compute.NIC_TYPE_IPMI
NIC_TYPE_ADMIN = compute.NIC_TYPE_ADMIN
// #NIC_TYPE_NORMAL = 'normal'
NIC_TYPE_IPMI = compute.NIC_TYPE_IPMI
NIC_TYPE_ADMIN = compute.NIC_TYPE_ADMIN
NIC_TYPE_NORMAL = compute.NIC_TYPE_NORMAL
BAREMETAL_INIT = "init"
BAREMETAL_PREPARE = "prepare"
@@ -127,6 +134,7 @@ var HOST_TYPES = []string{
HOST_TYPE_HCSOP,
HOST_TYPE_OPENSTACK,
HOST_TYPE_UCLOUD,
HOST_TYPE_VOLCENGINE,
HOST_TYPE_ZSTACK,
HOST_TYPE_CTYUN,
HOST_TYPE_GOOGLE,
@@ -138,9 +146,14 @@ var HOST_TYPES = []string{
HOST_TYPE_PROXMOX,
HOST_TYPE_REMOTEFILE,
HOST_TYPE_H3C,
HOST_TYPE_KSYUN,
HOST_TYPE_BAIDU,
HOST_TYPE_CUCLOUD,
HOST_TYPE_QINGCLOUD,
}
var NIC_TYPES = []string{NIC_TYPE_IPMI, NIC_TYPE_ADMIN}
var ALL_NIC_TYPES = []compute.TNicType{NIC_TYPE_IPMI, NIC_TYPE_ADMIN, NIC_TYPE_NORMAL}
var HOST_NIC_TYPES = []compute.TNicType{NIC_TYPE_ADMIN, NIC_TYPE_NORMAL}
const (
ACCESS_MAC_ANY = "00:00:00:00:00:00"
@@ -162,6 +175,7 @@ const (
const (
HOSTMETA_AUTO_MIGRATE_ON_HOST_DOWN = "__auto_migrate_on_host_down"
HOSTMETA_AUTO_MIGRATE_ON_HOST_SHUTDOWN = "__auto_migrate_on_host_shutdown"
HOSTMETA_HOST_ERRORS = "__host_errors"
)
const (
+3 -1
View File
@@ -14,6 +14,8 @@
package compute
import "yunion.io/x/cloudmux/pkg/apis/compute"
type HostnetworkDetails struct {
HostJointResourceDetails
@@ -27,7 +29,7 @@ type HostnetworkDetails struct {
// 二层网络ID
WireId string `json:"wire_id"`
NicType string `json:"nic_type"`
NicType compute.TNicType `json:"nic_type"`
}
type HostnetworkListInput struct {
+1 -10
View File
@@ -38,6 +38,7 @@ type DeletePreventableCreateInput struct {
type KeypairListInput struct {
apis.UserResourceListInput
apis.SharableResourceBaseListInput
// 加密类型
// example: RSA
@@ -122,10 +123,6 @@ type BaremetalagentListInput struct {
AgentType []string `json:"agent_type"`
}
type DnsRecordListInput struct {
apis.AdminSharableVirtualResourceListInput
}
type DynamicschedtagListInput struct {
apis.StandaloneResourceListInput
SchedtagFilterListInput
@@ -169,12 +166,6 @@ type SnapshotPolicyListInput struct {
IsActivated *bool `json:"is_activated"`
}
type DnsRecordDetails struct {
apis.AdminSharableVirtualResourceDetails
SDnsRecord
}
type HostnameInput struct {
// 主机名
// 点号(.)和短横线(-)不能作为 HostName 的首尾字符,不能连续使用
+4
View File
@@ -79,6 +79,9 @@ type IsolatedDeviceCreateInput struct {
// # pci address of `Bus:Device.Function` format, or usb bus address of `bus.addr`
Addr string `json:"addr"`
// legacy vgpu mdev id
MdevId string `json:"mdev_id"`
// 设备VendorId
VendorDeviceId string `json:"vendor_device_id"`
}
@@ -111,6 +114,7 @@ type IsolatedDeviceJsonDesc struct {
OvsOffloadInterface string `json:"ovs_offload_interface"`
DiskIndex int8 `json:"disk_index"`
NvmeSizeMB int `json:"nvme_size_mb"`
MdevId string `json:"mdev_id"`
}
type IsolatedDeviceModelCreateInput struct {
+13 -7
View File
@@ -15,12 +15,14 @@
package compute
const (
DIRECT_PCI_TYPE = "PCI"
GPU_HPC_TYPE = "GPU-HPC" // # for compute
GPU_VGA_TYPE = "GPU-VGA" // # for display
USB_TYPE = "USB"
NIC_TYPE = "NIC" // nic sriov
NVME_PT_TYPE = "NVME-PT" // nvme passthrough
DIRECT_PCI_TYPE = "PCI"
GPU_HPC_TYPE = "GPU-HPC" // # for compute
GPU_VGA_TYPE = "GPU-VGA" // # for display
SRIOV_VGPU_TYPE = "SRIOV-VGPU"
LEGACY_VGPU_TYPE = "LEGACY-VGPU"
USB_TYPE = "USB"
NIC_TYPE = "NIC" // nic sriov
NVME_PT_TYPE = "NVME-PT" // nvme passthrough
NVIDIA_VENDOR_ID = "10de"
AMD_VENDOR_ID = "1002"
@@ -29,8 +31,12 @@ const (
const MEAT_PROBED_HOST_COUNT = "probed_host_count"
var VALID_GPU_TYPES = []string{GPU_HPC_TYPE, GPU_VGA_TYPE}
var VALID_ATTACH_TYPES = []string{GPU_HPC_TYPE, GPU_VGA_TYPE, USB_TYPE, SRIOV_VGPU_TYPE, LEGACY_VGPU_TYPE}
var VALID_PASSTHROUGH_TYPES = []string{DIRECT_PCI_TYPE, USB_TYPE, NIC_TYPE, GPU_HPC_TYPE, GPU_VGA_TYPE, NVME_PT_TYPE}
var VALID_PASSTHROUGH_TYPES = []string{
DIRECT_PCI_TYPE, USB_TYPE, NIC_TYPE, GPU_HPC_TYPE,
GPU_VGA_TYPE, NVME_PT_TYPE, SRIOV_VGPU_TYPE, LEGACY_VGPU_TYPE,
}
var ID_VENDOR_MAP = map[string]string{
NVIDIA_VENDOR_ID: "NVIDIA",
+1
View File
@@ -40,6 +40,7 @@ type KeypairCreateInput struct {
type KeypairDetails struct {
apis.UserResourceDetails
apis.SharableResourceBaseInfo
SKeypair
// 私钥长度
-2
View File
@@ -69,8 +69,6 @@ type KubeClusterDetails struct {
apis.EnabledStatusInfrasResourceBaseDetails
SKubeCluster
ManagedResourceInfo
CloudregionResourceInfo
VpcResourceInfo
}
+14 -1
View File
@@ -18,6 +18,7 @@ import (
"yunion.io/x/cloudmux/pkg/apis/compute"
"yunion.io/x/onecloud/pkg/apis"
"yunion.io/x/onecloud/pkg/cloudcommon/types"
)
const (
@@ -301,9 +302,15 @@ type NetworkDetails struct {
// 端口数量
Ports int `json:"ports"`
Dns string `json:"dns"`
// 路由信息
Routes [][]string `json:"routes"`
Routes []types.SRoute `json:"routes"`
Schedtags []SchedtagShortDescDetails `json:"schedtags"`
IsClassic bool `json:"is_classic"`
AdditionalWires []SSimpleWire `json:"additional_wires"`
}
type NetworkIpMacDetails struct {
@@ -447,3 +454,9 @@ type NetworkSwitchWireInput struct {
// example: bcast0
WireId string `json:"wire_id"`
}
type NetworSyncAdditionalWiresInput struct {
apis.Meta
WireIds []string `json:"wire_ids"`
}
+2 -1
View File
@@ -45,7 +45,8 @@ type NetworkAddressCreateInput struct {
Type string
NetworkId string
IPAddr string
IPAddr string `json:"ip_addr"`
IPAddrs []string `json:"ip_addrs"`
}
type NetworkAddressListInput struct {
+2
View File
@@ -143,6 +143,8 @@ type SProjectMappingAccount struct {
}
type ProjectMappingDetails struct {
SProjectMapping
apis.EnabledStatusInfrasResourceBaseDetails
Rules []ProjectMappingRuleInfoDetails
+1
View File
@@ -51,6 +51,7 @@ const (
OPERATOR_LT = "lt" // 小于
TIMER_TYPE_ONCE = "once"
TIMER_TYPE_HOUR = "hour"
TIMER_TYPE_DAY = "day"
TIMER_TYPE_WEEK = "week"
TIMER_TYPE_MONTH = "month"
+1
View File
@@ -28,6 +28,7 @@ type CycleTimerCreateInput struct {
// enum: day,week,month
CycleType string `json:"cycle_type"`
CycleHour int `json:"cycle_hour"`
// description: 分(0-59)
// example: 13
Minute int `json:"minute"`
+54 -44
View File
@@ -83,6 +83,8 @@ type SSecgroupRuleResource struct {
Description string `json:"description"`
}
type SSecgroupRuleResourceSet []SSecgroupRuleResource
type SSecgroupRuleCreateInput struct {
apis.ResourceBaseCreateInput
SSecgroupRuleResource
@@ -90,6 +92,9 @@ type SSecgroupRuleCreateInput struct {
// swagger:ignore
Secgroup string `json:"secgroup" yunion-deprecated-by:"secgroup_id"`
// swagger: ignore
Status string `json:"status"`
// 安全组ID
// required: true
SecgroupId string `json:"secgroup_id"`
@@ -98,7 +103,37 @@ type SSecgroupRuleCreateInput struct {
type SSecgroupRuleUpdateInput struct {
apis.ResourceBaseUpdateInput
SSecgroupRuleResource
Priority *int `json:"priority"`
Ports *string `json:"ports"`
// ip或cidr地址, 若指定peer_secgroup_id此参数不生效
// example: 192.168.222.121
CIDR *string `json:"cidr"`
// 协议
// required: true
//
//
//
// | protocol | name |
// | -------- | ---- |
// | any | 所有协议|
// | tcp | TCP |
// | icmp | ICMP |
// | udp | UDP |
// enum: any, tcp, udp, icmp
Protocol *string `json:"protocol"`
// 行为
// deny: 拒绝
// allow: 允许
// enum: deny, allow
// required: true
Action *string `json:"action"`
// 规则描述信息
// requried: false
// example: test to create rule
Description string `json:"description"`
}
func (input *SSecgroupRuleResource) Check() error {
@@ -137,6 +172,17 @@ func (input *SSecgroupRuleResource) Check() error {
type SSecgroupCreateInput struct {
apis.SharableVirtualResourceCreateInput
// vpc id
// defualt: default
VpcResourceInput
// swagger: ignore
CloudproviderResourceInput
// swagger: ignore
CloudregionResourceInput
// swagger: ignore
GlobalvpcId string `json:"globalvpc_id"`
// 规则列表
// required: false
Rules []SSecgroupRuleCreateInput `json:"rules"`
@@ -144,19 +190,13 @@ type SSecgroupCreateInput struct {
type SecgroupListInput struct {
apis.SharableVirtualResourceListInput
apis.ExternalizedResourceBaseListInput
ServerResourceInput
DBInstanceResourceInput
ELasticcacheResourceInput
// equals
Equals string
// 按缓存数量排序
// pattern:asc|desc
OrderByCacheCnt string `json:"order_by_cache_cnt"`
// 按缓存关联主机数排序
// pattern:asc|desc
OrderByGuestCnt string `json:"order_by_guest_cnt"`
@@ -174,25 +214,14 @@ type SecgroupListInput struct {
// example: in
Direction string `json:"direction"`
VpcId string `json:"vpc_id"`
RegionalFilterListInput
ManagedResourceListInput
WithCache bool `json:"witch_cache"`
}
type SecurityGroupCacheListInput struct {
apis.StatusStandaloneResourceListInput
apis.ExternalizedResourceBaseListInput
ManagedResourceListInput
RegionalFilterListInput
VpcFilterListInput
SecgroupFilterListInput
}
type SecurityGroupRuleListInput struct {
apis.ResourceBaseListInput
apis.ExternalizedResourceBaseListInput
SecgroupFilterListInput
Projects []string `json:"projects"`
@@ -232,6 +261,9 @@ type SecgroupDetails struct {
apis.SharableVirtualResourceDetails
SSecurityGroup
VpcResourceInfo
GlobalVpcResourceInfo
// 关联云主机数量, 不包含回收站云主机
GuestCnt int `json:"guest_cnt,allowempty"`
@@ -243,15 +275,6 @@ type SecgroupDetails struct {
// 所有关联的资源数量
TotalCnt int `json:"total_cnt,allowempty"`
// 安全组缓存数量
CacheCnt int `json:"cache_cnt,allowempty"`
// 规则信息
Rules []SecgroupRuleDetails `json:"rules"`
// 入方向规则信息
InRules []SecgroupRuleDetails `json:"in_rules"`
// 出方向规则信息
OutRules []SecgroupRuleDetails `json:"out_rules"`
}
type SecurityGroupResourceInfo struct {
@@ -292,18 +315,6 @@ type ElasticcachesecgroupDetails struct {
Secgroup string `json:"secgroup"`
}
type SecgroupMergeInput struct {
// 安全组id列表
SecgroupIds []string `json:"secgroup_ids"`
// swagger:ignore
// Deprecated
Secgroups []string `json:"secgroup" yunion-deprecated-by:"secgroup_ids"`
}
type SecurityGroupPurgeInput struct {
}
type SecurityGroupCloneInput struct {
Name string
Description string
@@ -330,6 +341,5 @@ func (self *SSecurityGroupRef) Sum() {
self.TotalCnt = self.GuestCnt + self.AdminGuestCnt + self.RdsCnt + self.RedisCnt
}
type SecurityGroupCacheInput struct {
VpcId string `json:"vpc_id"`
type SecurityGroupSyncstatusInput struct {
}
+1 -3
View File
@@ -17,9 +17,7 @@ package compute
import "yunion.io/x/cloudmux/pkg/apis/compute"
const (
SECGROUP_STATUS_READY = compute.SECGROUP_STATUS_READY
SECGROUP_STATUS_DELETING = "deleting" // 删除中
SECGROUP_STATUS_SYNC_RULES = "sync_rules" // 同步规则中
SECGROUP_STATUS_READY = compute.SECGROUP_STATUS_READY
SECGROUP_DEFAULT_ID = "default"
)

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